summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/Makefile.am128
-rw-r--r--tools/com/sun/tools/javadoc/Main.java9
-rw-r--r--tools/gjdoc.in49
-rw-r--r--tools/gnu/classpath/tools/FileSystemClassLoader.java296
-rw-r--r--tools/gnu/classpath/tools/IOToolkit.java199
-rw-r--r--tools/gnu/classpath/tools/MalformedInputEvent.java93
-rw-r--r--tools/gnu/classpath/tools/MalformedInputListener.java39
-rw-r--r--tools/gnu/classpath/tools/NotifyingInputStreamReader.java406
-rw-r--r--tools/gnu/classpath/tools/StringToolkit.java67
-rw-r--r--tools/gnu/classpath/tools/doclets/.cvsignore4
-rw-r--r--tools/gnu/classpath/tools/doclets/AbstractDoclet.java1369
-rw-r--r--tools/gnu/classpath/tools/doclets/DocletConfigurationException.java37
-rw-r--r--tools/gnu/classpath/tools/doclets/DocletOption.java39
-rw-r--r--tools/gnu/classpath/tools/doclets/DocletOptionColonSeparated.java60
-rw-r--r--tools/gnu/classpath/tools/doclets/DocletOptionFile.java60
-rw-r--r--tools/gnu/classpath/tools/doclets/DocletOptionFlag.java52
-rw-r--r--tools/gnu/classpath/tools/doclets/DocletOptionPackageWildcard.java108
-rw-r--r--tools/gnu/classpath/tools/doclets/DocletOptionString.java51
-rw-r--r--tools/gnu/classpath/tools/doclets/InlineTagRenderer.java29
-rw-r--r--tools/gnu/classpath/tools/doclets/InvalidPackageWildcardException.java35
-rw-r--r--tools/gnu/classpath/tools/doclets/PackageGroup.java41
-rw-r--r--tools/gnu/classpath/tools/doclets/PackageMatcher.java135
-rw-r--r--tools/gnu/classpath/tools/doclets/StandardTaglet.java83
-rw-r--r--tools/gnu/classpath/tools/doclets/TagletPrinter.java30
-rw-r--r--tools/gnu/classpath/tools/doclets/debugdoclet/.cvsignore4
-rw-r--r--tools/gnu/classpath/tools/doclets/debugdoclet/DebugDoclet.java137
-rw-r--r--tools/gnu/classpath/tools/doclets/htmldoclet/.cvsignore4
-rw-r--r--tools/gnu/classpath/tools/doclets/htmldoclet/CssClass.java283
-rw-r--r--tools/gnu/classpath/tools/doclets/htmldoclet/ExternalDocSet.java170
-rw-r--r--tools/gnu/classpath/tools/doclets/htmldoclet/HtmlDoclet.java3883
-rw-r--r--tools/gnu/classpath/tools/doclets/htmldoclet/HtmlPage.java518
-rw-r--r--tools/gnu/classpath/tools/doclets/htmldoclet/HtmlTagletContext.java48
-rw-r--r--tools/gnu/classpath/tools/doclets/xmldoclet/.cvsignore4
-rw-r--r--tools/gnu/classpath/tools/doclets/xmldoclet/Driver.java2434
-rw-r--r--tools/gnu/classpath/tools/doclets/xmldoclet/Driver1_4.java67
-rw-r--r--tools/gnu/classpath/tools/doclets/xmldoclet/HtmlRepairer.java674
-rw-r--r--tools/gnu/classpath/tools/doclets/xmldoclet/TargetContext.java86
-rw-r--r--tools/gnu/classpath/tools/doclets/xmldoclet/doctranslet/.cvsignore1
-rw-r--r--tools/gnu/classpath/tools/doclets/xmldoclet/doctranslet/DocTranslet.java443
-rw-r--r--tools/gnu/classpath/tools/doclets/xmldoclet/doctranslet/DocTransletConfigurationException.java36
-rw-r--r--tools/gnu/classpath/tools/doclets/xmldoclet/doctranslet/DocTransletException.java46
-rw-r--r--tools/gnu/classpath/tools/doclets/xmldoclet/doctranslet/DocTransletOptions.java45
-rw-r--r--tools/gnu/classpath/tools/doclets/xmldoclet/doctranslet/JarClassLoader.java74
-rw-r--r--tools/gnu/classpath/tools/doclets/xmldoclet/doctranslet/OutputFileInfo.java49
-rw-r--r--tools/gnu/classpath/tools/doclets/xmldoclet/doctranslet/package.html21
-rw-r--r--tools/gnu/classpath/tools/gjdoc/.cvsignore4
-rw-r--r--tools/gnu/classpath/tools/gjdoc/AbstractTagImpl.java90
-rw-r--r--tools/gnu/classpath/tools/gjdoc/ArrayCharacterIterator.java104
-rw-r--r--tools/gnu/classpath/tools/gjdoc/ClassDocImpl.java1244
-rw-r--r--tools/gnu/classpath/tools/gjdoc/ClassDocProxy.java152
-rw-r--r--tools/gnu/classpath/tools/gjdoc/ClassDocReflectedImpl.java202
-rw-r--r--tools/gnu/classpath/tools/gjdoc/ConstructorDocImpl.java42
-rw-r--r--tools/gnu/classpath/tools/gjdoc/Debug.java50
-rw-r--r--tools/gnu/classpath/tools/gjdoc/DirectoryTree.java57
-rw-r--r--tools/gnu/classpath/tools/gjdoc/DocImpl.java1074
-rw-r--r--tools/gnu/classpath/tools/gjdoc/ErrorReporter.java104
-rw-r--r--tools/gnu/classpath/tools/gjdoc/ExecutableMemberDocImpl.java411
-rw-r--r--tools/gnu/classpath/tools/gjdoc/FieldDocImpl.java392
-rw-r--r--tools/gnu/classpath/tools/gjdoc/GjdocPackageDoc.java39
-rw-r--r--tools/gnu/classpath/tools/gjdoc/GjdocRootDoc.java39
-rw-r--r--tools/gnu/classpath/tools/gjdoc/InheritDocTagImpl.java86
-rw-r--r--tools/gnu/classpath/tools/gjdoc/JavadocWrapper.java36
-rw-r--r--tools/gnu/classpath/tools/gjdoc/LinkTagImpl.java46
-rw-r--r--tools/gnu/classpath/tools/gjdoc/Main.java1846
-rw-r--r--tools/gnu/classpath/tools/gjdoc/MemberDocImpl.java218
-rw-r--r--tools/gnu/classpath/tools/gjdoc/MethodDocImpl.java47
-rw-r--r--tools/gnu/classpath/tools/gjdoc/PackageDocImpl.java206
-rw-r--r--tools/gnu/classpath/tools/gjdoc/ParamTagImpl.java64
-rw-r--r--tools/gnu/classpath/tools/gjdoc/ParameterImpl.java52
-rw-r--r--tools/gnu/classpath/tools/gjdoc/ParseException.java35
-rw-r--r--tools/gnu/classpath/tools/gjdoc/Parser.java1047
-rw-r--r--tools/gnu/classpath/tools/gjdoc/ProgramElementDocImpl.java161
-rw-r--r--tools/gnu/classpath/tools/gjdoc/RootDocImpl.java1317
-rw-r--r--tools/gnu/classpath/tools/gjdoc/SeeTagImpl.java198
-rw-r--r--tools/gnu/classpath/tools/gjdoc/SerialFieldTagImpl.java111
-rw-r--r--tools/gnu/classpath/tools/gjdoc/SourcePositionImpl.java60
-rw-r--r--tools/gnu/classpath/tools/gjdoc/TagContainer.java35
-rw-r--r--tools/gnu/classpath/tools/gjdoc/TagImpl.java43
-rw-r--r--tools/gnu/classpath/tools/gjdoc/TemporaryStore.java115
-rw-r--r--tools/gnu/classpath/tools/gjdoc/TextTagImpl.java39
-rw-r--r--tools/gnu/classpath/tools/gjdoc/ThrowsTagImpl.java88
-rw-r--r--tools/gnu/classpath/tools/gjdoc/Timer.java71
-rw-r--r--tools/gnu/classpath/tools/gjdoc/TimerDoclet.java87
-rw-r--r--tools/gnu/classpath/tools/gjdoc/TypeImpl.java92
-rw-r--r--tools/gnu/classpath/tools/gjdoc/TypeVariableImpl.java91
-rw-r--r--tools/gnu/classpath/tools/gjdoc/ValueTagImpl.java48
-rw-r--r--tools/gnu/classpath/tools/gjdoc/WritableType.java27
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/.cvsignore8
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/AdditionExpression.java69
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/AndExpression.java40
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/BinaryBitwiseExpression.java51
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/BinaryComputationExpression.java75
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/BinaryEqualityExpression.java72
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/BinaryExpression.java34
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/BinaryLogicalExpression.java47
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/BinaryRelationExpression.java65
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/BinaryShiftExpression.java49
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/BitShiftRightExpression.java40
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/CircularExpressionException.java35
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/ConditionalExpression.java57
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/ConstantBoolean.java67
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/ConstantByte.java57
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/ConstantChar.java81
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/ConstantDouble.java62
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/ConstantExpression.java35
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/ConstantFloat.java62
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/ConstantInteger.java62
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/ConstantLong.java67
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/ConstantNull.java49
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/ConstantShort.java57
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/ConstantString.java58
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/Context.java45
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/DivisionExpression.java50
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/EqualExpression.java55
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/Evaluator.java131
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/EvaluatorEnvironment.java29
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/ExclusiveOrExpression.java40
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/Expression.java27
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/GreaterThanExpression.java50
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/GreaterThanOrEqualExpression.java50
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/IdentifierExpression.java72
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/IllegalExpressionException.java35
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/InclusiveOrExpression.java40
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/LessThanExpression.java50
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/LessThanOrEqualExpression.java50
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/LogicalAndExpression.java35
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/LogicalNotExpression.java43
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/LogicalOrExpression.java35
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/ModuloExpression.java50
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/MultiplicationExpression.java50
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/NegateExpression.java49
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/NotEqualExpression.java55
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/NotExpression.java43
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/ShiftLeftExpression.java40
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/ShiftRightExpression.java40
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/SubtractionExpression.java50
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/Type.java43
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/TypeCastExpression.java70
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/UnaryExpression.java32
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/UnknownIdentifierException.java30
-rw-r--r--tools/gnu/classpath/tools/gjdoc/expr/java-expression.g471
-rw-r--r--tools/gnu/classpath/tools/java2xhtml/.cvsignore4
-rw-r--r--tools/gnu/classpath/tools/java2xhtml/Java2xhtml.java1337
-rw-r--r--tools/gnu/classpath/tools/taglets/.cvsignore4
-rw-r--r--tools/gnu/classpath/tools/taglets/AuthorTaglet.java276
-rw-r--r--tools/gnu/classpath/tools/taglets/CodeTaglet.java84
-rw-r--r--tools/gnu/classpath/tools/taglets/CopyrightTaglet.java106
-rw-r--r--tools/gnu/classpath/tools/taglets/DeprecatedTaglet.java115
-rw-r--r--tools/gnu/classpath/tools/taglets/GenericTaglet.java140
-rw-r--r--tools/gnu/classpath/tools/taglets/GnuExtendedTaglet.java31
-rw-r--r--tools/gnu/classpath/tools/taglets/SinceTaglet.java144
-rw-r--r--tools/gnu/classpath/tools/taglets/TagletContext.java23
-rw-r--r--tools/gnu/classpath/tools/taglets/ValueTaglet.java113
-rw-r--r--tools/gnu/classpath/tools/taglets/VersionTaglet.java136
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/doctranslets/gjdoc_common.xsl54
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/about.xsl83
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/allclasses.xsl63
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/allpackages.xsl78
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/alphaindex.xsl107
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/alphaindex_chunked.xsl112
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/classdoc-source.xsl61
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/classdoc-uses.xsl169
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/classdoc.xsl1070
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/deprecated.xsl261
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/descriptor.xsl58
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/doctranslet.xsl115
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/fulltree.xsl201
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/gjdoc.xsl240
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/help.xsl93
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/html_common.xsl584
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/index.xsl66
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/index_noframes.xsl146
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/packageclasses.xsl90
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/packagedoc.xsl153
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/res/default_help_en.html7
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/res/gjdoc.js108
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/res/gjdochtml-clean.css382
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/res/gjdochtml-fixed.css286
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/res/gjdochtml-sclara.css266
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/res/gjdochtml.css29
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/serialized.xsl77
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/dtd/dbcentx.mod204
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-amsa.ent98
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-amsb.ent84
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-amsc.ent52
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-amsn.ent101
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-amso.ent68
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-amsr.ent126
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-box.ent82
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-cyr1.ent109
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-cyr2.ent68
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-dia.ent56
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-grk1.ent91
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-grk2.ent62
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-grk3.ent85
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-grk4.ent85
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-lat1.ent104
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-lat2.ent163
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-num.ent118
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-pub.ent127
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-tech.ent104
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/dtd/gjdoc-alphaindex.dtd35
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/dtd/gjdoc.dtd35
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/htmldoclet/HtmlDoclet.properties32
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/htmldoclet/gjdoc.js115
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/htmldoclet/gjdochtml-clean-color1.css80
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/htmldoclet/gjdochtml-clean-layout.css460
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/htmldoclet/gjdochtml-vanilla.css21
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/htmldoclet/help.xhtml25
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/htmldoclet/xhtml11-target10.dtd54
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/java.lang-classes-1.2.txt78
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/java.lang-classes-1.3.txt79
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/java.lang-classes-1.4.txt82
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/java.lang-classes-1.5.txt90
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/rng/gjdoc-classdoc.rng649
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/rng/gjdoc-common.rng264
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/rng/gjdoc-index.rng176
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/version.properties1
-rw-r--r--tools/resource/gnu/classpath/tools/gjdoc/version.properties.in1
219 files changed, 37604 insertions, 7 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 12c823b62..d2b097bd2 100755
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -6,11 +6,13 @@ GLIBJ_CLASSPATH=asm
# Setup the compiler to use the GNU Classpath library we just built.
JCOMPILER = $(JAVAC) $(JAVACFLAGS) -source 1.5 -target 1.5 -encoding UTF-8 -bootclasspath $(GLIBJ_BOOTCLASSPATH) -classpath $(GLIBJ_CLASSPATH)
+USE_JAVAC_FLAGS = -classpath $(CLASSPATH):$(srcdir):$(ANTLR_JAR):$(srcdir)/generated:. $(JAVAC_FLAGS)
+
if CREATE_WRAPPERS
bin_SCRIPTS =
bin_PROGRAMS = gappletviewer gjarsigner gkeytool \
gjar gnative2ascii gserialver gjavah grmiregistry \
- gtnameserv gorbd grmid grmic
+ gtnameserv gorbd grmid grmic gjdoc
AM_CPPFLAGS = -Wall \
@@ -80,10 +82,15 @@ grmic_CFLAGS = \
-DTOOLPACKAGE="\"rmic\"" \
-DTOOLNAME="\"grmic\""
+gjdoc_SOURCES = toolwrapper.c
+gjdoc_CFLAGS = \
+ -DTOOLPACKAGE="\"gjdoc\"" \
+ -DTOOLNAME="\"gjdoc\""
+
else
bin_SCRIPTS = gappletviewer gjarsigner gkeytool \
gjar gnative2ascii gserialver gjavah grmiregistry \
- gtnameserv gorbd grmid grmic
+ gtnameserv gorbd grmid grmic gjdoc
bin_PROGRAMS =
## FIXME: revisit this with a newer automake.
gappletviewer: gappletviewer.in
@@ -98,6 +105,7 @@ gtnameserv: gtnameserv.in
gorbd: gorbd.in
grmid: grmid.in
grmic: grmic.in
+gjdoc: gjdoc.in
endif
EXTRA_DIST = toolwrapper.c gappletviewer.in gjarsigner.in gkeytool.in \
gjar.in gnative2ascii.in gserialver.in gjavah.in grmiregistry.in \
@@ -105,10 +113,13 @@ EXTRA_DIST = toolwrapper.c gappletviewer.in gjarsigner.in gkeytool.in \
# All our example java source files
TOOLS_JAVA_FILES = $(srcdir)/gnu/classpath/tools/*/*.java \
+ $(srcdir)/gnu/classpath/tools/*/*/*.java \
+ $(srcdir)/gnu/classpath/tools/*/*/*/*.java \
$(srcdir)/com/sun/javadoc/*.java \
$(srcdir)/com/sun/tools/doclets/*.java \
$(srcdir)/com/sun/tools/javac/*.java \
$(srcdir)/com/sun/tools/javah/*.java \
+ $(srcdir)/com/sun/tools/javadoc/*.java \
$(srcdir)/sun/rmi/rmic/*.java \
$(srcdir)/external/asm/org/objectweb/asm/*.java \
$(srcdir)/external/asm/org/objectweb/asm/attrs/*.java \
@@ -142,6 +153,98 @@ PROPERTY_FILES = $(srcdir)/external/asm/org/objectweb/asm/optimizer/shrink.prope
# RMIC templates that must be included in the generated zip file.
RMIC_TEMPLATES = $(srcdir)/resource/gnu/classpath/tools/rmic/templates/*.jav
+# gjdoc resource files.
+gnu_classpath_tools_gjdoc_jar_CSS = \
+ doctranslets/html/res/gjdochtml-clean.css \
+ doctranslets/html/res/gjdochtml-fixed.css \
+ doctranslets/html/res/gjdochtml-sclara.css \
+ doctranslets/html/res/gjdochtml.css \
+ htmldoclet/gjdochtml-vanilla.css \
+ htmldoclet/gjdochtml-clean-layout.css \
+ htmldoclet/gjdochtml-clean-color1.css
+
+gnu_classpath_tools_gjdoc_jar_DTDS = \
+ htmldoclet/xhtml11-target10.dtd \
+ dtd/gjdoc-alphaindex.dtd \
+ dtd/gjdoc.dtd
+
+gnu_classpath_tools_gjdoc_jar_ENTS = \
+ dtd/ent/iso-amsa.ent \
+ dtd/ent/iso-amsb.ent \
+ dtd/ent/iso-amsc.ent \
+ dtd/ent/iso-amsn.ent \
+ dtd/ent/iso-amso.ent \
+ dtd/ent/iso-amsr.ent \
+ dtd/ent/iso-box.ent \
+ dtd/ent/iso-cyr1.ent \
+ dtd/ent/iso-cyr2.ent \
+ dtd/ent/iso-dia.ent \
+ dtd/ent/iso-grk1.ent \
+ dtd/ent/iso-grk2.ent \
+ dtd/ent/iso-grk3.ent \
+ dtd/ent/iso-grk4.ent \
+ dtd/ent/iso-lat1.ent \
+ dtd/ent/iso-lat2.ent \
+ dtd/ent/iso-num.ent \
+ dtd/ent/iso-pub.ent \
+ dtd/ent/iso-tech.ent
+
+gnu_classpath_tools_gjdoc_jar_HTML = doctranslets/html/res/default_help_en.html
+
+gnu_classpath_tools_gjdoc_jar_JS = \
+ doctranslets/html/res/gjdoc.js \
+ htmldoclet/gjdoc.js
+
+gnu_classpath_tools_gjdoc_jar_PNG = \
+ htmldoclet/inherit.png
+
+gnu_classpath_tools_gjdoc_jar_MODS = dtd/dbcentx.mod
+
+gnu_classpath_tools_gjdoc_jar_PROPERTIES = htmldoclet/HtmlDoclet.properties
+
+gnu_classpath_tools_gjdoc_jar_RNGS = \
+ rng/gjdoc-classdoc.rng \
+ rng/gjdoc-common.rng \
+ rng/gjdoc-index.rng
+
+gnu_classpath_tools_gjdoc_jar_TXTS = \
+ java.lang-classes-1.2.txt \
+ java.lang-classes-1.3.txt \
+ java.lang-classes-1.4.txt \
+ java.lang-classes-1.5.txt
+
+gnu_classpath_tools_gjdoc_jar_XHTML = htmldoclet/help.xhtml
+
+gnu_classpath_tools_gjdoc_jar_XSLS = \
+ doctranslets/gjdoc_common.xsl \
+ doctranslets/html/about.xsl \
+ doctranslets/html/allclasses.xsl \
+ doctranslets/html/allpackages.xsl \
+ doctranslets/html/alphaindex.xsl \
+ doctranslets/html/alphaindex_chunked.xsl \
+ doctranslets/html/classdoc-source.xsl \
+ doctranslets/html/classdoc-uses.xsl \
+ doctranslets/html/classdoc.xsl \
+ doctranslets/html/deprecated.xsl \
+ doctranslets/html/descriptor.xsl \
+ doctranslets/html/doctranslet.xsl \
+ doctranslets/html/fulltree.xsl \
+ doctranslets/html/gjdoc.xsl \
+ doctranslets/html/help.xsl \
+ doctranslets/html/html_common.xsl \
+ doctranslets/html/index_noframes.xsl \
+ doctranslets/html/index.xsl \
+ doctranslets/html/packageclasses.xsl \
+ doctranslets/html/packagedoc.xsl
+
+# All our resources.
+gjdoc_resources = $(gnu_classpath_tools_gjdoc_jar_CSS) $(gnu_classpath_tools_gjdoc_jar_DTDS) \
+ $(gnu_classpath_tools_gjdoc_jar_ENTS) $(gnu_classpath_tools_gjdoc_jar_HTML) \
+ $(gnu_classpath_tools_gjdoc_jar_JS) $(gnu_classpath_tools_gjdoc_jar_MODS) \
+ $(gnu_classpath_tools_gjdoc_jar_PNG) $(gnu_classpath_tools_gjdoc_jar_PROPERTIES) \
+ $(gnu_classpath_tools_gjdoc_jar_RNGS) $(gnu_classpath_tools_gjdoc_jar_TXTS) \
+ $(gnu_classpath_tools_gjdoc_jar_XHTML) $(gnu_classpath_tools_gjdoc_jar_XSLS)
+
# The zip files with classes we want to produce.
TOOLS_ZIP = tools.zip
@@ -176,8 +279,11 @@ dist-hook:
# immediately. And copy the template files we use to the classes dir
# so they get also included.
$(TOOLS_ZIP): $(ALL_TOOLS_FILES)
- @rm -rf classes asm
- mkdir classes asm
+ @rm -rf classes asm generated
+ mkdir -p classes asm generated/gnu/classpath/tools/gjdoc/expr
+## Generate antlr sources.
+ $(ANTLR) -o $(srcdir)/generated/gnu/classpath/tools/gjdoc/expr \
+ $(srcdir)/gnu/classpath/tools/gjdoc/expr/java-expression.g
## Compile ASM separately as it is latin-1 encoded.
find $(srcdir)/external/asm -name '*.java' -print > asm.lst
AC=`echo $(JCOMPILER) | sed -e 's/UTF-8/ISO-8859-1/g'`; \
@@ -187,9 +293,10 @@ $(TOOLS_ZIP): $(ALL_TOOLS_FILES)
$(srcdir)/com/sun/tools/doclets \
$(srcdir)/com/sun/tools/javac \
$(srcdir)/com/sun/tools/javah \
+ $(srcdir)/com/sun/tools/javadoc \
$(srcdir)/sun/rmi/rmic \
-name '*.java' -print > classes.lst
- $(JCOMPILER) -g -d classes @classes.lst
+ $(JCOMPILER) $(USE_JAVAC_FLAGS) -g -d classes @classes.lst
cat classes.lst asm.lst > all-classes.lst
## Copy over tools resource files.
@list=`cd $(srcdir)/resource && find gnu/classpath/tools com/sun/tools/javac \
@@ -197,9 +304,16 @@ $(TOOLS_ZIP): $(ALL_TOOLS_FILES)
for p in $$list; do \
dirname=classes/`dirname $$p`; \
if ! test -d "$$dirname"; then mkdir -p "$$dirname"; fi; \
- echo " cp $(srcdir)resource/$$p classes/$$p"; \
+ echo " cp $(srcdir)/resource/$$p classes/$$p"; \
cp $(srcdir)/resource/$$p classes/$$p; \
done
+## Copy over gjdoc resource files.
+ for res in $(gjdoc_resources); do \
+ dir=classes/`dirname $$res`; \
+ if ! test -d "$$dir"; then mkdir -p "$$dir"; fi; \
+ echo " cp $(srcdir)/resource/gnu/classpath/tools/gjdoc/$$res classes/$$res"; \
+ cp $(srcdir)/resource/gnu/classpath/tools/gjdoc/$$res classes/$$res; \
+ done
## First add classpath tools stuff.
(cd classes; \
if test "$(ZIP)" != ""; then $(ZIP) -r ../$(TOOLS_ZIP) .; fi; \
@@ -214,7 +328,7 @@ $(TOOLS_ZIP): $(ALL_TOOLS_FILES)
# Zip file be gone! (and make sure the classes are gone too)
clean-local:
- rm -rf $(TOOLS_ZIP) classes classes.lst asm asm.lst all-classes.lst
+ rm -rf $(TOOLS_ZIP) classes classes.lst asm asm.lst all-classes.lst generated
# FIXME: remove this when GNU Classpath includes a bootstrap VM.
installcheck-binSCRIPTS:
diff --git a/tools/com/sun/tools/javadoc/Main.java b/tools/com/sun/tools/javadoc/Main.java
new file mode 100644
index 000000000..289303013
--- /dev/null
+++ b/tools/com/sun/tools/javadoc/Main.java
@@ -0,0 +1,9 @@
+package com.sun.tools.javadoc;
+
+public class Main
+{
+ public static void main(String[] args)
+ {
+ gnu.classpath.tools.gjdoc.Main.main(args);
+ }
+}
diff --git a/tools/gjdoc.in b/tools/gjdoc.in
new file mode 100644
index 000000000..f49d01be3
--- /dev/null
+++ b/tools/gjdoc.in
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+## Copyright (C) 2006 Free Software Foundation, Inc.
+##
+## This file is a part of GNU Classpath.
+##
+## GNU Classpath is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or (at
+## your option) any later version.
+##
+## GNU Classpath is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with GNU Classpath; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+## USA.
+##
+## Linking this library statically or dynamically with other modules is
+## making a combined work based on this library. Thus, the terms and
+## conditions of the GNU General Public License cover the whole
+## combination.
+##
+## As a special exception, the copyright holders of this library give you
+## permission to link this library with independent modules to produce an
+## executable, regardless of the license terms of these independent
+## modules, and to copy and distribute the resulting executable under
+## terms of your choice, provided that you also meet, for each linked
+## independent module, the terms and conditions of the license of that
+## module. An independent module is a module which is not derived from
+## or based on this library. If you modify this library, you may extend
+## this exception to your version of the library, but you are not
+## obligated to do so. If you do not wish to do so, delete this
+## exception statement from your version.
+##
+##
+## A simple shell script to launch the GNU Classpath javadoc tool.
+##
+
+prefix=@prefix@
+datarootdir=@datarootdir@
+tools_dir=@datadir@/@PACKAGE@
+tools_cp=${tools_dir}/tools.zip
+antlr_jar=@ANTLR_JAR@
+
+exec @VM_BINARY@ -Xbootclasspath/p:"${tools_cp}:${antlr_jar}" gnu.classpath.tools.gjdoc.Main "$@"
diff --git a/tools/gnu/classpath/tools/FileSystemClassLoader.java b/tools/gnu/classpath/tools/FileSystemClassLoader.java
new file mode 100644
index 000000000..0ec243d56
--- /dev/null
+++ b/tools/gnu/classpath/tools/FileSystemClassLoader.java
@@ -0,0 +1,296 @@
+/* gnu.classpath.tools.FileSystemClassLoader
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.StreamTokenizer;
+import java.io.StringReader;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.StringTokenizer;
+
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.jar.Manifest;
+import java.util.jar.Attributes;
+
+/**
+ * A <code>ClassLoader</code> implementation which looks for classes
+ * on the local filesystem given a standard search path.
+ */
+public class FileSystemClassLoader extends ClassLoader {
+
+ private File[] pathComponents;
+
+ /**
+ * Initialize the class loader with a normal path string. The path
+ * string should contain path components separated by {@link
+ * File.pathSeparator}. Each path component should either denote a
+ * directory or a .jar or .zip file.
+ */
+ public FileSystemClassLoader(String path)
+ {
+ List components = new ArrayList();
+ for (StringTokenizer st = new StringTokenizer(path, File.pathSeparator); st.hasMoreTokens(); ) {
+ File pathComponent = new File(st.nextToken());
+ components.add(pathComponent);
+ if (pathComponent.exists() && !pathComponent.isDirectory()) {
+ List subComponents = tryGetJarFileClassPathComponents(pathComponent);
+ if (null != subComponents) {
+ components.addAll(subComponents);
+ }
+ }
+ }
+ File[] componentArray = new File[components.size()];
+ this.pathComponents = (File[])components.toArray(componentArray);
+ }
+
+ /**
+ * Initialize the class loader with an array of path
+ * components. Each path component should either denote a
+ * directory or a .jar or .zip file.
+ */
+ public FileSystemClassLoader(File[] pathComponents)
+ {
+ this.pathComponents = pathComponents;
+ for (int i = 0; i < pathComponents.length; ++i) {
+ if (!pathComponents[i].exists()) {
+ System.err.println("WARNING: Path component '" + pathComponents[i] + "' not found.");
+ }
+ }
+ }
+
+ public Class loadClass(String name)
+ throws ClassNotFoundException {
+
+ return super.loadClass(name);
+ }
+
+ public Class findClass(String name)
+ throws ClassNotFoundException {
+
+ byte[] b = loadClassData(name);
+ return defineClass(name, b, 0, b.length);
+ }
+
+ public URL findResource(String name)
+ {
+ StreamInfo streamInfo = getResourceStream(name);
+ if (null == streamInfo) {
+ return super.findResource(name);
+ }
+ else {
+ try {
+ return streamInfo.getURL();
+ }
+ catch (MalformedURLException e) {
+ System.err.println("WARNING: In FileSystemClassLoader: could not derive URL from file or jar entry: " + e.toString());
+ return null;
+ }
+ }
+ }
+
+ private byte[] readFromStream(InputStream in, long size)
+ throws IOException
+ {
+ byte[] result = new byte[(int)size];
+ int nread = 0;
+ int offset = 0;
+ while (offset < size && (nread = in.read(result, offset, (int)(size - offset))) >= 0) {
+ offset += nread;
+ }
+ in.close();
+ return result;
+ }
+
+ private byte[] readFromStream(StreamInfo streamInfo)
+ throws IOException
+ {
+ InputStream in = streamInfo.openStream();
+ long size = streamInfo.getSize();
+
+ byte[] result = new byte[(int)size];
+ int nread = 0;
+ int offset = 0;
+ while (offset < size && (nread = in.read(result, offset, (int)(size - offset))) >= 0) {
+ offset += nread;
+ }
+ in.close();
+ return result;
+ }
+
+ private static interface StreamInfo
+ {
+ public InputStream openStream()
+ throws IOException;
+ public long getSize();
+ public URL getURL()
+ throws MalformedURLException;
+ }
+
+ private static class FileStreamInfo
+ implements StreamInfo
+ {
+ File file;
+
+ FileStreamInfo(File file)
+ {
+ this.file = file;
+ }
+
+ public InputStream openStream()
+ throws IOException
+ {
+ return new FileInputStream(file);
+ }
+
+ public long getSize()
+ {
+ return file.length();
+ }
+
+ public URL getURL()
+ throws MalformedURLException
+ {
+ return file.toURL();
+ }
+ }
+
+ private static class JarStreamInfo
+ implements StreamInfo
+ {
+ private File file;
+ private JarFile jarFile;
+ private JarEntry jarEntry;
+
+ JarStreamInfo(File file, JarFile jarFile, JarEntry jarEntry)
+ {
+ this.file = file;
+ this.jarFile = jarFile;
+ this.jarEntry = jarEntry;
+ }
+
+ public InputStream openStream()
+ throws IOException
+ {
+ return jarFile.getInputStream(jarEntry);
+ }
+
+ public long getSize()
+ {
+ return jarEntry.getSize();
+ }
+
+ public URL getURL()
+ throws MalformedURLException
+ {
+ String urlString = "jar:" + file.toURL() + "!/" + jarEntry.getName();
+ return new URL(urlString);
+ }
+ }
+
+ private StreamInfo getResourceStream(String path)
+ {
+ for (int i = 0; i < pathComponents.length; ++i) {
+ try {
+ File parent = pathComponents[i];
+ if (parent.isDirectory()) {
+ File file = new File(parent, path);
+ if (file.exists()) {
+ return new FileStreamInfo(file);
+ }
+ }
+ else {
+ JarFile jarFile = new JarFile(parent, false, JarFile.OPEN_READ);
+ JarEntry jarEntry = jarFile.getJarEntry(path);
+ if (null != jarEntry) {
+ return new JarStreamInfo(parent, jarFile, jarEntry);
+ }
+ }
+ }
+ catch (IOException ignore) {
+ }
+ }
+ return null;
+ }
+
+ private byte[] loadClassData(String className)
+ throws ClassNotFoundException
+ {
+ String classFileName = className.replace('.', File.separatorChar) + ".class";
+ StreamInfo streamInfo = getResourceStream(classFileName);
+
+ try {
+ if (null != streamInfo) {
+ return readFromStream(streamInfo);
+ }
+ }
+ catch (IOException ignore) {
+ }
+
+ throw new ClassNotFoundException(className);
+ }
+
+ private static List tryGetJarFileClassPathComponents(File file)
+ {
+ try {
+ JarFile jarFile = new JarFile(file, false, JarFile.OPEN_READ);
+ Manifest manifest = jarFile.getManifest();
+ if (null != manifest) {
+ Attributes mainAttributes = manifest.getMainAttributes();
+ if (null != mainAttributes) {
+ String classPath = mainAttributes.getValue(Attributes.Name.CLASS_PATH);
+ if (null != classPath) {
+ List result = new LinkedList();
+ StreamTokenizer tokenizer = new StreamTokenizer(new StringReader(classPath));
+ tokenizer.resetSyntax();
+ tokenizer.wordChars(0, Integer.MAX_VALUE);
+ tokenizer.whitespaceChars(9, 9); // tab
+ tokenizer.whitespaceChars(10, 10); // lf
+ tokenizer.whitespaceChars(13, 13); // cr
+ tokenizer.whitespaceChars(32, 32); // space
+ tokenizer.quoteChar('"');
+ int token;
+ while ((token = tokenizer.nextToken()) != StreamTokenizer.TT_EOF) {
+ if (StreamTokenizer.TT_WORD == token) {
+ result.add(new File(file.getParentFile(), tokenizer.sval));
+ }
+ }
+ return result;
+ }
+ }
+ }
+ }
+ catch (IOException ignore) {
+ }
+ return null;
+ }
+}
+
diff --git a/tools/gnu/classpath/tools/IOToolkit.java b/tools/gnu/classpath/tools/IOToolkit.java
new file mode 100644
index 000000000..4e222d267
--- /dev/null
+++ b/tools/gnu/classpath/tools/IOToolkit.java
@@ -0,0 +1,199 @@
+/* gnu.classpath.tools.IOToolkit
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.StringWriter;
+import java.io.Writer;
+
+import java.util.Set;
+
+/**
+ * Provides various I/O-related helper methods.
+ *
+ * @author Julian Scheid
+ */
+public class IOToolkit
+{
+ /**
+ * Prevents instantiation.
+ */
+ private IOToolkit() {}
+
+ /**
+ * Read all binary data from the given InputStream and write it to
+ * the given OutputStream. This method doesn't close either
+ * stream.
+ *
+ * @param in the stream from which to read data
+ * @param out the stream to which to write data
+ */
+ public static void copyStream(InputStream in, OutputStream out)
+ throws IOException
+ {
+ byte[] buf = new byte[256];
+ int nread;
+
+ while ((nread = in.read(buf)) >= 0) {
+ out.write(buf, 0, nread);
+ }
+ }
+
+ /**
+ * Read all character data from the given Reader and write it to
+ * the given Writer. This method doesn't close either stream.
+ *
+ * @param in the Reader from which to read character data
+ * @param out the Writer to which to write character data
+ */
+ public static void copyStream(Reader in, Writer out)
+ throws IOException
+ {
+ char[] buf = new char[256];
+ int nread;
+
+ while ((nread = in.read(buf)) >= 0) {
+ out.write(buf, 0, nread);
+ }
+ }
+
+ /**
+ * Recursively copy the contents of the input directory to the
+ * output directory. The output directory is created if it doesn't
+ * exist. If the output directory doesn't exist and can't be
+ * created, an IOException is thrown.
+ *
+ * @param sourceDir source directory from which to copy files
+ * @param targetDir target directory to which to copy files
+ * @param recursive if true, recursively copy subdirectoryies
+ * @param excludeDirs if non null, must be a Set of String. Each
+ * element from the set specifies the name of a direct
+ * subdirectory of the source directory which should be excluded
+ * from recursive copying.
+ */
+ public static void copyDirectory(File sourceDir, File targetDir,
+ boolean recursive,
+ Set excludeDirs)
+ throws IOException
+ {
+ if (!targetDir.exists() && !targetDir.mkdirs()) {
+ throw new IOException("Cannot create directory " + targetDir);
+ }
+
+ File[] sourceFiles = sourceDir.listFiles();
+ for (int i=0; i<sourceFiles.length; ++i) {
+ if (sourceFiles[i].isDirectory()) {
+ if (recursive && (null == excludeDirs
+ || !excludeDirs.contains(sourceFiles[i].getName()))) {
+ File targetSubDir = new File(targetDir,
+ sourceFiles[i].getName());
+ if (targetSubDir.exists() || targetSubDir.mkdir()) {
+ copyDirectory(sourceFiles[i], targetSubDir, recursive, null);
+ }
+ else {
+ throw new IOException("Cannot create directory " + targetSubDir);
+ }
+ }
+ }
+ else {
+ copyFile(sourceFiles[i], new File(targetDir, sourceFiles[i].getName()));
+ }
+ }
+ }
+
+ /**
+ * Copy the contents of the input file to the output file. The
+ * output file's parent directory must exist.
+ *
+ * @param sourceFile specifies the file to copy
+ * @param targetFile specifies the file to create
+ */
+ public static void copyFile(File sourceFile, File targetFile)
+ throws IOException
+ {
+ InputStream in = new FileInputStream(sourceFile);
+ OutputStream out = new FileOutputStream(targetFile);
+ int nread;
+ byte[] buf = new byte[512];
+ while ((nread = in.read(buf)) >= 0) {
+ out.write(buf, 0, nread);
+ }
+ in.close();
+ out.close();
+ }
+
+ /**
+ * Read the (remaining) contents of the given reader into a char
+ * array. This method doesn't close the reader when it is done.
+ *
+ * @param reader the Reader to read characters from
+ * @return an array with the contents of the Reader
+ */
+ public static char[] readFully(Reader reader)
+ throws IOException
+ {
+ StringWriter writer = new StringWriter();
+ final int readBufferSize = 256;
+ char[] chunk = new char[readBufferSize];
+ int nread;
+ while ((nread=reader.read(chunk))>=0) {
+ writer.write(chunk,0,nread);
+ }
+ StringBuffer buffer = writer.getBuffer();
+ char[] result = new char[buffer.length()];
+ buffer.getChars(0, buffer.length(), result, 0);
+ return result;
+ }
+
+ public static String getLineFromFile(File file, int line)
+ throws IOException
+ {
+ FileReader reader = new FileReader(file);
+ BufferedReader bufferedReader = new BufferedReader(reader);
+ while (line > 1) {
+ bufferedReader.readLine();
+ -- line;
+ }
+ String result = bufferedReader.readLine();
+ reader.close();
+ return result;
+ }
+
+ public static String getColumnDisplayLine(int column)
+ {
+ StringBuffer result = new StringBuffer();
+ while (column > 0) {
+ result.append(' ');
+ --column;
+ }
+ result.append('^');
+ return result.toString();
+ }
+
+}
diff --git a/tools/gnu/classpath/tools/MalformedInputEvent.java b/tools/gnu/classpath/tools/MalformedInputEvent.java
new file mode 100644
index 000000000..b2ac3ce6c
--- /dev/null
+++ b/tools/gnu/classpath/tools/MalformedInputEvent.java
@@ -0,0 +1,93 @@
+/* gnu.classpath.tools.MalformedInputEvent
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools;
+
+import java.util.EventObject;
+
+/**
+ * Encapsulates information about malformed input encountered by a
+ * {@link NotifyingInputStreamReader}.
+ *
+ * You can use {@link getSource()} to fetch a reference to the
+ * <code>NotifyingInputStreamReader</code> which encountered the
+ * malformed input.
+ *
+ * @author Julian Scheid
+ */
+public class MalformedInputEvent
+ extends EventObject
+{
+ private int lineNumber;
+ private int columnNumber;
+ private int length;
+
+ MalformedInputEvent(NotifyingInputStreamReader source,
+ int lineNumber,
+ int columnNumber,
+ int length)
+ {
+ super(source);
+ this.columnNumber = columnNumber;
+ this.lineNumber = lineNumber;
+ this.length = length;
+ }
+
+ /**
+ * Return the 1-based line number where the malformed input begins
+ * in the stream read by the
+ * <code>NotifyingInputStreamReader</code>.
+ */
+ public int getLineNumber()
+ {
+ return lineNumber;
+ }
+
+ /**
+ * Return the 0-based column number where the malformed input
+ * begins in the stream read by the
+ * <code>NotifyingInputStreamReader</code>.
+ */
+ public int getColumnNumber()
+ {
+ return columnNumber;
+ }
+
+ /**
+ * Return the length (in bytes) of the malformed input encountered
+ * by the <code>NotifyingInputStreamReader</code>. Note that a
+ * consecutive run of malformed input isn't necessarily reported
+ * as a whole; depending on the <code>Charset</code> and
+ * implementation details of <code>CharsetDecoder</code>, the run
+ * could be reported in chunks down to individual bytes.
+ */
+ public int getLength()
+ {
+ return length;
+ }
+
+ public String toString()
+ {
+ return "MalformedInputEvent{line=" + lineNumber
+ + ",column=" + columnNumber
+ + ",length=" + length
+ + "}";
+ }
+}
diff --git a/tools/gnu/classpath/tools/MalformedInputListener.java b/tools/gnu/classpath/tools/MalformedInputListener.java
new file mode 100644
index 000000000..66ab12824
--- /dev/null
+++ b/tools/gnu/classpath/tools/MalformedInputListener.java
@@ -0,0 +1,39 @@
+/* gnu.classpath.tools.MalformedInputListener
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools;
+
+/**
+ * Classes implementing this interface can be notified when a {@link
+ * NotifyingInputStreamReader} encounters malformed input.
+ *
+ * @author Julian Scheid
+ */
+public interface MalformedInputListener
+{
+ /**
+ * Invoked when a <code>NotifyingInputStreamReader</code> this
+ * listener is registered with encounters malformed input.
+ *
+ * @param MalformedInputEvent contains detailed information about
+ * the event.
+ */
+ public void malformedInputEncountered(MalformedInputEvent event);
+}
diff --git a/tools/gnu/classpath/tools/NotifyingInputStreamReader.java b/tools/gnu/classpath/tools/NotifyingInputStreamReader.java
new file mode 100644
index 000000000..8c35c2573
--- /dev/null
+++ b/tools/gnu/classpath/tools/NotifyingInputStreamReader.java
@@ -0,0 +1,406 @@
+/* gnu.classpath.tools.NotifyingInputStreamReader
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CoderResult;
+import java.nio.charset.IllegalCharsetNameException;
+import java.nio.charset.UnsupportedCharsetException;
+
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+/**
+ * Similar to {@link java.io.InputStreamReader}, but can give
+ * notification when malformed input is encountered.
+ *
+ * <p> Users of this class can register interest in the event of
+ * malformed input by calling {@link
+ * #addMalformedInputListener}. Each time a run of malformed input
+ * data is encountered, all listener objects are notified. For
+ * instance, this allows the calling code to inform the user about
+ * problems in the input stream. </p>
+ *
+ * <p> <strong>Background:</strong> The default
+ * <code>InputStreamReader</code> implementation will ignore
+ * malformed input, silently replacing it with the default
+ * replacement string (usually the question mark). Alternatively, you
+ * can configure a <code>CharsetDecoder</code> for the default
+ * <char>InputStreamReader</code> implementation, instructing it to
+ * ignore malformed input without replacing it; to replace it with a
+ * different string; or to throw an exception when malformed input is
+ * encountered. However, you cannot configure an
+ * <code>InputStreamReader</code> to gracefully handle malformed data
+ * but notify the client code about such
+ * problems. <code>NotifyingInputStreamReader</code> fills this
+ * gap. </p>
+ *
+ * @author Julian Scheid
+ */
+public class NotifyingInputStreamReader
+ extends Reader
+{
+ /**
+ * The default size (in bytes) for byteBuf, i.e. the size of data
+ * chunks read from the underlying input stream.
+ */
+ private static final int DEFAULT_INPUT_BUFFER_SIZE = 64;
+
+ /**
+ * The default size (in chars) for charBuf. This should be large
+ * enough to hold a decoded chunk of input data for the Charset
+ * with the minimum number of bytes per character. Since the
+ * minimum number of bytes per character for usual Charsets is
+ * one, this number should be identical to
+ * DEFAULT_INPUT_BUFFER_SIZE.
+ */
+ private static final int DEFAULT_OUTPUT_BUFFER_SIZE = 64;
+
+ /**
+ * The underlying InputStream.
+ */
+ private InputStream in;
+
+ /**
+ * The CharsetDecoder used to decode the underlying stream.
+ */
+ private CharsetDecoder decoder;
+
+ /**
+ * Holds bytes already read from the underlying stream, but not
+ * yet decoded.
+ */
+ private ByteBuffer byteBuffer;
+
+ /**
+ * Holds characters already decoded, but not yet fetched via
+ * read().
+ */
+ private CharBuffer charBuffer;
+
+ /**
+ * This is the primitive byte array wrapped in byteBuffer for
+ * passing to to InputStream.read().
+ */
+ private byte[] readBuffer;
+
+ /**
+ * Keeps track of the current line number (1-based).
+ */
+ private int lineNumber = 1;
+
+ /**
+ * Keeps track of the current column number (0-based).
+ */
+ private int columnNumber = 0;
+
+ /**
+ * Becomes true as soon as EOF has been reached in the underlying
+ * InputStream. At this point, byteBuffer contains the last chunk
+ * of data from the underlying InputStream.
+ */
+ private boolean allInputConsumed = false;
+
+ /**
+ * Becomes true as soon as the decoder has been supplied with the
+ * last chunk of data from the InputStream after EOF has been
+ * reached. At this point, the last chunk of data has been drained
+ * from the byteBuffer.
+ */
+ private boolean decodingFinished = false;
+
+ /**
+ * Becomes true as soon as the decoder has been flushed. At this
+ * point, the last chunk of character data has been written to the
+ * charBuffer.
+ */
+ private boolean flushed = false;
+
+ /**
+ * Stores all registered MalformedInputListeners.
+ */
+ private Set listeners = new LinkedHashSet();
+
+ /**
+ * Initializes a new instance for reading from the given
+ * InputStream using the default encoding. The default encoding is
+ * currently determined by looking at the system property
+ * <code>file.encoding</code>. If this property isn't set,
+ * <code>ISO-8859-1</code> is used as a fallback.
+ *
+ * <p>This method should use {@link Charset.defaultCharset()}
+ * instead, but this isn't implemented in Classpath at the
+ * moment.</p>
+ *
+ * @param in the <code>InputStream</code> to read from.
+ */
+ public NotifyingInputStreamReader(InputStream in)
+ {
+ this(in, System.getProperty("file.encoding", "ISO-8859-1"));
+ }
+
+ /**
+ * Initializes a new instance for reading from the given
+ * InputStream using the specified charset.
+ *
+ * @param in the <code>InputStream</code> to read from.
+ * @param charsetName the canonical name or an alias of a
+ * <code>Charset</code>.
+ *
+ * @throws IllegalCharsetNameException if there is no
+ * <code>Charset</code> with the given canonical name or alias.
+ *
+ * @throws UnsupportedCharsetException if there is no support for
+ * the specified <code>Charset</code> in the runtime environment.
+ */
+ public NotifyingInputStreamReader(InputStream in, String charsetName)
+ throws IllegalCharsetNameException, UnsupportedCharsetException
+ {
+ this(in, Charset.forName(charsetName));
+ }
+
+ /**
+ * Initializes a new instance for reading from the given
+ * InputStream using the specified charset.
+ *
+ * @param in the <code>InputStream</code> to read from.
+ * @param charset the <code>Charset</code> to use for decoding
+ * characters.
+ */
+ public NotifyingInputStreamReader(InputStream in, Charset charset)
+ {
+ this(in, charset.newDecoder());
+ }
+
+ /**
+ * Initializes a new instance for reading from the given
+ * InputStream using the specified charset decoder.
+ *
+ * <strong>Note:</strong> the
+ * <code>NotifyingInputStreamReader</code> will not exhibit the
+ * advertised behaviour if you changed the action to take on
+ * malformed input in the specified
+ * <code>CharsetDecoder</code>. In other words, you should not
+ * call {@link CharsetDecoder.onMalformedInput(CodingErrorAction)}
+ * on the specified decoder before or while this reader is being
+ * used unless you know what you're doing.
+ *
+ * @param in the <code>InputStream</code> to read from.
+ * @param charset the <code>CharsetDecoder</code> to use for
+ * decoding characters.
+ */
+ public NotifyingInputStreamReader(InputStream in, CharsetDecoder decoder)
+ {
+ this.in = in;
+ this.decoder = decoder;
+ this.charBuffer = CharBuffer.wrap(new char[DEFAULT_INPUT_BUFFER_SIZE]);
+ this.charBuffer.position(charBuffer.limit());
+ this.readBuffer = new byte[DEFAULT_OUTPUT_BUFFER_SIZE];
+ this.byteBuffer = ByteBuffer.wrap(readBuffer);
+ this.byteBuffer.position(byteBuffer.limit());
+ }
+
+ public void close()
+ throws IOException
+ {
+ in.close();
+ }
+
+ /**
+ * Fill charBuffer with new character data. This method returns if
+ * either the charBuffer has been filled completely with decoded
+ * character data, or if EOF is reached in the underlying
+ * InputStream. When this method returns, charBuffer is flipped
+ * and ready to be read from.
+ */
+ private void fillCharBuf()
+ throws IOException
+ {
+ charBuffer.clear();
+ outer:
+ while (!flushed) {
+ CoderResult coderResult;
+ int charBufferPositionBefore = charBuffer.position();
+ if (!decodingFinished) {
+ coderResult = decoder.decode(byteBuffer, charBuffer, allInputConsumed);
+ if (allInputConsumed) {
+ decodingFinished = true;
+ }
+ }
+ else {
+ coderResult = decoder.flush(charBuffer);
+ flushed = coderResult.isUnderflow();
+ }
+
+ int charBufferPositionAfter = charBuffer.position();
+ for (int i=charBufferPositionBefore; i<charBufferPositionAfter; ++i) {
+ if (10 == charBuffer.get(i)) {
+ ++ lineNumber;
+ columnNumber = 0;
+ }
+ else {
+ ++ columnNumber;
+ }
+ }
+ if (coderResult.isOverflow()) {
+ break;
+ }
+ else if (coderResult.isUnderflow()) {
+ if (!allInputConsumed) {
+ int nRemainingBytes = 0;
+ if (byteBuffer.position() > 0) {
+ nRemainingBytes = Math.max(0, byteBuffer.limit() - byteBuffer.position());
+ }
+ if (nRemainingBytes > 0) {
+ byteBuffer.get(readBuffer, 0, nRemainingBytes);
+ }
+ byteBuffer.rewind();
+ int nread = in.read(readBuffer, nRemainingBytes,
+ readBuffer.length - nRemainingBytes);
+ if (nread < 0) {
+ allInputConsumed = true;
+ }
+ byteBuffer.limit(nRemainingBytes + Math.max(0, nread));
+ }
+ else {
+ break;
+ }
+ }
+ else if (coderResult.isMalformed()) {
+ fireMalformedInputEncountered(coderResult.length());
+ String replacement = decoder.replacement();
+ for (int i=0; i<coderResult.length(); ++i) {
+ if (charBuffer.remaining() > replacement.length()) {
+ charBuffer.put(replacement);
+ byteBuffer.position(byteBuffer.position() + 1);
+ columnNumber ++;
+ }
+ else {
+ break outer;
+ }
+ }
+ }
+ else if (coderResult.isUnmappable()) {
+ // This should not happen, since unmappable input bytes
+ // trigger a "malformed" event instead.
+ coderResult.throwException();
+ }
+ else {
+ // This should only happen if run in a future environment
+ // where additional events apart from underflow, overflow,
+ // malformed and unmappable can be generated.
+ coderResult.throwException();
+ }
+ }
+ charBuffer.flip();
+ }
+
+ /**
+ * Fire a MalformedInputEvent, notifying all registered listeners.
+ */
+ private void fireMalformedInputEncountered(int length)
+ {
+ MalformedInputEvent event
+ = new MalformedInputEvent(this, lineNumber, columnNumber, length);
+ Iterator it = listeners.iterator();
+ while (it.hasNext()) {
+ MalformedInputListener listener
+ = (MalformedInputListener)it.next();
+ listener.malformedInputEncountered(event);
+ }
+ }
+
+ public int read(char[] cbuf, int offset, int length)
+ throws IOException
+ {
+ if (flushed) {
+ return -1;
+ }
+ else {
+ int nread = 0;
+ while (nread < length && !flushed) {
+ while (charBuffer.hasRemaining() && nread < length) {
+ int copyLen = Math.min(length - nread,
+ charBuffer.remaining());
+ charBuffer.get(cbuf, offset + nread, copyLen);
+ nread += copyLen;
+ }
+ if (nread < length) {
+ fillCharBuf();
+ }
+ }
+ return nread;
+ }
+ }
+
+ public int read()
+ throws IOException
+ {
+ while (!flushed) {
+ if (charBuffer.hasRemaining()) {
+ return charBuffer.get();
+ }
+ else {
+ fillCharBuf();
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * Returns whether this reader is ready. The reader is ready if
+ * there is data in the internal buffer, or if additional data can
+ * be read from the underlying InputStream.
+ */
+ public boolean ready()
+ {
+ return charBuffer.hasRemaining() || !flushed;
+ }
+
+ /**
+ * Register a <code>MalformedInputListener</code> which should be
+ * notified when malformed input is encountered.
+ */
+ public void addMalformedInputListener(MalformedInputListener listener)
+ {
+ this.listeners.add(listener);
+ }
+
+ /**
+ * Unregister a previously registered
+ * <code>MalformedInputListener</code> if it should no longer be
+ * notified when malformed input is encountered.
+ */
+ public void removeMalformedInputListener(MalformedInputListener listener)
+ {
+ this.listeners.remove(listener);
+ }
+
+}
diff --git a/tools/gnu/classpath/tools/StringToolkit.java b/tools/gnu/classpath/tools/StringToolkit.java
new file mode 100644
index 000000000..214dc1b66
--- /dev/null
+++ b/tools/gnu/classpath/tools/StringToolkit.java
@@ -0,0 +1,67 @@
+/* gnu.classpath.tools.StringToolkit
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools;
+
+/**
+ * Provides various String-related helper methods.
+ *
+ * @author Julian Scheid
+ */
+public class StringToolkit
+{
+ /**
+ * Prevents instantiation.
+ */
+ private StringToolkit() {}
+
+ /**
+ * Return <code>haystack</code> with all occurrences of
+ * <code>needle</code> replaced by </code>replacement</code>.
+ *
+ * @param haystack the string to replace occurrences of <code>needle</code> in
+ * @param needle the substring to replace
+ * @param replacement the substring to replace <code>needle</code> with
+ *
+ * @return <code>haystack</code> with all occurrences of
+ * <code>needle</code> replaced by </code>replacement</code>.
+ */
+ public static String replace(String haystack, String needle, String replacement)
+ {
+ int ndx = haystack.indexOf(needle);
+ if (ndx < 0) {
+ return haystack;
+ }
+ else {
+ StringBuffer result = new StringBuffer();
+ result.append(haystack.substring(0, ndx));
+ result.append(replacement);
+ ndx += needle.length();
+ int ndx2;
+ while ((ndx2 = haystack.indexOf(needle, ndx)) >= 0) {
+ result.append(haystack.substring(ndx, ndx2));
+ result.append(replacement);
+ ndx = ndx2 + needle.length();
+ }
+ result.append(haystack.substring(ndx));
+ return result.toString();
+ }
+ }
+}
diff --git a/tools/gnu/classpath/tools/doclets/.cvsignore b/tools/gnu/classpath/tools/doclets/.cvsignore
new file mode 100644
index 000000000..74e8a83b2
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/.cvsignore
@@ -0,0 +1,4 @@
+.deps
+.dirstamp
+.libs
+*.lo
diff --git a/tools/gnu/classpath/tools/doclets/AbstractDoclet.java b/tools/gnu/classpath/tools/doclets/AbstractDoclet.java
new file mode 100644
index 000000000..87772077e
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/AbstractDoclet.java
@@ -0,0 +1,1369 @@
+/* gnu.classpath.tools.doclets.AbstractDoclet
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.doclets;
+
+import com.sun.javadoc.ClassDoc;
+import com.sun.javadoc.ConstructorDoc;
+import com.sun.javadoc.Doc;
+import com.sun.javadoc.Doclet;
+import com.sun.javadoc.ExecutableMemberDoc;
+import com.sun.javadoc.FieldDoc;
+import com.sun.javadoc.MethodDoc;
+import com.sun.javadoc.PackageDoc;
+import com.sun.javadoc.Parameter;
+import com.sun.javadoc.RootDoc;
+import com.sun.javadoc.Tag;
+import com.sun.javadoc.Type;
+
+import com.sun.tools.doclets.Taglet;
+
+import gnu.classpath.tools.taglets.GnuExtendedTaglet;
+import gnu.classpath.tools.taglets.AuthorTaglet;
+import gnu.classpath.tools.taglets.CodeTaglet;
+import gnu.classpath.tools.taglets.DeprecatedTaglet;
+import gnu.classpath.tools.taglets.GenericTaglet;
+import gnu.classpath.tools.taglets.SinceTaglet;
+import gnu.classpath.tools.taglets.ValueTaglet;
+import gnu.classpath.tools.taglets.VersionTaglet;
+import gnu.classpath.tools.taglets.TagletContext;
+
+import gnu.classpath.tools.IOToolkit;
+import gnu.classpath.tools.FileSystemClassLoader;
+
+import java.io.File;
+import java.io.IOException;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.InvocationTargetException;
+
+import java.text.MessageFormat;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.ResourceBundle;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.StringTokenizer;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+/**
+ * An abstract Doclet implementation with helpers for common tasks
+ * performed by Doclets.
+ */
+public abstract class AbstractDoclet
+{
+ /**
+ * Mapping from tag type to Taglet for user Taglets specified on
+ * the command line.
+ */
+ protected Map tagletMap = new LinkedHashMap();
+
+ /**
+ * Stores the package groups specified in the user
+ * options. Contains objects of type PackageGroup.
+ */
+ private List packageGroups = new LinkedList();
+
+ /**
+ * The current classpath for loading taglet classes.
+ */
+ private String tagletPath;
+
+ /**
+ * Keeps track of the tags mentioned by the user during option
+ * processiong so that an error can be emitted if a tag is
+ * mentioned more than once.
+ */
+ private List mentionedTags = new LinkedList();
+
+ public static int optionLength(String option) {
+ return instance.getOptionLength(option);
+ }
+
+ public static boolean validOptions(String[][] options) {
+ return true;
+ }
+
+ private static AbstractDoclet instance;
+
+ protected static void setInstance(AbstractDoclet instance)
+ {
+ AbstractDoclet.instance = instance;
+ }
+
+ protected abstract void run()
+ throws DocletConfigurationException, IOException;
+
+ public static boolean start(RootDoc rootDoc)
+ {
+ try {
+
+ instance.startInstance(rootDoc);
+ return true;
+ }
+ catch (DocletConfigurationException e) {
+ instance.printError(e.getMessage());
+ return false;
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ return false;
+ }
+ }
+
+ protected RootDoc getRootDoc()
+ {
+ return this.rootDoc;
+ }
+
+ private RootDoc rootDoc;
+
+ protected abstract InlineTagRenderer getInlineTagRenderer();
+
+ private void startInstance(RootDoc rootDoc)
+ throws DocletConfigurationException, IOException
+ {
+ this.rootDoc = rootDoc;
+
+ // Set the default Taglet order
+
+ registerTaglet(new VersionTaglet());
+ registerTaglet(new AuthorTaglet());
+ registerTaglet(new SinceTaglet(getInlineTagRenderer()));
+ registerTaglet(new StandardTaglet("serial"));
+ registerTaglet(new StandardTaglet("deprecated"));
+ registerTaglet(new StandardTaglet("see"));
+ registerTaglet(new StandardTaglet("param"));
+ registerTaglet(new StandardTaglet("return"));
+
+ registerTaglet(new ValueTaglet());
+ registerTaglet(new CodeTaglet());
+
+ // Process command line options
+
+ for (int i=0, ilim=rootDoc.options().length; i<ilim; ++i) {
+
+ String[] optionArr = rootDoc.options()[i];
+ String _optionTag = optionArr[0];
+
+ DocletOption option = (DocletOption)nameToOptionMap.get(_optionTag.toLowerCase());
+
+ if (null != option) {
+ option.set(optionArr);
+ }
+ }
+
+ // Enable/disable standard taglets based on user input
+
+ AuthorTaglet.setTagletEnabled(optionAuthor.getValue());
+ VersionTaglet.setTagletEnabled(optionVersion.getValue());
+ SinceTaglet.setTagletEnabled(!optionNoSince.getValue());
+ DeprecatedTaglet.setTagletEnabled(!optionNoDeprecated.getValue());
+
+ if (!getTargetDirectory().exists()) {
+ if (!getTargetDirectory().mkdirs()) {
+ throw new DocletConfigurationException("Cannot create target directory "
+ + getTargetDirectory());
+ }
+ }
+
+ run();
+ }
+
+ public File getTargetDirectory()
+ {
+ return optionTargetDirectory.getValue();
+ }
+
+ private DocletOptionFile optionTargetDirectory =
+ new DocletOptionFile("-d",
+ new File(System.getProperty("user.dir")));
+
+ private DocletOptionFlag optionNoEmailWarn =
+ new DocletOptionFlag("-noemailwarn");
+
+ private DocletOptionFlag optionAuthor =
+ new DocletOptionFlag("-author");
+
+ private DocletOptionFlag optionVersion =
+ new DocletOptionFlag("-version");
+
+ private DocletOptionFlag optionNoSince =
+ new DocletOptionFlag("-nosince");
+
+ private DocletOptionFlag optionNoDeprecated =
+ new DocletOptionFlag("-nodeprecated");
+
+ private DocletOptionGroup optionGroup =
+ new DocletOptionGroup("-group");
+
+ private DocletOptionPackageWildcard optionNoQualifier =
+ new DocletOptionPackageWildcard("-noqualifier", true);
+
+ private DocletOptionFlag optionDocFilesSubDirs =
+ new DocletOptionFlag("-docfilessubdirs");
+
+ private DocletOptionColonSeparated optionExcludeDocFilesSubDir =
+ new DocletOptionColonSeparated("-excludedocfilessubdir");
+
+ private DocletOptionTagletPath optionTagletPath =
+ new DocletOptionTagletPath("-tagletpath");
+
+ private DocletOptionTag optionTaglet =
+ new DocletOptionTag("-taglet");
+
+ private DocletOptionTag optionTag =
+ new DocletOptionTag("-tag");
+
+ private class DocletOptionTaglet
+ extends DocletOption
+ {
+ DocletOptionTaglet(String optionName)
+ {
+ super(optionName);
+ }
+
+ public int getLength()
+ {
+ return 2;
+ }
+
+ public boolean set(String[] optionArr)
+ {
+
+ boolean tagletLoaded = false;
+
+ String useTagletPath = AbstractDoclet.this.tagletPath;
+ if (null == useTagletPath) {
+ useTagletPath = System.getProperty("java.class.path");
+ }
+
+ try {
+ Class tagletClass;
+ try {
+ tagletClass
+ = new FileSystemClassLoader(useTagletPath).loadClass(optionArr[1]);
+ }
+ catch (ClassNotFoundException e) {
+ // If not found on specified tagletpath, try default classloader
+ tagletClass
+ = Class.forName(optionArr[1]);
+ }
+ Method registerTagletMethod
+ = tagletClass.getDeclaredMethod("register", new Class[] { java.util.Map.class });
+
+ if (!registerTagletMethod.getReturnType().equals(Void.TYPE)) {
+ printError("Taglet class '" + optionArr[1] + "' found, but register method doesn't return void.");
+ }
+ else if (registerTagletMethod.getExceptionTypes().length > 0) {
+ printError("Taglet class '" + optionArr[1] + "' found, but register method contains throws clause.");
+ }
+ else if ((registerTagletMethod.getModifiers() & (Modifier.STATIC | Modifier.PUBLIC | Modifier.ABSTRACT)) != (Modifier.STATIC | Modifier.PUBLIC)) {
+ printError("Taglet class '" + optionArr[1] + "' found, but register method isn't public static, or is abstract..");
+ }
+ else {
+ Map tempMap = new HashMap();
+ registerTagletMethod.invoke(null, new Object[] { tempMap });
+ tagletLoaded = true;
+ String name = (String)tempMap.keySet().iterator().next();
+ Taglet taglet = (Taglet)tempMap.get(name);
+ tagletMap.put(name, taglet);
+ mentionedTags.add(taglet);
+ }
+ }
+ catch (NoSuchMethodException e) {
+ printError("Taglet class '" + optionArr[1] + "' found, but doesn't contain the register method.");
+ }
+ catch (SecurityException e) {
+ printError("Taglet class '" + optionArr[1] + "' cannot be loaded: " + e.getMessage());
+ }
+ catch (InvocationTargetException e) {
+ printError("Taglet class '" + optionArr[1] + "' found, but register method throws exception: " + e.toString());
+ }
+ catch (IllegalAccessException e) {
+ printError("Taglet class '" + optionArr[1] + "' found, but there was a problem when accessing the register method: " + e.toString());
+ }
+ catch (IllegalArgumentException e) {
+ printError("Taglet class '" + optionArr[1] + "' found, but there was a problem when accessing the register method: " + e.toString());
+ }
+ catch (ClassNotFoundException e) {
+ printError("Taglet class '" + optionArr[1] + "' cannot be found.");
+ }
+ return tagletLoaded;
+ }
+ }
+
+ private class DocletOptionGroup
+ extends DocletOption
+ {
+ DocletOptionGroup(String optionName)
+ {
+ super(optionName);
+ }
+
+ public int getLength()
+ {
+ return 3;
+ }
+
+ public boolean set(String[] optionArr)
+ {
+ try {
+ PackageMatcher packageMatcher = new PackageMatcher();
+
+ StringTokenizer tokenizer = new StringTokenizer(optionArr[2], ":");
+ while (tokenizer.hasMoreTokens()) {
+ String packageWildcard = tokenizer.nextToken();
+ packageMatcher.addWildcard(packageWildcard);
+ }
+
+ SortedSet groupPackages = packageMatcher.filter(rootDoc.specifiedPackages());
+
+ packageGroups.add(new PackageGroup(optionArr[1], groupPackages));
+
+ return true;
+ }
+ catch (InvalidPackageWildcardException e) {
+ return false;
+ }
+ }
+ }
+
+
+ private class DocletOptionTagletPath
+ extends DocletOption
+ {
+ DocletOptionTagletPath(String optionName)
+ {
+ super(optionName);
+ }
+
+ public int getLength()
+ {
+ return 2;
+ }
+
+ public boolean set(String[] optionArr)
+ {
+ AbstractDoclet.this.tagletPath = optionArr[1];
+ return true;
+ }
+ }
+
+ private class DocletOptionTag
+ extends DocletOption
+ {
+ DocletOptionTag(String optionName)
+ {
+ super(optionName);
+ }
+
+ public int getLength()
+ {
+ return 2;
+ }
+
+ public boolean set(String[] optionArr)
+ {
+ String tagSpec = optionArr[1];
+ boolean validTagSpec = false;
+ int ndx1 = tagSpec.indexOf(':');
+ if (ndx1 < 0) {
+ Taglet taglet = (Taglet)tagletMap.get(tagSpec);
+ if (null == taglet) {
+ printError("There is no standard tag '" + tagSpec + "'.");
+ }
+ else {
+ if (mentionedTags.contains(taglet)) {
+ printError("Tag '" + tagSpec + "' has been added or moved before.");
+ }
+ else {
+ mentionedTags.add(taglet);
+
+ // re-append taglet
+ tagletMap.remove(tagSpec);
+ tagletMap.put(tagSpec, taglet);
+ }
+ }
+ }
+ else {
+ int ndx2 = tagSpec.indexOf(':', ndx1 + 1);
+ if (ndx2 > ndx1 && ndx2 < tagSpec.length() - 1) {
+ String tagName = tagSpec.substring(0, ndx1);
+ String tagHead = null;
+ if (tagSpec.charAt(ndx2 + 1) == '\"') {
+ if (tagSpec.charAt(tagSpec.length() - 1) == '\"') {
+ tagHead = tagSpec.substring(ndx2 + 2, tagSpec.length() - 1);
+ validTagSpec = true;
+ }
+ }
+ else {
+ tagHead = tagSpec.substring(ndx2 + 1);
+ validTagSpec = true;
+ }
+
+ boolean tagScopeOverview = false;
+ boolean tagScopePackages = false;
+ boolean tagScopeTypes = false;
+ boolean tagScopeConstructors = false;
+ boolean tagScopeMethods = false;
+ boolean tagScopeFields = false;
+ boolean tagDisabled = false;
+
+ tag_option_loop:
+ for (int n=ndx1+1; n<ndx2; ++n) {
+ switch (tagSpec.charAt(n)) {
+ case 'X':
+ tagDisabled = true;
+ break;
+ case 'a':
+ tagScopeOverview = true;
+ tagScopePackages = true;
+ tagScopeTypes = true;
+ tagScopeConstructors = true;
+ tagScopeMethods = true;
+ tagScopeFields = true;
+ break;
+ case 'o':
+ tagScopeOverview = true;
+ break;
+ case 'p':
+ tagScopePackages = true;
+ break;
+ case 't':
+ tagScopeTypes = true;
+ break;
+ case 'c':
+ tagScopeConstructors = true;
+ break;
+ case 'm':
+ tagScopeMethods = true;
+ break;
+ case 'f':
+ tagScopeFields = true;
+ break;
+ default:
+ validTagSpec = false;
+ break tag_option_loop;
+ }
+ }
+
+ if (validTagSpec) {
+ GenericTaglet taglet
+ = new GenericTaglet(tagName,
+ tagHead,
+ tagScopeOverview,
+ tagScopePackages,
+ tagScopeTypes,
+ tagScopeConstructors,
+ tagScopeMethods,
+ tagScopeFields);
+ taglet.setTagletEnabled(!tagDisabled);
+ taglet.register(tagletMap);
+ mentionedTags.add(taglet);
+ }
+ }
+ }
+ if (!validTagSpec) {
+ printError("Value for option -tag must be in format \"<tagname>:Xaoptcmf:<taghead>\".");
+ }
+ return validTagSpec;
+ }
+ }
+
+ private DocletOption[] commonOptions =
+ {
+ optionTargetDirectory,
+ optionAuthor,
+ optionVersion,
+ optionNoSince,
+ optionNoDeprecated,
+ optionGroup,
+ optionDocFilesSubDirs,
+ optionExcludeDocFilesSubDir,
+ optionTagletPath,
+ optionTaglet,
+ optionTag,
+ };
+
+ private void registerOptions()
+ {
+ if (!optionsRegistered) {
+ for (int i=0; i<commonOptions.length; ++i) {
+ DocletOption option = commonOptions[i];
+ registerOption(option);
+ }
+ DocletOption[] docletOptions = getOptions();
+ for (int i=0; i<docletOptions.length; ++i) {
+ DocletOption option = docletOptions[i];
+ registerOption(option);
+ }
+ optionsRegistered = true;
+ }
+ }
+
+ protected abstract DocletOption[] getOptions();
+
+ private boolean optionsRegistered = false;
+
+ private void registerOption(DocletOption option)
+ {
+ nameToOptionMap.put(option.getName(), option);
+ }
+
+ private Map nameToOptionMap = new HashMap();
+
+ private int getOptionLength(String optionName)
+ {
+ registerOptions();
+ DocletOption option = (DocletOption)nameToOptionMap.get(optionName.toLowerCase());
+ if (null != option) {
+ return option.getLength();
+ }
+ else {
+ return -1;
+ }
+ }
+
+ protected List getKnownDirectSubclasses(ClassDoc classDoc)
+ {
+ List result = new LinkedList();
+ if (!"java.lang.Object".equals(classDoc.qualifiedName())) {
+ ClassDoc[] classes = rootDoc.classes();
+ for (int i=0; i<classes.length; ++i) {
+ if (classDoc == classes[i].superclass()) {
+ result.add(classes[i]);
+ }
+ }
+ }
+ return result;
+ }
+
+ protected static class IndexKey
+ implements Comparable
+ {
+ private String name;
+ private String lowerName;
+
+ public IndexKey(String name)
+ {
+ this.name = name;
+ this.lowerName = name.toLowerCase();
+ }
+
+ public boolean equals(Object other)
+ {
+ return this.lowerName.equals(((IndexKey)other).lowerName);
+ }
+
+ public int hashCode()
+ {
+ return lowerName.hashCode();
+ }
+
+ public int compareTo(Object other)
+ {
+ return lowerName.compareTo(((IndexKey)other).lowerName);
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+ }
+
+ private Map categorizedIndex;
+
+ protected Map getCategorizedIndex()
+ {
+ if (null == categorizedIndex) {
+ categorizedIndex = new LinkedHashMap();
+
+ Map indexMap = getIndexByName();
+ LinkedList keys = new LinkedList(); //indexMap.keySet().size());
+ keys.addAll(indexMap.keySet());
+ Collections.sort(keys);
+ Iterator it = keys.iterator(); //indexMap.keySet().iterator();
+ char previousCategoryLetter = '\0';
+ Character keyLetter = null;
+ while (it.hasNext()) {
+ IndexKey key = (IndexKey)it.next();
+ char firstChar = Character.toUpperCase(key.getName().charAt(0));
+ if (firstChar != previousCategoryLetter) {
+ keyLetter = new Character(firstChar);
+ previousCategoryLetter = firstChar;
+ categorizedIndex.put(keyLetter, new LinkedList());
+ }
+ List letterList = (List)categorizedIndex.get(keyLetter);
+ letterList.add(indexMap.get(key));
+ }
+ }
+
+ return categorizedIndex;
+ }
+
+
+ private Map indexByName;
+
+ protected Map getIndexByName()
+ {
+ if (null == indexByName) {
+ // Create index
+
+ // Collect index
+
+ indexByName = new HashMap(); //TreeMap();
+
+ // Add packages to index
+
+ PackageDoc[] packages = rootDoc.specifiedPackages();
+ for (int i=0, ilim=packages.length; i<ilim; ++i) {
+ PackageDoc c = packages[i];
+ if (c.name().length() > 0) {
+ indexByName.put(new IndexKey(c.name()), c);
+ }
+ }
+
+ // Add classes, fields and methods to index
+
+ ClassDoc[] sumclasses = rootDoc.classes();
+ for (int i=0, ilim=sumclasses.length; i<ilim; ++i) {
+ ClassDoc c = sumclasses[i];
+ if (null == c.containingClass()) {
+ indexByName.put(new IndexKey(c.name() + " " + c.containingPackage().name()), c);
+ }
+ else {
+ indexByName.put(new IndexKey(c.name().substring(c.containingClass().name().length() + 1)
+ + " " + c.containingClass().name() + " " + c.containingPackage().name()), c);
+ }
+ FieldDoc[] fields = c.fields();
+ for (int j=0, jlim=fields.length; j<jlim; ++j) {
+ indexByName.put(new IndexKey(fields[j].name() + " " + fields[j].containingClass().name() + " " + fields[j].containingPackage().name()), fields[j]);
+ }
+ MethodDoc[] methods = c.methods();
+ for (int j=0, jlim=methods.length; j<jlim; ++j) {
+ MethodDoc method = methods[j];
+ indexByName.put(new IndexKey(method.name() + method.signature() + " " + method.containingClass().name() + " " + method.containingPackage().name()), method);
+ }
+ ConstructorDoc[] constructors = c.constructors();
+ for (int j=0, jlim=constructors.length; j<jlim; ++j) {
+ ConstructorDoc constructor = constructors[j];
+ indexByName.put(new IndexKey(constructor.name() + constructor.signature() + " " + constructor.containingClass().name() + " " + constructor.containingPackage().name()), constructor);
+ }
+ }
+ }
+ return indexByName;
+ }
+
+ private void registerTaglet(Taglet taglet)
+ {
+ tagletMap.put(taglet.getName(), taglet);
+ }
+
+ protected void printTaglets(Tag[] tags, TagletContext context, TagletPrinter output, boolean inline)
+ {
+ for (Iterator it = tagletMap.keySet().iterator(); it.hasNext(); ) {
+ String tagName = (String)it.next();
+ Object o = tagletMap.get(tagName);
+ Taglet taglet = (Taglet)o;
+ Doc doc = context.getDoc();
+ if (inline == taglet.isInlineTag()
+ && ((doc == null
+ && taglet.inOverview())
+ || (doc != null
+ && ((doc.isConstructor() && taglet.inConstructor())
+ || (doc.isField() && taglet.inField())
+ || (doc.isMethod() && taglet.inMethod())
+ || (doc instanceof PackageDoc && taglet.inPackage())
+ || ((doc.isClass() || doc.isInterface()) && taglet.inType()))))) {
+
+ List tagsOfThisType = new LinkedList();
+ for (int i=0; i<tags.length; ++i) {
+ if (tags[i].name().substring(1).equals(tagName)) {
+ tagsOfThisType.add(tags[i]);
+ }
+ }
+
+ Tag[] tagletTags = (Tag[])tagsOfThisType.toArray(new Tag[tagsOfThisType.size()]);
+
+ String tagletString;
+ if (taglet instanceof StandardTaglet) {
+ tagletString = renderTag(tagName, tagletTags, context);
+ }
+ else if (taglet instanceof GnuExtendedTaglet) {
+ tagletString = ((GnuExtendedTaglet)taglet).toString(tagletTags, context);
+ }
+ else {
+ tagletString = taglet.toString(tagletTags);
+ }
+ if (null != tagletString) {
+ output.printTagletString(tagletString);
+ }
+ }
+ }
+ }
+
+ protected void printInlineTaglet(Tag tag, TagletContext context, TagletPrinter output)
+ {
+ Taglet taglet = (Taglet)tagletMap.get(tag.name().substring(1));
+ if (null != taglet) {
+ String tagletString;
+ if (taglet instanceof GnuExtendedTaglet) {
+ tagletString = ((GnuExtendedTaglet)taglet).toString(tag, context);
+ }
+ else {
+ tagletString = taglet.toString(tag);
+ }
+ if (null != tagletString) {
+ output.printTagletString(tagletString);
+ }
+ }
+ else {
+ printWarning("Unknown tag: " + tag.name());
+ }
+ }
+
+ protected void printMainTaglets(Tag[] tags, TagletContext context, TagletPrinter output)
+ {
+ printTaglets(tags, context, output, false);
+ }
+
+ /**
+ * @param usedClassToPackagesMap ClassDoc to (PackageDoc to (UsageType to (Set of Doc)))
+ */
+ private void addUsedBy(Map usedClassToPackagesMap,
+ ClassDoc usedClass, UsageType usageType, Doc user, PackageDoc userPackage)
+ {
+ Map packageToUsageTypeMap = (Map)usedClassToPackagesMap.get(usedClass);
+ if (null == packageToUsageTypeMap) {
+ packageToUsageTypeMap = new HashMap();
+ usedClassToPackagesMap.put(usedClass, packageToUsageTypeMap);
+ }
+
+ Map usageTypeToUsersMap = (Map)packageToUsageTypeMap.get(userPackage);
+ if (null == usageTypeToUsersMap) {
+ usageTypeToUsersMap = new TreeMap();
+ packageToUsageTypeMap.put(userPackage, usageTypeToUsersMap);
+ }
+
+ Set userSet = (Set)usageTypeToUsersMap.get(usageType);
+ if (null == userSet) {
+ userSet = new TreeSet(); // FIXME: we need the collator from Main here
+ usageTypeToUsersMap.put(usageType, userSet);
+ }
+ userSet.add(user);
+ }
+
+ /**
+ * Create the cross reference database.
+ */
+ private Map collectUsage() {
+
+ Map _usedClassToPackagesMap = new HashMap();
+
+ ClassDoc[] classes = rootDoc.classes();
+ for (int i = 0, ilim = classes.length; i < ilim; ++ i) {
+ ClassDoc clazz = classes[i];
+
+ if (clazz.isInterface()) {
+ // classes implementing
+ InterfaceRelation relation
+ = (InterfaceRelation)getInterfaceRelations().get(clazz);
+ Iterator it = relation.implementingClasses.iterator();
+ while (it.hasNext()) {
+ ClassDoc implementor = (ClassDoc)it.next();
+ addUsedBy(_usedClassToPackagesMap,
+ clazz, UsageType.CLASS_IMPLEMENTING, implementor, implementor.containingPackage());
+ }
+ }
+ else {
+ // classes derived from
+ for (ClassDoc superclass = clazz.superclass(); superclass != null;
+ superclass = superclass.superclass()) {
+ addUsedBy(_usedClassToPackagesMap,
+ superclass, UsageType.CLASS_DERIVED_FROM, clazz, clazz.containingPackage());
+ }
+ }
+
+ FieldDoc[] fields = clazz.fields();
+ for (int j = 0, jlim = fields.length; j < jlim; ++ j) {
+ FieldDoc field = fields[j];
+
+ // fields of type
+ ClassDoc fieldType = field.type().asClassDoc();
+ if (null != fieldType) {
+ addUsedBy(_usedClassToPackagesMap,
+ fieldType, UsageType.FIELD_OF_TYPE,
+ field, clazz.containingPackage());
+ }
+ }
+
+ MethodDoc[] methods = clazz.methods();
+ for (int j = 0, jlim = methods.length; j < jlim; ++ j) {
+ MethodDoc method = methods[j];
+
+ // methods with return type
+
+ ClassDoc returnType = method.returnType().asClassDoc();
+ if (null != returnType) {
+ addUsedBy(_usedClassToPackagesMap,
+ returnType, UsageType.METHOD_WITH_RETURN_TYPE,
+ method, clazz.containingPackage());
+ }
+ Parameter[] parameters = method.parameters();
+ for (int k=0; k<parameters.length; ++k) {
+
+ // methods with parameter type
+
+ Parameter parameter = parameters[k];
+ ClassDoc parameterType = parameter.type().asClassDoc();
+ if (null != parameterType) {
+ addUsedBy(_usedClassToPackagesMap,
+ parameterType, UsageType.METHOD_WITH_PARAMETER_TYPE,
+ method, clazz.containingPackage());
+ }
+ }
+
+ // methods which throw
+
+ ClassDoc[] thrownExceptions = method.thrownExceptions();
+ for (int k = 0, klim = thrownExceptions.length; k < klim; ++ k) {
+ ClassDoc thrownException = thrownExceptions[k];
+ addUsedBy(_usedClassToPackagesMap,
+ thrownException, UsageType.METHOD_WITH_THROWN_TYPE,
+ method, clazz.containingPackage());
+ }
+ }
+
+ ConstructorDoc[] constructors = clazz.constructors();
+ for (int j = 0, jlim = constructors.length; j < jlim; ++ j) {
+
+ ConstructorDoc constructor = constructors[j];
+
+ Parameter[] parameters = constructor.parameters();
+ for (int k = 0, klim = parameters.length; k < klim; ++ k) {
+
+ // constructors with parameter type
+
+ Parameter parameter = parameters[k];
+ ClassDoc parameterType = parameter.type().asClassDoc();
+ if (null != parameterType) {
+ addUsedBy(_usedClassToPackagesMap,
+ parameterType, UsageType.CONSTRUCTOR_WITH_PARAMETER_TYPE,
+ constructor, clazz.containingPackage());
+ }
+ }
+
+ // constructors which throw
+
+ ClassDoc[] thrownExceptions = constructor.thrownExceptions();
+ for (int k = 0, klim = thrownExceptions.length; k < klim; ++ k) {
+ ClassDoc thrownException = thrownExceptions[k];
+ addUsedBy(_usedClassToPackagesMap,
+ thrownException, UsageType.CONSTRUCTOR_WITH_THROWN_TYPE,
+ constructor, clazz.containingPackage());
+ }
+ }
+ }
+ return _usedClassToPackagesMap;
+ }
+
+ private Map usedClassToPackagesMap = null;
+
+ protected Map getUsageOfClass(ClassDoc classDoc)
+ {
+ if (null == this.usedClassToPackagesMap) {
+ this.usedClassToPackagesMap = collectUsage();
+ }
+ return (Map)this.usedClassToPackagesMap.get(classDoc);
+ }
+
+ protected static class UsageType
+ implements Comparable
+ {
+ public static final UsageType CLASS_DERIVED_FROM = new UsageType("class-derived-from");
+ public static final UsageType CLASS_IMPLEMENTING = new UsageType("class-implementing");
+ public static final UsageType FIELD_OF_TYPE = new UsageType("field-of-type");
+ public static final UsageType METHOD_WITH_RETURN_TYPE = new UsageType("method-with-return-type");
+ public static final UsageType METHOD_WITH_PARAMETER_TYPE = new UsageType("method-with-parameter-type");
+ public static final UsageType METHOD_WITH_THROWN_TYPE = new UsageType("method-with-thrown-type");
+ public static final UsageType CONSTRUCTOR_WITH_PARAMETER_TYPE = new UsageType("constructor-with-parameter-type");
+ public static final UsageType CONSTRUCTOR_WITH_THROWN_TYPE = new UsageType("constructor-with-thrown-type");
+ private String id;
+
+ private UsageType(String id)
+ {
+ this.id = id;
+ }
+
+ public int compareTo(Object other)
+ {
+ return this.id.compareTo(((UsageType)other).id);
+ }
+
+ public String toString() {
+ return "UsageType{id=" + id + "}";
+ }
+
+ public String getId() {
+ return id;
+ }
+ }
+
+ private ResourceBundle resources;
+
+ protected String getString(String key)
+ {
+ if (null == resources) {
+ Locale currentLocale = Locale.getDefault();
+
+ resources
+ = ResourceBundle.getBundle("htmldoclet.HtmlDoclet", currentLocale);
+ }
+
+ return resources.getString(key);
+ }
+
+ protected String format(String key, String value1)
+ {
+ return MessageFormat.format(getString(key), new Object[] { value1 });
+ }
+
+ protected List getPackageGroups()
+ {
+ return packageGroups;
+ }
+
+ protected void copyDocFiles(File sourceDir, File targetDir)
+ throws IOException
+ {
+ File sourceDocFiles = new File(sourceDir, "doc-files");
+ File targetDocFiles = new File(targetDir, "doc-files");
+
+ if (sourceDocFiles.exists()) {
+ IOToolkit.copyDirectory(sourceDocFiles,
+ targetDocFiles,
+ optionDocFilesSubDirs.getValue(),
+ optionExcludeDocFilesSubDir.getComponents());
+ }
+ }
+
+ private Set sourcePaths;
+
+ /**
+ * Try to determine the source directory for the given package by
+ * looking at the path specified by -sourcepath, or the current
+ * directory if -sourcepath hasn't been specified.
+ *
+ * @throws IOException if the source directory couldn't be
+ * located.
+ *
+ * @return List of File
+ */
+ protected List getPackageSourceDirs(PackageDoc packageDoc)
+ throws IOException
+ {
+ if (null == sourcePaths) {
+ for (int i=0; i<rootDoc.options().length; ++i) {
+ if ("-sourcepath".equals(rootDoc.options()[i][0])
+ || "-s".equals(rootDoc.options()[i][0])) {
+ sourcePaths = new LinkedHashSet();
+ String sourcepathString = rootDoc.options()[i][1];
+ StringTokenizer st = new StringTokenizer(sourcepathString, File.pathSeparator);
+ while (st.hasMoreTokens()) {
+ sourcePaths.add(new File(st.nextToken()));
+ }
+ }
+ }
+ if (null == sourcePaths) {
+ sourcePaths = new LinkedHashSet();
+ sourcePaths.add(new File(System.getProperty("user.dir")));
+ }
+ }
+
+ String packageSubDir = packageDoc.name().replace('.', File.separatorChar);
+ Iterator it = sourcePaths.iterator();
+ List result = new LinkedList();
+ while (it.hasNext()) {
+ File pathComponent = (File)it.next();
+ File packageDir = new File(pathComponent, packageSubDir);
+ if (packageDir.exists()) {
+ result.add(packageDir);
+ }
+ }
+ if (result.isEmpty()) {
+ throw new IOException("Couldn't locate source directory for package " + packageDoc.name());
+ }
+ else {
+ return result;
+ }
+ }
+
+ protected File getSourceFile(ClassDoc classDoc)
+ throws IOException
+ {
+ List packageDirs = getPackageSourceDirs(classDoc.containingPackage());
+ Iterator it = packageDirs.iterator();
+ while (it.hasNext()) {
+ File packageDir = (File)it.next();
+ File sourceFile = new File(packageDir, getOuterClassDoc(classDoc).name() + ".java");
+ if (sourceFile.exists()) {
+ return sourceFile;
+ }
+ }
+
+ throw new IOException("Couldn't locate source file for class " + classDoc.qualifiedTypeName());
+ }
+
+ protected void printError(String error)
+ {
+ if (null != rootDoc) {
+ rootDoc.printError(error);
+ }
+ else {
+ System.err.println("ERROR: "+error);
+ }
+ }
+
+ protected void printWarning(String warning)
+ {
+ if (null != rootDoc) {
+ rootDoc.printWarning(warning);
+ }
+ else {
+ System.err.println("WARNING: "+warning);
+ }
+ }
+
+ protected void printNotice(String notice)
+ {
+ if (null != rootDoc) {
+ rootDoc.printNotice(notice);
+ }
+ else {
+ System.err.println(notice);
+ }
+ }
+
+ protected static ClassDoc getOuterClassDoc(ClassDoc classDoc)
+ {
+ while (null != classDoc.containingClass()) {
+ classDoc = classDoc.containingClass();
+ }
+ return classDoc;
+ }
+
+ private SortedSet allPackages;
+
+ protected Set getAllPackages()
+ {
+ if (null == this.allPackages) {
+ allPackages = new TreeSet();
+ PackageDoc[] specifiedPackages = rootDoc.specifiedPackages();
+ for (int i=0; i<specifiedPackages.length; ++i) {
+ allPackages.add(specifiedPackages[i]);
+ }
+ ClassDoc[] specifiedClasses = rootDoc.specifiedClasses();
+ for (int i=0; i<specifiedClasses.length; ++i) {
+ allPackages.add(specifiedClasses[i].containingPackage());
+ }
+ }
+ return this.allPackages;
+ }
+
+ protected boolean omitPackageQualifier(PackageDoc packageDoc)
+ {
+ if (!optionNoQualifier.isSpecified()) {
+ return false;
+ }
+ else {
+ return optionNoQualifier.match(packageDoc);
+ }
+ }
+
+ protected String possiblyQualifiedName(Type type)
+ {
+ if (null == type.asClassDoc()
+ || !omitPackageQualifier(type.asClassDoc().containingPackage())) {
+ return type.qualifiedTypeName();
+ }
+ else {
+ return type.typeName();
+ }
+ }
+
+ protected static class InterfaceRelation
+ {
+ public Set superInterfaces;
+ public Set subInterfaces;
+ public Set implementingClasses;
+
+ public InterfaceRelation()
+ {
+ superInterfaces = new TreeSet();
+ subInterfaces = new TreeSet();
+ implementingClasses = new TreeSet();
+ }
+ }
+
+ private void addAllInterfaces(ClassDoc classDoc, Set allInterfaces)
+ {
+ ClassDoc[] interfaces = classDoc.interfaces();
+ for (int i=0; i<interfaces.length; ++i) {
+ allInterfaces.add(interfaces[i]);
+ addAllInterfaces(interfaces[i], allInterfaces);
+ }
+ }
+
+ private Map allSubClasses;
+
+ protected Map getAllSubClasses()
+ {
+ if (null == allSubClasses) {
+ allSubClasses = new HashMap();
+
+ ClassDoc[] classDocs = getRootDoc().classes();
+ for (int i=0; i<classDocs.length; ++i) {
+ if (!classDocs[i].isInterface()) {
+ for (ClassDoc cd = classDocs[i].superclass();
+ null != cd;
+ cd = cd.superclass()) {
+
+ if (!cd.qualifiedTypeName().equals("java.lang.Object")) {
+ List subClasses = (List)allSubClasses.get(cd);
+ if (null == subClasses) {
+ subClasses = new LinkedList();
+ allSubClasses.put(cd, subClasses);
+ }
+ subClasses.add(classDocs[i]);
+ }
+ }
+ }
+ }
+ }
+ return allSubClasses;
+ }
+
+ private Map interfaceRelations;
+
+ private void addToInterfaces(ClassDoc classDoc, ClassDoc[] interfaces)
+ {
+ for (int i=0; i<interfaces.length; ++i) {
+ InterfaceRelation interfaceRelation
+ = (InterfaceRelation)interfaceRelations.get(interfaces[i]);
+ if (null == interfaceRelation) {
+ interfaceRelation = new InterfaceRelation();
+ interfaceRelations.put(interfaces[i], interfaceRelation);
+ }
+ interfaceRelation.implementingClasses.add(classDoc);
+ addToInterfaces(classDoc, interfaces[i].interfaces());
+ }
+ }
+
+ protected Map getInterfaceRelations()
+ {
+ if (null == interfaceRelations) {
+ interfaceRelations = new HashMap();
+
+ ClassDoc[] classDocs = getRootDoc().classes();
+ for (int i=0; i<classDocs.length; ++i) {
+ if (classDocs[i].isInterface()) {
+ InterfaceRelation relation = new InterfaceRelation();
+ addAllInterfaces(classDocs[i], relation.superInterfaces);
+ interfaceRelations.put(classDocs[i], relation);
+ }
+ }
+
+ Iterator it = interfaceRelations.keySet().iterator();
+ while (it.hasNext()) {
+ ClassDoc interfaceDoc = (ClassDoc)it.next();
+ InterfaceRelation relation
+ = (InterfaceRelation)interfaceRelations.get(interfaceDoc);
+ Iterator superIt = relation.superInterfaces.iterator();
+ while (superIt.hasNext()) {
+ ClassDoc superInterfaceDoc = (ClassDoc)superIt.next();
+ InterfaceRelation superRelation
+ = (InterfaceRelation)interfaceRelations.get(superInterfaceDoc);
+ if (null != superRelation) {
+ superRelation.subInterfaces.add(interfaceDoc);
+ }
+ }
+ }
+
+ for (int i=0; i<classDocs.length; ++i) {
+ if (!classDocs[i].isInterface()) {
+ for (ClassDoc cd = classDocs[i]; null != cd; cd = cd.superclass()) {
+ addToInterfaces(classDocs[i], cd.interfaces());
+ }
+ }
+ }
+ }
+
+ return interfaceRelations;
+ }
+
+ private Map sortedMethodMap = new HashMap();
+
+ protected MethodDoc[] getSortedMethods(ClassDoc classDoc)
+ {
+ MethodDoc[] result = (MethodDoc[])sortedMethodMap.get(classDoc);
+ if (null == result) {
+ MethodDoc[] methods = classDoc.methods();
+ result = (MethodDoc[])methods.clone();
+ Arrays.sort(result);
+ return result;
+ }
+ return result;
+ }
+
+ private Map sortedConstructorMap = new HashMap();
+
+ protected ConstructorDoc[] getSortedConstructors(ClassDoc classDoc)
+ {
+ ConstructorDoc[] result = (ConstructorDoc[])sortedConstructorMap.get(classDoc);
+ if (null == result) {
+ ConstructorDoc[] constructors = classDoc.constructors();
+ result = (ConstructorDoc[])constructors.clone();
+ Arrays.sort(result);
+ return result;
+ }
+ return result;
+ }
+
+ private Map sortedFieldMap = new HashMap();
+
+ protected FieldDoc[] getSortedFields(ClassDoc classDoc)
+ {
+ FieldDoc[] result = (FieldDoc[])sortedFieldMap.get(classDoc);
+ if (null == result) {
+ FieldDoc[] fields = classDoc.fields();
+ result = (FieldDoc[])fields.clone();
+ Arrays.sort(result);
+ return result;
+ }
+ return result;
+ }
+
+ private Map sortedInnerClassMap = new HashMap();
+
+ protected ClassDoc[] getSortedInnerClasses(ClassDoc classDoc)
+ {
+ ClassDoc[] result = (ClassDoc[])sortedInnerClassMap.get(classDoc);
+ if (null == result) {
+ ClassDoc[] innerClasses = classDoc.innerClasses();
+ result = (ClassDoc[])innerClasses.clone();
+ Arrays.sort(result);
+ return result;
+ }
+ return result;
+ }
+
+ protected abstract String renderTag(String tagName, Tag[] tags, TagletContext context);
+
+ protected abstract String getDocletVersion();
+
+ protected SortedSet getThrownExceptions(ExecutableMemberDoc execMemberDoc)
+ {
+ SortedSet result = new TreeSet();
+ ClassDoc[] thrownExceptions = execMemberDoc.thrownExceptions();
+ for (int j=0; j<thrownExceptions.length; ++j) {
+ result.add(thrownExceptions[j]);
+ }
+ return result;
+ }
+
+ protected boolean isUncheckedException(ClassDoc classDoc)
+ {
+ if (classDoc.isException()) {
+ while (null != classDoc) {
+ if (classDoc.qualifiedTypeName().equals("java.lang.RuntimeException")) {
+ return true;
+ }
+ classDoc = classDoc.superclass();
+ }
+ return false;
+ }
+ else {
+ return false;
+ }
+ }
+
+ protected FieldDoc findField(ClassDoc classDoc, String fieldName)
+ {
+ for (ClassDoc cd = classDoc; cd != null; cd = cd.superclass()) {
+ FieldDoc[] fields = cd.fields(false);
+ for (int i=0; i<fields.length; ++i) {
+ if (fields[i].name().equals(fieldName)) {
+ return fields[i];
+ }
+ }
+ }
+ return null;
+ }
+
+ private Map implementedInterfacesCache = new HashMap();
+
+ protected Set getImplementedInterfaces(ClassDoc classDoc)
+ {
+ Set result = (Set)implementedInterfacesCache.get(classDoc);
+ if (null == result) {
+ result = new TreeSet();
+
+ for (ClassDoc cd = classDoc; cd != null; cd = cd.superclass()) {
+ ClassDoc[] interfaces = cd.interfaces();
+ for (int i=0; i<interfaces.length; ++i) {
+ result.add(interfaces[i]);
+ InterfaceRelation relation
+ = (InterfaceRelation)getInterfaceRelations().get(interfaces[i]);
+ if (null != relation) {
+ result.addAll(relation.superInterfaces);
+ }
+ }
+ }
+
+ implementedInterfacesCache.put(classDoc, result);
+ }
+
+ return result;
+ }
+
+ protected boolean isSinglePackage()
+ {
+ return getAllPackages().size() <= 1;
+ }
+
+ protected PackageDoc getSinglePackage()
+ {
+ return (PackageDoc)getAllPackages().iterator().next();
+ }
+}
diff --git a/tools/gnu/classpath/tools/doclets/DocletConfigurationException.java b/tools/gnu/classpath/tools/doclets/DocletConfigurationException.java
new file mode 100644
index 000000000..f75c6cdb7
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/DocletConfigurationException.java
@@ -0,0 +1,37 @@
+/* gnu.classpath.tools.doclets.DocletConfigurationException
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.doclets;
+
+/**
+ * Thrown by <code>AbstractDoclet</code> members or members of
+ * <code>AbstractDoclet</code> subclasses when a problem caused by
+ * user-specified options is detected.
+ *
+ * @see AbstractDoclet
+ */
+public class DocletConfigurationException
+ extends Exception
+{
+ public DocletConfigurationException(String message)
+ {
+ super(message);
+ }
+}
diff --git a/tools/gnu/classpath/tools/doclets/DocletOption.java b/tools/gnu/classpath/tools/doclets/DocletOption.java
new file mode 100644
index 000000000..fec2c7ac7
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/DocletOption.java
@@ -0,0 +1,39 @@
+/* gnu.classpath.tools.doclets.DocletOption
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.doclets;
+
+public abstract class DocletOption
+{
+ private String optionName;
+
+ protected DocletOption(String optionName)
+ {
+ this.optionName = optionName;
+ }
+
+ public String getName()
+ {
+ return this.optionName;
+ }
+
+ public abstract int getLength();
+ public abstract boolean set(String[] optionArr);
+}
diff --git a/tools/gnu/classpath/tools/doclets/DocletOptionColonSeparated.java b/tools/gnu/classpath/tools/doclets/DocletOptionColonSeparated.java
new file mode 100644
index 000000000..b33519fd2
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/DocletOptionColonSeparated.java
@@ -0,0 +1,60 @@
+/* gnu.classpath.tools.doclets.DocletOptionColonSeparated
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.doclets;
+
+import java.util.LinkedHashSet;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+/**
+ * Processes a doclet option whose value consists of a
+ * colon-separated list of strings.
+ */
+public class DocletOptionColonSeparated
+ extends DocletOption
+{
+ private Set components = new LinkedHashSet();
+
+ DocletOptionColonSeparated(String optionName)
+ {
+ super(optionName);
+ }
+
+ public int getLength()
+ {
+ return 2;
+ }
+
+ public boolean set(String[] optionArr)
+ {
+ StringTokenizer st = new StringTokenizer(":");
+ while (st.hasMoreTokens()) {
+ components.add(st.nextToken());
+ }
+ return true;
+ }
+
+ public Set getComponents()
+ {
+ return components;
+ }
+}
+
diff --git a/tools/gnu/classpath/tools/doclets/DocletOptionFile.java b/tools/gnu/classpath/tools/doclets/DocletOptionFile.java
new file mode 100644
index 000000000..c1f1c3c63
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/DocletOptionFile.java
@@ -0,0 +1,60 @@
+/* gnu.classpath.tools.doclets.DocletOptionFile
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.doclets;
+
+import java.io.File;
+
+/**
+ * Processes a doclet option whose value denotes an existing or
+ * non-existing file in the local file system.
+ */
+public class DocletOptionFile
+ extends DocletOption
+{
+ private File value;
+
+ public DocletOptionFile(String optionName)
+ {
+ this(optionName, null);
+ }
+
+ public DocletOptionFile(String optionName, File defaultFile)
+ {
+ super(optionName);
+ this.value = defaultFile;
+ }
+
+ public File getValue()
+ {
+ return this.value;
+ }
+
+ public int getLength()
+ {
+ return 2;
+ }
+
+ public boolean set(String[] optionArr)
+ {
+ this.value = new File(optionArr[1]);
+ return true;
+ }
+}
diff --git a/tools/gnu/classpath/tools/doclets/DocletOptionFlag.java b/tools/gnu/classpath/tools/doclets/DocletOptionFlag.java
new file mode 100644
index 000000000..0909a86fc
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/DocletOptionFlag.java
@@ -0,0 +1,52 @@
+/* gnu.classpath.tools.doclets.DocletOptionFlag
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.doclets;
+
+/**
+ * Processes a doclet option without a value whose existance denotes
+ * that a specific feature should be enabled or disabled.
+ */
+public class DocletOptionFlag
+ extends DocletOption
+{
+ private boolean value = false;
+
+ public DocletOptionFlag(String optionName)
+ {
+ super(optionName);
+ }
+
+ public boolean getValue()
+ {
+ return this.value;
+ }
+
+ public int getLength()
+ {
+ return 1;
+ }
+
+ public boolean set(String[] optionArr)
+ {
+ value = true;
+ return true;
+ }
+}
diff --git a/tools/gnu/classpath/tools/doclets/DocletOptionPackageWildcard.java b/tools/gnu/classpath/tools/doclets/DocletOptionPackageWildcard.java
new file mode 100644
index 000000000..261c676c3
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/DocletOptionPackageWildcard.java
@@ -0,0 +1,108 @@
+/* gnu.classpath.tools.doclets.DocletOptionPackageWildcard
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.doclets;
+
+import java.util.LinkedHashSet;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.StringTokenizer;
+import java.util.TreeSet;
+
+import com.sun.javadoc.PackageDoc;
+
+/**
+ * Processes a doclet option whose value consists of a
+ * colon-separated list of package wildcards, or - optionally -
+ * equals the string "all", denoting that all packages should match.
+ */
+public class DocletOptionPackageWildcard
+ extends DocletOption
+{
+ private PackageMatcher packageMatcher;
+ private boolean allowAll;
+ private boolean specified;
+
+ DocletOptionPackageWildcard(String optionName, boolean allowAll)
+ {
+ super(optionName);
+ this.allowAll = allowAll;
+ }
+
+ public int getLength()
+ {
+ return 2;
+ }
+
+ public boolean isSpecified()
+ {
+ return specified;
+ }
+
+ public boolean set(String[] optionArr)
+ {
+ this.specified = true;
+ try {
+ if (allowAll && "all".equals(optionArr[2])) {
+ packageMatcher = null;
+ }
+ else {
+ packageMatcher = new PackageMatcher();
+
+ StringTokenizer tokenizer = new StringTokenizer(optionArr[2], ":");
+ while (tokenizer.hasMoreTokens()) {
+ String packageWildcard = tokenizer.nextToken();
+ packageMatcher.addWildcard(packageWildcard);
+ }
+ }
+ return true;
+ }
+ catch (InvalidPackageWildcardException e) {
+ // FIXME: output problem description here, better throw
+ // DocletConfigurationException
+ return false;
+ }
+ }
+
+ public SortedSet filter(PackageDoc[] packages)
+ {
+ if (null != packageMatcher) {
+ return packageMatcher.filter(packages);
+ }
+ else {
+ SortedSet result = new TreeSet();
+ for (int i=0; i<packages.length; ++i) {
+ result.add(packages[i]);
+ }
+ return result;
+ }
+ }
+
+ public boolean match(PackageDoc packageDoc)
+ {
+ if (null != packageMatcher) {
+ return packageMatcher.match(packageDoc);
+ }
+ else {
+ return true;
+ }
+ }
+}
+
diff --git a/tools/gnu/classpath/tools/doclets/DocletOptionString.java b/tools/gnu/classpath/tools/doclets/DocletOptionString.java
new file mode 100644
index 000000000..b9b956691
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/DocletOptionString.java
@@ -0,0 +1,51 @@
+/* gnu.classpath.tools.doclets.DocletOptionString
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.doclets;
+
+/**
+ * Processes a doclet option whose value is an arbitrary string.
+ */
+public class DocletOptionString
+ extends DocletOption
+{
+ private String value = null;
+
+ public DocletOptionString(String optionName)
+ {
+ super(optionName);
+ }
+
+ public String getValue()
+ {
+ return this.value;
+ }
+
+ public int getLength()
+ {
+ return 2;
+ }
+
+ public boolean set(String[] optionArr)
+ {
+ value = optionArr[1];
+ return true;
+ }
+}
diff --git a/tools/gnu/classpath/tools/doclets/InlineTagRenderer.java b/tools/gnu/classpath/tools/doclets/InlineTagRenderer.java
new file mode 100644
index 000000000..fa5cf842a
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/InlineTagRenderer.java
@@ -0,0 +1,29 @@
+/* gnu.classpath.tools.doclets.InlineTagRenderer
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.doclets;
+
+import com.sun.javadoc.Tag;
+import gnu.classpath.tools.taglets.TagletContext;
+
+public interface InlineTagRenderer
+{
+ public String renderInlineTags(Tag[] tags, TagletContext context);
+}
diff --git a/tools/gnu/classpath/tools/doclets/InvalidPackageWildcardException.java b/tools/gnu/classpath/tools/doclets/InvalidPackageWildcardException.java
new file mode 100644
index 000000000..f8806c569
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/InvalidPackageWildcardException.java
@@ -0,0 +1,35 @@
+/* gnu.classpath.tools.doclets.InvalidPackageWildcardException
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.doclets;
+
+/**
+ * Thrown when an invalid wildcard pattern is passed to {@link
+ * PackageMatcher.addWildcard(String)}.
+ */
+public class InvalidPackageWildcardException
+ extends Exception
+{
+ public InvalidPackageWildcardException(String msg)
+ {
+ super(msg);
+ }
+}
+
diff --git a/tools/gnu/classpath/tools/doclets/PackageGroup.java b/tools/gnu/classpath/tools/doclets/PackageGroup.java
new file mode 100644
index 000000000..a005b16fe
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/PackageGroup.java
@@ -0,0 +1,41 @@
+/* gnu.classpath.tools.doclets.PackageGroup
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.doclets;
+
+import java.util.SortedSet;
+
+/**
+ * Stores a package group given on the command line.
+ */
+public class PackageGroup
+{
+ private String name;
+ private SortedSet packages; // contains PackageDoc
+
+ public PackageGroup(String name, SortedSet packages)
+ {
+ this.name = name;
+ this.packages = packages;
+ }
+
+ public String getName() { return name; }
+ public SortedSet getPackages() { return packages; }
+}
diff --git a/tools/gnu/classpath/tools/doclets/PackageMatcher.java b/tools/gnu/classpath/tools/doclets/PackageMatcher.java
new file mode 100644
index 000000000..23da79cb3
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/PackageMatcher.java
@@ -0,0 +1,135 @@
+/* gnu.classpath.tools.doclets.PackageMatcher
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.doclets;
+
+import java.util.Iterator;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import com.sun.javadoc.PackageDoc;
+
+/**
+ * Filters a set of packages according to a set of wildcards.
+ */
+public class PackageMatcher
+{
+ private Set patterns = new HashSet();
+
+ /**
+ * Add a wildcard to be matched. Wildcards can contain asterisk
+ * characters which match zero or more characters.
+ *
+ * @throw InvalidPackageWildcardException if the wildcard cannot
+ * match any valid package name.
+ */
+ public void addWildcard(String wildcard)
+ throws InvalidPackageWildcardException
+ {
+ final int STATE_ID_START = 0;
+ final int STATE_ID = 1;
+
+ int state = STATE_ID_START;
+
+ char[] wildcardChars = wildcard.toCharArray();
+ StringBuffer regexString = new StringBuffer();
+
+ for (int i=0; i<wildcardChars.length; ++i) {
+ char c = wildcardChars[i];
+ switch (state) {
+ case STATE_ID_START:
+ if ('*' == c) {
+ regexString.append(".*");
+ }
+ else if (Character.isJavaIdentifierStart(c)) {
+ regexString.append(c);
+ }
+ else {
+ throw new InvalidPackageWildcardException(wildcard);
+ }
+ state = STATE_ID;
+ break;
+
+ case STATE_ID:
+ if ('.' == c) {
+ regexString.append("\\.");
+ state = STATE_ID_START;
+ }
+ else if ('*' == c) {
+ regexString.append(".*");
+ }
+ else if (Character.isJavaIdentifierPart(c)) {
+ regexString.append(c);
+ }
+ else {
+ throw new InvalidPackageWildcardException(wildcard);
+ }
+ }
+ }
+ if (STATE_ID_START == state) {
+ throw new InvalidPackageWildcardException(wildcard);
+ }
+
+ patterns.add(Pattern.compile(regexString.toString()));
+ }
+
+ /**
+ * Return a sorted, filtered set of packages. A package from the
+ * array given will be put into the output list if it matches one
+ * or more of the wildcards added to this PackageMatcher before.
+ */
+ public SortedSet filter(PackageDoc[] packageDocs)
+ {
+ SortedSet result = new TreeSet();
+ for (int i=0; i<packageDocs.length; ++i) {
+ if (match(packageDocs[i])) {
+ result.add(packageDocs[i]);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Return true when the given PackageDoc matches one or more of
+ * the wildcard added to this PackageMatcher before.
+ */
+ public boolean match(PackageDoc packageDoc)
+ {
+ Iterator it = patterns.iterator();
+ while (it.hasNext()) {
+ Pattern pattern = (Pattern)it.next();
+ Matcher matcher = pattern.matcher(packageDoc.name());
+ if (matcher.matches()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public String toString()
+ {
+ return "PackageMatcher{patterns=" + patterns + "}";
+ }
+}
diff --git a/tools/gnu/classpath/tools/doclets/StandardTaglet.java b/tools/gnu/classpath/tools/doclets/StandardTaglet.java
new file mode 100644
index 000000000..86a6a4ed0
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/StandardTaglet.java
@@ -0,0 +1,83 @@
+/* gnu.classpath.tools.doclets.StandardTaglet
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.doclets;
+
+import com.sun.javadoc.Tag;
+import com.sun.tools.doclets.Taglet;
+
+/**
+ * Represents one of the built-in taglets. Used for specifying taglet
+ * order.
+ */
+public class StandardTaglet
+ implements Taglet
+{
+ private String name;
+
+ /**
+ * Initialize with one of the built-in taglet names.
+ */
+ public StandardTaglet(String name) {
+ this.name = name;
+ }
+
+ public boolean inField() {
+ return true;
+ }
+
+ public boolean inConstructor() {
+ return true;
+ }
+
+ public boolean inMethod() {
+ return true;
+ }
+
+ public boolean inOverview() {
+ return true;
+ }
+
+ public boolean inPackage() {
+ return true;
+ }
+
+ public boolean inType() {
+ return true;
+ }
+
+ public boolean isInlineTag() {
+ return false;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public String toString(Tag tag) {
+ //assert(false);
+ return null;
+ }
+
+ public String toString(Tag[] tags) {
+ //assert(false);
+ return null;
+ }
+}
diff --git a/tools/gnu/classpath/tools/doclets/TagletPrinter.java b/tools/gnu/classpath/tools/doclets/TagletPrinter.java
new file mode 100644
index 000000000..e62636985
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/TagletPrinter.java
@@ -0,0 +1,30 @@
+/* gnu.classpath.tools.doclets.TagletPrinter
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.doclets;
+
+/**
+ * Call-back interface for taglet string output.
+ */
+public interface TagletPrinter
+{
+ public void printTagletString(String s);
+}
+
diff --git a/tools/gnu/classpath/tools/doclets/debugdoclet/.cvsignore b/tools/gnu/classpath/tools/doclets/debugdoclet/.cvsignore
new file mode 100644
index 000000000..74e8a83b2
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/debugdoclet/.cvsignore
@@ -0,0 +1,4 @@
+.deps
+.dirstamp
+.libs
+*.lo
diff --git a/tools/gnu/classpath/tools/doclets/debugdoclet/DebugDoclet.java b/tools/gnu/classpath/tools/doclets/debugdoclet/DebugDoclet.java
new file mode 100644
index 000000000..63026de42
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/debugdoclet/DebugDoclet.java
@@ -0,0 +1,137 @@
+package gnu.classpath.tools.doclets.debugdoclet;
+
+import com.sun.javadoc.ClassDoc;
+import com.sun.javadoc.FieldDoc;
+import com.sun.javadoc.MethodDoc;
+import com.sun.javadoc.PackageDoc;
+import com.sun.javadoc.RootDoc;
+import com.sun.javadoc.Tag;
+
+import java.io.PrintStream;
+
+import java.util.Arrays;
+
+public class DebugDoclet
+{
+ public static boolean start(RootDoc rootDoc)
+ {
+ new DebugDoclet().run(rootDoc);
+ return true;
+ }
+
+ private PrintStream out;
+
+ public DebugDoclet()
+ {
+ out = System.out;
+ }
+
+ private void printHeader(String header)
+ {
+ out.println();
+ out.println("******** " + header + " ********");
+ out.println();
+ }
+
+ private void printSubHeader(String header)
+ {
+ out.println();
+ out.println("======== " + header + " ========");
+ out.println();
+ }
+
+ private void printSub2Header(String header)
+ {
+ out.println();
+ out.println("-------- " + header + " --------");
+ out.println();
+ }
+
+ private void run(RootDoc rootDoc)
+ {
+ printHeader("Overview");
+
+ printSubHeader("Specified Packages");
+
+ PackageDoc[] specifiedPackages = rootDoc.specifiedPackages();
+ Arrays.sort(specifiedPackages);
+ for (int i=0; i<specifiedPackages.length; ++i) {
+ out.println(specifiedPackages[i].name());
+ }
+
+ printSubHeader("Specified Classes");
+
+ ClassDoc[] specifiedClasses = rootDoc.specifiedClasses();
+ Arrays.sort(specifiedClasses);
+ for (int i=0; i<specifiedClasses.length; ++i) {
+ out.println(specifiedClasses[i].qualifiedTypeName());
+ }
+ printSubHeader("Classes");
+
+ ClassDoc[] classes = rootDoc.classes();
+ Arrays.sort(classes);
+ for (int i=0; i<classes.length; ++i) {
+ out.println(classes[i].qualifiedTypeName());
+ }
+
+ printHeader("Class Detail");
+
+ for (int i=0; i<classes.length; ++i) {
+ printSubHeader(classes[i].qualifiedTypeName());
+
+ printTags(classes[i].firstSentenceTags());
+
+ printSub2Header("Methods");
+
+ MethodDoc[] methods = classes[i].methods();
+
+ for (int j=0; j<methods.length; ++j) {
+ out.println("name: \"" + methods[j].name() + "\"");
+ out.println("signature: \"" + methods[j].signature() + "\"");
+ out.println("modifiers: \"" + methods[j].modifiers() + "\"");
+ out.print("throws: ");
+ ClassDoc[] thrownExceptions = methods[j].thrownExceptions();
+ for (int k=0; k<thrownExceptions.length; ++k) {
+ if (k>0) { out.print(", "); }
+ out.print(thrownExceptions[k].qualifiedTypeName());
+ }
+ out.println();
+ }
+
+ printSub2Header("Fields");
+
+ FieldDoc[] fields = classes[i].fields();
+
+ for (int j=0; j<fields.length; ++j) {
+ out.println("name: \"" + fields[j].name() + "\"");
+ out.println("modifiers: \"" + fields[j].modifiers() + "\"");
+ out.println();
+ }
+
+ printSub2Header("Serializable Fields");
+
+ FieldDoc[] sfields = classes[i].serializableFields();
+
+ for (int j=0; j<sfields.length; ++j) {
+ out.println("name: \"" + sfields[j].name() + "\"");
+ out.println("modifiers: \"" + sfields[j].modifiers() + "\"");
+ out.println();
+ }
+ }
+ }
+
+ private void printTag(Tag tag)
+ {
+ if (null != tag.text()) {
+ System.out.println(tag.text());
+ }
+ }
+
+ private void printTags(Tag[] tags)
+ {
+ for (int i=0; i<tags.length; ++i) {
+ out.println("Tag #" + (i+1) + ":");
+ printTag(tags[i]);
+ }
+ }
+}
diff --git a/tools/gnu/classpath/tools/doclets/htmldoclet/.cvsignore b/tools/gnu/classpath/tools/doclets/htmldoclet/.cvsignore
new file mode 100644
index 000000000..74e8a83b2
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/htmldoclet/.cvsignore
@@ -0,0 +1,4 @@
+.deps
+.dirstamp
+.libs
+*.lo
diff --git a/tools/gnu/classpath/tools/doclets/htmldoclet/CssClass.java b/tools/gnu/classpath/tools/doclets/htmldoclet/CssClass.java
new file mode 100644
index 000000000..508675981
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/htmldoclet/CssClass.java
@@ -0,0 +1,283 @@
+/* gnu.classpath.tools.doclets.htmldoclet.CssClass
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.doclets.htmldoclet;
+
+/**
+ * Represents a CSS (Cascading Stylesheet) class. Supports
+ * substituting <code>div</code> and <code>span</code> tags by more
+ * specialized HTML tags.
+ */
+public class CssClass
+{
+ public static final CssClass BODY_MENU_PACKAGES = new CssClass("menu packages");
+ public static final CssClass BODY_MENU_CLASSES = new CssClass("menu classes");
+ public static final CssClass BODY_CONTENT_CLASS = new CssClass("content class");
+ public static final CssClass BODY_CONTENT_DEPRECATED = new CssClass("content deprecated");
+ public static final CssClass BODY_CONTENT_PACKAGE = new CssClass("content package");
+ public static final CssClass BODY_CONTENT_OVERVIEW = new CssClass("content overview");
+ public static final CssClass BODY_CONTENT_ABOUT = new CssClass("content about");
+ public static final CssClass BODY_CONTENT_HELP = new CssClass("content help");
+ public static final CssClass BODY_CONTENT_PACKAGE_TREE = new CssClass("content packagetree");
+ public static final CssClass BODY_CONTENT_FULL_TREE = new CssClass("content fulltree");
+ public static final CssClass BODY_CONTENT_INDEX = new CssClass("content index");
+ public static final CssClass BODY_CONTENT_USES = new CssClass("content uses");
+ public static final CssClass BODY_CONTENT_SOURCE = new CssClass("content source");
+
+ public static final CssClass OVERVIEW_TITLE = new CssClass("overview title", "h1");
+ public static final CssClass OVERVIEW_SUMMARY = new CssClass("overview summary");
+ public static final CssClass OVERVIEW_SUMMARY_LEFT = new CssClass("left");
+ public static final CssClass OVERVIEW_SUMMARY_RIGHT = new CssClass("right");
+ public static final CssClass OVERVIEW_DESCRIPTION_TOP = new CssClass("overview description top");
+ public static final CssClass OVERVIEW_DESCRIPTION_FULL = new CssClass("overview description full");
+
+ public static final CssClass DEPRECATION_TITLE = new CssClass("deprecation title", "h1");
+ public static final CssClass DEPRECATION_SUMMARY = new CssClass("summary");
+ public static final CssClass DEPRECATION_SUMMARY_LEFT = new CssClass("left");
+ public static final CssClass DEPRECATION_SUMMARY_DESCRIPTION = new CssClass("description");
+ public static final CssClass DEPRECATION_TOC = new CssClass("dep-toc");
+ public static final CssClass DEPRECATION_TOC_HEADER = new CssClass("header", "h3");
+ public static final CssClass DEPRECATION_TOC_LIST = new CssClass("list", "ul");
+ public static final CssClass DEPRECATION_TOC_ENTRY = new CssClass("entry", "li");
+ public static final CssClass DEPRECATION_EMPTY = new CssClass("dep-empty", "p");
+ public static final CssClass DEPRECATION_LIST = new CssClass("dep-list", "div");
+
+ public static final CssClass SERIALIZED_TITLE = new CssClass("serialized title", "h1");
+ public static final CssClass SERIALIZED_PACKAGE_HEADER = new CssClass("serialized package header", "h2");
+ public static final CssClass SERIALIZED_CLASS_HEADER = new CssClass("serialized class header", "h3");
+ public static final CssClass SERIALIZED_SVUID_OUTER = new CssClass("serialized svuid outer", "p");
+ public static final CssClass SERIALIZED_SVUID_HEADER = new CssClass("serialized svuid header", "b");
+ public static final CssClass SERIALIZED_SVUID_VALUE = new CssClass("serialized svuid header");
+ public static final CssClass SERIALIZED_SECTION = new CssClass("serialized section");
+ public static final CssClass SERIALIZED_SECTION_HEADER = new CssClass("serialized section header", "h4");
+
+ public static final CssClass PACKAGE_TITLE = new CssClass("package title", "h1");
+ public static final CssClass PACKAGE_SUMMARY = new CssClass("package summary");
+ public static final CssClass PACKAGE_SUMMARY_LEFT = new CssClass("left");
+ public static final CssClass PACKAGE_SUMMARY_RIGHT = new CssClass("right");
+ public static final CssClass PACKAGE_DESCRIPTION_TOP = new CssClass("package description top");
+ public static final CssClass PACKAGE_DESCRIPTION_FULL = new CssClass("package description full");
+ public static final CssClass PACKAGE_TREE_TITLE = new CssClass("package tree title", "h1");
+ public static final CssClass PACKAGE_TREE_SECTION_TITLE = new CssClass("package tree section title", "h2");
+ public static final CssClass PACKAGE_TREE = new CssClass("tree", "ul");
+
+ public static final CssClass TREE_LINK = new CssClass("tree link", "b");
+
+ public static final CssClass FULL_TREE_PACKAGELIST = new CssClass("fulltree package list", "dl");
+ public static final CssClass FULL_TREE_PACKAGELIST_HEADER = new CssClass("fulltree package header", "dt", "b");
+ public static final CssClass FULL_TREE_PACKAGELIST_ITEM = new CssClass("fulltree package item", "dd");
+
+ public static final CssClass PACKAGE_MENU_LIST = new CssClass("package menu-list", "div");
+ public static final CssClass PACKAGE_MENU_ENTRY = new CssClass("package menu-entry");
+ public static final CssClass PACKAGE_MENU_TITLE = new CssClass("package menu-title", "h4");
+
+ public static final CssClass CLASS_MENU_LIST = new CssClass("classes menu-list", "div");
+ public static final CssClass CLASS_MENU_TITLE = new CssClass("classes menu-title", "h4");
+ public static final CssClass CLASS_MENU_SUBTITLE = new CssClass("classes menu-subtitle", "p");
+ public static final CssClass CLASS_MENU_ENTRY_CLASS = new CssClass("classes menu-entry class");
+ public static final CssClass CLASS_MENU_ENTRY_INTERFACE = new CssClass("classes menu-entry interface", "i");
+
+ public static final CssClass INDEX_TITLE = new CssClass("index title", "h1");
+ public static final CssClass INDEX_CATEGORY = new CssClass("index category");
+ public static final CssClass INDEX_CATEGORY_HEADER = new CssClass("index category header", "h2");
+ public static final CssClass INDEX_ENTRY = new CssClass("index entry");
+ public static final CssClass INDEX_ENTRY_DESCRIPTION = new CssClass("description");
+ public static final CssClass INDEX_ENTRY_KEY = new CssClass("key");
+ public static final CssClass INDEX_LETTERS = new CssClass("index letters");
+ public static final CssClass INDEX_LETTER = new CssClass("index letter");
+ public static final CssClass INDEX_LETTER_SPACER = new CssClass("index letter spacer");
+
+ public static final CssClass CLASS_TITLE = new CssClass("class title outer");
+ public static final CssClass CLASS_TITLE_PACKAGE = new CssClass("class title-package", "h3");
+ public static final CssClass CLASS_TITLE_CLASS = new CssClass("class title-class", "h1");
+ public static final CssClass CLASS_SUBCLASSES = new CssClass("class subclasses", "dl");
+ public static final CssClass CLASS_SUBCLASSES_HEADER = new CssClass("class subclasses header", "dt", "b");
+ public static final CssClass CLASS_SUBCLASSES_ITEM = new CssClass("class subclasses header", "dd");
+ public static final CssClass CLASS_ENCLOSINGCLASS = new CssClass("class enclosing", "dl");
+ public static final CssClass CLASS_ENCLOSINGCLASS_HEADER = new CssClass("class enclosing header", "dt", "b");
+ public static final CssClass CLASS_ENCLOSINGCLASS_ITEM = new CssClass("class enclosing item", "dd");
+ public static final CssClass CLASS_KNOWNIMPLEMENTING = new CssClass("class knownimplementing", "dl");
+ public static final CssClass CLASS_KNOWNIMPLEMENTING_HEADER = new CssClass("header", "dt", "b");
+ public static final CssClass CLASS_KNOWNIMPLEMENTING_ITEM = new CssClass("item", "dd");
+ public static final CssClass CLASS_INHERITANCETREE = new CssClass("class inheritance-tree");
+ public static final CssClass CLASS_SYNOPSIS = new CssClass("class synopsis outer");
+ public static final CssClass CLASS_SYNOPSIS_NAME = new CssClass("class synopsis name", "b");
+ public static final CssClass CLASS_SYNOPSIS_DECLARATION = new CssClass("class synopsis declaration", "div", "code");
+ public static final CssClass CLASS_SYNOPSIS_SUPERCLASS = new CssClass("class synopsis superclass", "div", "code");
+ public static final CssClass CLASS_SYNOPSIS_IMPLEMENTS = new CssClass("class synopsis implements", "div", "code");
+ public static final CssClass CLASS_DESCRIPTION = new CssClass("class description");
+ public static final CssClass CLASS_SUMMARY = new CssClass("class summary");
+ public static final CssClass CLASS_SUMMARY_LEFT = new CssClass("left", new String[] { "valign" }, new String[] { "top" });
+ public static final CssClass CLASS_SUMMARY_LEFT_SYNOPSIS = new CssClass("synopsis", "code");
+ public static final CssClass CLASS_SUMMARY_RIGHT = new CssClass("right");
+ public static final CssClass CLASS_SUMMARY_RIGHT_LIST = new CssClass("list", "dl");
+ public static final CssClass CLASS_SUMMARY_RIGHT_SYNOPSIS = new CssClass("synopsis", "dt", "code");
+ public static final CssClass CLASS_SUMMARY_RIGHT_DESCRIPTION = new CssClass("description", "dd");
+ public static final CssClass CLASS_SUMMARY_INHERITED = new CssClass("inherited");
+ public static final CssClass CLASS_SUMMARY_INHERITED_MEMBER = new CssClass("member", "code");
+ public static final CssClass CLASS_BOILERPLATE = new CssClass("boilerplate", "pre", new String[] { "style" }, new String[] { "font-size: x-small;" });
+
+ public static final CssClass USAGE_TITLE = new CssClass("usage title", "h1");
+ public static final CssClass USAGE_PACKAGE_TITLE = new CssClass("usage package title", "h2");
+ public static final CssClass USAGE_USAGE_TITLE = new CssClass("usage usage title", "h3");
+ public static final CssClass USAGE_SUMMARY = new CssClass("usage summary");
+ public static final CssClass USAGE_SUMMARY_LEFT = new CssClass("left");
+ public static final CssClass USAGE_SUMMARY_RIGHT = new CssClass("right");
+ public static final CssClass USAGE_SUMMARY_SYNOPSIS = new CssClass("synopsis");
+ public static final CssClass USAGE_SUMMARY_DESCRIPTION = new CssClass("description");
+ public static final CssClass USAGE_TABLE_HEADER = new CssClass("table header", "h3");
+ public static final CssClass USAGE_EMPTY = new CssClass("usage empty", "p");
+
+ public static final CssClass MEMBER_DETAIL = new CssClass("member detail outer");
+ public static final CssClass MEMBER_DETAIL_NAME = new CssClass("member detail name", "h3");
+ public static final CssClass MEMBER_DETAIL_BODY = new CssClass("member detail name", "blockquote");
+ public static final CssClass MEMBER_DETAIL_SYNOPSIS = new CssClass("member detail synopsis", "pre");
+ public static final CssClass MEMBER_DETAIL_DESCRIPTION = new CssClass("member detail description");
+ public static final CssClass MEMBER_DETAIL_SPECIFIED_BY_LIST = new CssClass("member detail specified by list", "dl");
+ public static final CssClass MEMBER_DETAIL_SPECIFIED_BY_HEADER = new CssClass("member detail specified by header", "dt", "b");
+ public static final CssClass MEMBER_DETAIL_SPECIFIED_BY_ITEM = new CssClass("member detail specified by item", "dd");
+ public static final CssClass MEMBER_DETAIL_OVERRIDDEN_LIST = new CssClass("member detail overridden list", "dl");
+ public static final CssClass MEMBER_DETAIL_OVERRIDDEN_HEADER = new CssClass("member detail overridden header", "dt", "b");
+ public static final CssClass MEMBER_DETAIL_OVERRIDDEN_ITEM = new CssClass("member detail overridden item", "dd");
+ public static final CssClass MEMBER_DETAIL_PARAMETER_LIST = new CssClass("parameter", "div", "dl");
+ public static final CssClass MEMBER_DETAIL_PARAMETER_HEADER = new CssClass("header", "dt", "b");
+ public static final CssClass MEMBER_DETAIL_PARAMETER_ITEM = new CssClass("item", "dd");
+ public static final CssClass MEMBER_DETAIL_PARAMETER_ITEM_NAME = new CssClass("name", "code");
+ public static final CssClass MEMBER_DETAIL_PARAMETER_ITEM_SEPARATOR = new CssClass("separator");
+ public static final CssClass MEMBER_DETAIL_PARAMETER_ITEM_DESCRIPTION = new CssClass("description");
+ public static final CssClass MEMBER_DETAIL_RETURN_LIST = new CssClass("member detail return list", "div", "dl");
+ public static final CssClass MEMBER_DETAIL_RETURN_HEADER = new CssClass("member detail return header", "dt", "b");
+ public static final CssClass MEMBER_DETAIL_RETURN_ITEM = new CssClass("member detail return item", "dd");
+ public static final CssClass MEMBER_DETAIL_THROWN_LIST = new CssClass("member detail thrown list", "div", "dl");
+ public static final CssClass MEMBER_DETAIL_THROWN_HEADER = new CssClass("member detail thrown header", "dt", "b");
+ public static final CssClass MEMBER_DETAIL_THROWN_ITEM = new CssClass("member detail thrown item", "dd");
+ public static final CssClass MEMBER_DETAIL_THROWN_ITEM_NAME = new CssClass("name", "code");
+ public static final CssClass MEMBER_DETAIL_THROWN_ITEM_SEPARATOR = new CssClass("separator");
+ public static final CssClass MEMBER_DETAIL_THROWN_ITEM_DESCRIPTION = new CssClass("description");
+
+ public static final CssClass TABLE_HEADER = new CssClass("table header", "h2");
+ public static final CssClass TABLE_SUB_HEADER = new CssClass("table sub header", "h3");
+ public static final CssClass TABLE_CONTAINER = new CssClass("table container", "dl", "dd");
+
+ public static final CssClass SECTION = new CssClass("section", "div");
+ public static final CssClass SECTION_HEADER = new CssClass("section header", "h2");
+
+ public static final CssClass NAVBAR_TOP = new CssClass("navbar div top");
+ public static final CssClass NAVBAR_TOP_NAVI = new CssClass("navi");
+ public static final CssClass NAVBAR_TOP_HEADER = new CssClass("header", new String[] { "rowspan" }, new String[] { "2" });
+ public static final CssClass NAVBAR_BOTTOM = new CssClass("navbar div bottom");
+ public static final CssClass NAVBAR_BOTTOM_SPACER = new CssClass("navbar bottom spacer", "p");
+ public static final CssClass NAVBAR_ITEM_ENABLED = new CssClass("navbar item enabled");
+ public static final CssClass NAVBAR_ITEM_DISABLED = new CssClass("navbar item disabled");
+ public static final CssClass NAVBAR_ITEM_ACTIVE = new CssClass("navbar item active");
+
+ public static final CssClass TAGLET = new CssClass("taglet", "div");
+
+ public static final CssClass ABOUT_TITLE = new CssClass("about title", "h1");
+ public static final CssClass ABOUT_GENERATOR = new CssClass("about generator", "p");
+
+ public static final CssClass SOURCE = new CssClass("source body");
+ public static final CssClass SOURCE_TITLE = new CssClass("source title", "h1");
+
+ public static final CssClass DEPRECATED = new CssClass("deprecated", "span");
+ public static final CssClass DEPRECATED_INLINE = new CssClass("deprecated", "p");
+ public static final CssClass DEPRECATED_HEADER = new CssClass("deprecated header", "b");
+ public static final CssClass DEPRECATED_BODY = new CssClass("deprecated", "i");
+
+ private String name;
+ private String elementName;
+ private String innerElementName;
+ private String[] attributeNames;
+ private String[] attributeValues;
+
+ private CssClass(String name)
+ {
+ this(name, null);
+ }
+
+ private CssClass(String name, String elementName)
+ {
+ this(name, elementName, null);
+ }
+
+ private CssClass(String name, String elementName, String innerElementName)
+ {
+ this(name, elementName, innerElementName, null, null);
+ }
+
+ private CssClass(String name, String elementName, String[] attributeNames, String[] attributeValues)
+ {
+ this(name, null, null, attributeNames, attributeValues);
+ }
+
+ private CssClass(String name, String[] attributeNames, String[] attributeValues)
+ {
+ this(name, null, null, attributeNames, attributeValues);
+ }
+
+ private CssClass(String name, String elementName, String innerElementName, String[] attributeNames, String[] attributeValues)
+ {
+ this.name = name;
+ this.elementName = elementName;
+ this.innerElementName = innerElementName;
+ this.attributeNames = attributeNames;
+ this.attributeValues = attributeValues;
+ }
+
+ public String getSpanElementName()
+ {
+ if (null != this.elementName) {
+ return this.elementName;
+ }
+ else {
+ return "span";
+ }
+ }
+
+ public String getDivElementName()
+ {
+ if (null != this.elementName) {
+ return this.elementName;
+ }
+ else {
+ return "div";
+ }
+ }
+
+ public String getInnerElementName()
+ {
+ return this.innerElementName;
+ }
+
+ public String[] getAttributeNames()
+ {
+ return this.attributeNames;
+ }
+
+ public String[] getAttributeValues()
+ {
+ return this.attributeValues;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+}
diff --git a/tools/gnu/classpath/tools/doclets/htmldoclet/ExternalDocSet.java b/tools/gnu/classpath/tools/doclets/htmldoclet/ExternalDocSet.java
new file mode 100644
index 000000000..7fd2fa062
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/htmldoclet/ExternalDocSet.java
@@ -0,0 +1,170 @@
+/* gnu.classpath.tools.doclets.htmldoclet.ExternalDocSet
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.doclets.htmldoclet;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import java.util.HashSet;
+import java.util.Properties;
+import java.util.Set;
+
+import com.sun.javadoc.ClassDoc;
+
+public class ExternalDocSet
+{
+ private String url;
+ private String packageListDir;
+ private URL docSetDirectoryURL;
+
+ public String getPackageListDir()
+ {
+ return packageListDir;
+ }
+
+ public ExternalDocSet(String url,
+ String packageListDir)
+ {
+ this.url = url;
+ this.packageListDir = packageListDir;
+ }
+
+ private Set packageNames = new HashSet();
+ private boolean javadocCompatible;
+
+ public void load(File targetDirectory)
+ throws IOException, MalformedURLException
+ {
+ if (!url.endsWith("/")) {
+ url += "/";
+ }
+
+ this.docSetDirectoryURL = new URL(targetDirectory.toURL(),
+ url);
+
+ URL packageListDirURL;
+ if (null != packageListDir) {
+ if (!packageListDir.endsWith("/")) {
+ packageListDir += "/";
+ }
+ packageListDirURL = new URL(new File(System.getProperty("user.dir")).toURL(),
+ packageListDir);
+ }
+ else {
+ packageListDirURL = docSetDirectoryURL;
+ }
+
+ URL packageListURL = new URL(packageListDirURL,
+ "package-list");
+ InputStream in = packageListURL.openStream();
+ if (null != in) {
+ readPackages(in);
+ in.close();
+ }
+ else {
+ throw new FileNotFoundException(packageListURL.toString());
+ }
+
+ URL gjdocPropertiesURL = new URL(packageListDirURL,
+ "gjdoc.properties");
+ try {
+ InputStream propertiesIn = gjdocPropertiesURL.openStream();
+ if (null != in) {
+ Properties properties = new Properties();
+ properties.load(propertiesIn);
+ propertiesIn.close();
+
+ String gjdocCompatProperty = properties.getProperty("gjdoc.compat");
+ if (null != gjdocCompatProperty) {
+ javadocCompatible = "true".equals(properties.getProperty("gjdoc.compat"));
+ }
+ else {
+ javadocCompatible = true;
+ }
+ }
+ else {
+ javadocCompatible = true;
+ }
+ }
+ catch (FileNotFoundException e) {
+ javadocCompatible = true;
+ }
+ }
+
+ public String getPackageDocURL(String packageName)
+ {
+ try {
+ URL packageURL = new URL(docSetDirectoryURL,
+ packageName.replace('.', '/'));
+ return packageURL.toString();
+ }
+ catch (MalformedURLException e) {
+ // This should not happen since we know that packageName is a
+ // proper Java identifiers, so the resulting URL can't be
+ // invalid
+ throw new RuntimeException(e);
+ }
+ }
+
+ public String getClassDocURL(String packageName, String typeName)
+ {
+ try {
+ URL fileURL = new URL(docSetDirectoryURL,
+ packageName.replace('.', '/') + "/" + typeName + ".html");
+ return fileURL.toString();
+ }
+ catch (MalformedURLException e) {
+ // This should not happen since we know that packageName and
+ // typeName are proper Java identifiers, so the resulting URL
+ // can't be invalid
+ throw new RuntimeException(e);
+ }
+ }
+
+ protected void readPackages(InputStream in)
+ throws IOException
+ {
+ BufferedReader reader
+ = new BufferedReader(new InputStreamReader(in, "UTF-8"));
+ String line;
+ while ((line = reader.readLine()) != null) {
+ line = line.trim();
+ packageNames.add(line);
+ }
+ }
+
+ public Set getPackageNames()
+ {
+ return packageNames;
+ }
+
+ public boolean isJavadocCompatible()
+ {
+ return javadocCompatible;
+ }
+}
diff --git a/tools/gnu/classpath/tools/doclets/htmldoclet/HtmlDoclet.java b/tools/gnu/classpath/tools/doclets/htmldoclet/HtmlDoclet.java
new file mode 100644
index 000000000..837333ddf
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/htmldoclet/HtmlDoclet.java
@@ -0,0 +1,3883 @@
+/* gnu.classpath.tools.doclets.htmldoclet.HtmlDoclet
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.doclets.htmldoclet;
+
+import gnu.classpath.tools.IOToolkit;
+
+import gnu.classpath.tools.doclets.AbstractDoclet;
+import gnu.classpath.tools.doclets.DocletConfigurationException;
+import gnu.classpath.tools.doclets.DocletOption;
+import gnu.classpath.tools.doclets.DocletOptionFile;
+import gnu.classpath.tools.doclets.DocletOptionFlag;
+import gnu.classpath.tools.doclets.DocletOptionString;
+import gnu.classpath.tools.doclets.PackageGroup;
+import gnu.classpath.tools.doclets.TagletPrinter;
+import gnu.classpath.tools.doclets.InlineTagRenderer;
+
+import gnu.classpath.tools.doclets.xmldoclet.HtmlRepairer;
+
+import gnu.classpath.tools.taglets.GnuExtendedTaglet;
+import gnu.classpath.tools.taglets.TagletContext;
+
+import gnu.classpath.tools.java2xhtml.Java2xhtml;
+
+import gnu.classpath.tools.StringToolkit;
+
+import com.sun.javadoc.*;
+import com.sun.tools.doclets.Taglet;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import java.net.MalformedURLException;
+
+import java.nio.charset.Charset;
+
+import java.text.DateFormat;
+import java.text.MessageFormat;
+
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TimeZone;
+import java.util.TreeSet;
+
+public class HtmlDoclet
+ extends AbstractDoclet
+ implements InlineTagRenderer
+{
+ private static String filenameExtension = ".html";
+
+ /**
+ * Contains ExternalDocSet.
+ */
+ private List externalDocSets = new LinkedList();
+
+ /**
+ * Contains String->ExternalDocSet.
+ */
+ private Map packageNameToDocSet = new HashMap();
+
+ /**
+ * Cache for version string from resource /version.properties
+ */
+ private String docletVersion;
+
+ /**
+ * For now, do not output a help page.
+ */
+ private static final boolean outputHelpPage = false;
+
+ /**
+ * Stores the output encoding (either the one specified using
+ * -charset, or the platform default encoding).
+ */
+ private String outputCharset;
+
+ private void printNavBar(HtmlPage output, String currentPage, ClassDoc currentClass)
+ {
+ output.beginDiv(CssClass.NAVBAR_TOP);
+
+ boolean overviewLevel
+ = ("overview".equals(currentPage)
+ || "full-tree".equals(currentPage)
+ || "index".equals(currentPage)
+ || "split-index".equals(currentPage)
+ || "serialized".equals(currentPage)
+ || "deprecated".equals(currentPage)
+ || "about".equals(currentPage)
+ );
+
+ if (!isSinglePackage()) {
+ if ("overview".equals(currentPage)) {
+ output.beginSpan(CssClass.NAVBAR_ITEM_ACTIVE);
+ output.print("Overview");
+ output.endSpan(CssClass.NAVBAR_ITEM_ACTIVE);
+ }
+ else {
+ output.beginSpan(CssClass.NAVBAR_ITEM_ENABLED);
+ output.beginAnchor(output.getPathToRoot() + "/overview-summary" + filenameExtension);
+ output.print("Overview");
+ output.endAnchor();
+ output.endSpan(CssClass.NAVBAR_ITEM_ENABLED);
+ }
+
+ output.print(" ");
+ }
+
+ if (!overviewLevel || isSinglePackage()) {
+ if ("package".equals(currentPage)) {
+ output.beginSpan(CssClass.NAVBAR_ITEM_ACTIVE);
+ output.print("Package");
+ output.endSpan(CssClass.NAVBAR_ITEM_ACTIVE);
+ }
+ else {
+ output.beginSpan(CssClass.NAVBAR_ITEM_ENABLED);
+ String packageHref;
+ if (isSinglePackage()) {
+ packageHref = output.getPathToRoot() + "/" + getPackageURL(getSinglePackage()) + "package-summary" + filenameExtension;
+ }
+ else {
+ packageHref = "package-summary" + filenameExtension;
+ }
+ output.beginAnchor(packageHref);
+ output.print("Package");
+ output.endAnchor();
+ output.endSpan(CssClass.NAVBAR_ITEM_ENABLED);
+ }
+ }
+ else {
+ output.beginSpan(CssClass.NAVBAR_ITEM_DISABLED);
+ output.print("Package");
+ output.endSpan(CssClass.NAVBAR_ITEM_DISABLED);
+ }
+
+ if (optionUse.getValue() || optionLinkSource.getValue()) {
+ output.print(" ");
+
+ if (null != currentClass) {
+ if ("class".equals(currentPage)) {
+ output.beginSpan(CssClass.NAVBAR_ITEM_ACTIVE);
+ output.print("Class");
+ output.endSpan(CssClass.NAVBAR_ITEM_ACTIVE);
+ }
+ else {
+ output.beginSpan(CssClass.NAVBAR_ITEM_ENABLED);
+ output.beginAnchor(currentClass.name() + filenameExtension);
+ output.print("Class");
+ output.endAnchor();
+ output.endSpan(CssClass.NAVBAR_ITEM_ENABLED);
+ }
+ }
+ else {
+ output.beginSpan(CssClass.NAVBAR_ITEM_DISABLED);
+ output.print("Class");
+ output.endSpan(CssClass.NAVBAR_ITEM_DISABLED);
+ }
+
+ if (optionUse.getValue()) {
+ output.print(" ");
+
+ if (null != currentClass) {
+ if ("uses".equals(currentPage)) {
+ output.beginSpan(CssClass.NAVBAR_ITEM_ACTIVE);
+ output.print("Use");
+ output.endSpan(CssClass.NAVBAR_ITEM_ACTIVE);
+ }
+ else {
+ output.beginSpan(CssClass.NAVBAR_ITEM_ENABLED);
+ output.beginAnchor(currentClass.name() + "-uses" + filenameExtension);
+ output.print("Use");
+ output.endAnchor();
+ output.endSpan(CssClass.NAVBAR_ITEM_ENABLED);
+ }
+ }
+ else {
+ output.beginSpan(CssClass.NAVBAR_ITEM_DISABLED);
+ output.print("Use");
+ output.endSpan(CssClass.NAVBAR_ITEM_DISABLED);
+ }
+ }
+
+ if (optionLinkSource.getValue()) {
+ output.print(" ");
+
+
+ if ("source".equals(currentPage)) {
+ output.beginSpan(CssClass.NAVBAR_ITEM_ACTIVE);
+ output.print("Source");
+ output.endSpan(CssClass.NAVBAR_ITEM_ACTIVE);
+ }
+ else {
+
+ if (null != currentClass) {
+
+ output.beginSpan(CssClass.NAVBAR_ITEM_ENABLED);
+ String targetClassName = currentClass.name();
+ String targetAnchor = "";
+ if (null != currentClass.containingClass()) {
+ targetClassName = getOuterClassDoc(currentClass).name();
+ targetAnchor = "#line." + currentClass.position().line();
+ }
+ output.beginAnchor(targetClassName + "-source" + filenameExtension + targetAnchor);
+ output.print("Source");
+ output.endAnchor();
+ output.endSpan(CssClass.NAVBAR_ITEM_ENABLED);
+ }
+ else {
+ output.beginSpan(CssClass.NAVBAR_ITEM_DISABLED);
+ output.print("Source");
+ output.endSpan(CssClass.NAVBAR_ITEM_DISABLED);
+ }
+ }
+ }
+ }
+
+
+ if (!optionNoTree.getValue()) {
+ output.print(" ");
+
+ if ("full-tree".equals(currentPage)
+ || "package-tree".equals(currentPage)) {
+ output.beginSpan(CssClass.NAVBAR_ITEM_ACTIVE);
+ output.print("Tree");
+ output.endSpan(CssClass.NAVBAR_ITEM_ACTIVE);
+ }
+ else {
+ output.beginSpan(CssClass.NAVBAR_ITEM_ENABLED);
+ String treeHref;
+ if (isSinglePackage() && overviewLevel) {
+ treeHref = getPackageURL(getSinglePackage()) + "tree" + filenameExtension;
+ }
+ else {
+ treeHref = "tree" + filenameExtension;
+ }
+
+ output.beginAnchor(treeHref);
+ output.print("Tree");
+ output.endAnchor();
+ output.endSpan(CssClass.NAVBAR_ITEM_ENABLED);
+ }
+ }
+
+ output.print(" ");
+
+ String indexName;
+ if (optionSplitIndex.getValue()) {
+ indexName = "alphaindex-1";
+ }
+ else {
+ indexName = "alphaindex";
+ }
+
+ if ("index".equals(currentPage) || "split-index".equals(currentPage)) {
+ output.beginSpan(CssClass.NAVBAR_ITEM_ACTIVE);
+ output.print("Index");
+ output.endSpan(CssClass.NAVBAR_ITEM_ACTIVE);
+ }
+ else {
+ output.beginSpan(CssClass.NAVBAR_ITEM_ENABLED);
+ output.beginAnchor(output.getPathToRoot() + "/" + indexName + filenameExtension);
+ output.print("Index");
+ output.endAnchor();
+ output.endSpan(CssClass.NAVBAR_ITEM_ENABLED);
+ }
+
+ if (!optionNoDeprecatedList.getValue()) {
+ output.print(" ");
+
+ if ("deprecated".equals(currentPage)) {
+ output.beginSpan(CssClass.NAVBAR_ITEM_ACTIVE);
+ output.print("Deprecated");
+ output.endSpan(CssClass.NAVBAR_ITEM_ACTIVE);
+ }
+ else {
+ output.beginSpan(CssClass.NAVBAR_ITEM_ENABLED);
+ output.beginAnchor(output.getPathToRoot() + "/deprecated" + filenameExtension);
+ output.print("Deprecated");
+ output.endAnchor();
+ output.endSpan(CssClass.NAVBAR_ITEM_ENABLED);
+ }
+ }
+
+ if (outputHelpPage) {
+ if (!optionNoHelp.getValue()) {
+ output.print(" ");
+
+ if ("help".equals(currentPage)) {
+ output.beginSpan(CssClass.NAVBAR_ITEM_ACTIVE);
+ output.print("Help");
+ output.endSpan(CssClass.NAVBAR_ITEM_ACTIVE);
+ }
+ else {
+ output.beginSpan(CssClass.NAVBAR_ITEM_ENABLED);
+ output.beginAnchor(output.getPathToRoot() + "/help" + filenameExtension);
+ output.print("Help");
+ output.endAnchor();
+ output.endSpan(CssClass.NAVBAR_ITEM_ENABLED);
+ }
+ }
+ }
+
+ output.print(" ");
+
+ if ("about".equals(currentPage)) {
+ output.beginSpan(CssClass.NAVBAR_ITEM_ACTIVE);
+ output.print("About");
+ output.endSpan(CssClass.NAVBAR_ITEM_ACTIVE);
+ }
+ else {
+ output.beginSpan(CssClass.NAVBAR_ITEM_ENABLED);
+ output.beginAnchor(output.getPathToRoot() + "/about" + filenameExtension);
+ output.print("About");
+ output.endAnchor();
+ output.endSpan(CssClass.NAVBAR_ITEM_ENABLED);
+ }
+
+ output.endDiv(CssClass.NAVBAR_TOP);
+ }
+
+ private void printNavBarTopRow(HtmlPage output, String currentPage, ClassDoc currentClass)
+ {
+ output.beginRow();
+ output.beginCell(CssClass.NAVBAR_TOP);
+ printNavBar(output, currentPage, currentClass);
+ output.endCell();
+ if (null != optionHeader.getValue()) {
+ output.beginCell(CssClass.NAVBAR_TOP_HEADER);
+ output.print(replaceDocRoot(output, optionHeader.getValue()));
+ output.endCell();
+ }
+ output.endRow();
+ }
+
+ private void printNavBarTopNaviCell(HtmlPage output)
+ {
+ output.beginCell(CssClass.NAVBAR_TOP_NAVI);
+ output.beginAnchor(output.getPathToRoot() + "/index" + filenameExtension, "Show in a frameset", "_top");
+ output.print("Frames");
+ output.endAnchor();
+ output.print(" | ");
+
+ output.beginAnchor(output.getFile().getName(), "Show without frames", "_top");
+ output.print("No Frames");
+ output.endAnchor();
+ output.print(" ");
+
+ output.endCell();
+ }
+
+ private void printNavBarTop(HtmlPage output, String currentPage)
+ {
+ printNavBarTop(output, currentPage, null, null, null);
+ }
+
+ private void printNavBarTop(HtmlPage output, String currentPage,
+ ClassDoc currentClass, Object prev, Object next)
+ {
+ if (!optionNoNavBar.getValue()) {
+ output.beginTable(CssClass.NAVBAR_TOP);
+ printNavBarTopRow(output, currentPage, currentClass);
+ output.beginRow();
+ if ("class".equals(currentPage)) {
+ output.beginCell(CssClass.NAVBAR_TOP_NAVI);
+ ClassDoc prevClass = (ClassDoc)prev;
+ ClassDoc nextClass = (ClassDoc)next;
+ if (null != prevClass) {
+ output.anchor(getClassDocURL(output, prevClass), "Prev Class");
+ }
+ else {
+ output.print("Prev Class");
+ }
+ output.print(" | ");
+ if (null != nextClass) {
+ output.anchor(getClassDocURL(output, nextClass), "Next Class");
+ }
+ else {
+ output.print("Next Class");
+ }
+ output.endCell();
+ }
+ else if ("split-index".equals(currentPage)) {
+ output.beginCell(CssClass.NAVBAR_TOP_NAVI);
+ Integer prevLetter = (Integer)prev;
+ Integer nextLetter = (Integer)next;
+ if (null != prevLetter) {
+ output.anchor("alphaindex-" + prevLetter + filenameExtension, "Prev Letter");
+ }
+ else {
+ output.print("Prev Letter");
+ }
+ output.print(" | ");
+ if (null != nextLetter) {
+ output.anchor("alphaindex-" + nextLetter + filenameExtension, "Next Letter");
+ }
+ else {
+ output.print("Next Letter");
+ }
+ output.endCell();
+ }
+ else {
+ output.beginCell(CssClass.NAVBAR_TOP_NAVI);
+ output.endCell();
+ }
+
+ printNavBarTopNaviCell(output);
+ output.endRow();
+
+ if ("class".equals(currentPage)) {
+ output.beginRow();
+
+ output.beginCell(CssClass.NAVBAR_TOP_NAVI);
+ output.print("Summary: ");
+
+ if (currentClass.innerClasses().length > 0) {
+ output.anchor("#summary-inner", "Nested");
+ }
+ else {
+ output.print("Nested");
+ }
+
+ output.print(" | ");
+
+ if (currentClass.fields().length > 0) {
+ output.anchor("#summary-fields", "Field");
+ }
+ else {
+ output.print("Field");
+ }
+
+ output.print(" | ");
+
+ if (currentClass.methods().length > 0) {
+ output.anchor("#summary-methods", "Method");
+ }
+ else {
+ output.print("Method");
+ }
+
+ output.print(" | ");
+
+ if (currentClass.constructors().length > 0) {
+ output.anchor("#summary-constructors", "Constr");
+ }
+ else {
+ output.print("Constr");
+ }
+
+ output.endCell();
+
+ output.beginCell(CssClass.NAVBAR_TOP_NAVI);
+ output.print("Detail: ");
+
+ if (currentClass.innerClasses().length > 0) {
+ output.anchor("#detail-inner", "Nested");
+ }
+ else {
+ output.print("Nested");
+ }
+
+ output.print(" | ");
+
+ if (currentClass.fields().length > 0) {
+ output.anchor("#detail-fields", "Field");
+ }
+ else {
+ output.print("Field");
+ }
+
+ output.print(" | ");
+
+ if (currentClass.methods().length > 0) {
+ output.anchor("#detail-methods", "Method");
+ }
+ else {
+ output.print("Method");
+ }
+
+ output.print(" | ");
+
+ if (currentClass.constructors().length > 0) {
+ output.anchor("#detail-constructors", "Constr");
+ }
+ else {
+ output.print("Constr");
+ }
+
+ output.endCell();
+ output.endRow();
+ }
+ output.endTable();
+ }
+ }
+
+ private void printNavBarTopPackage(HtmlPage output, String currentPage,
+ PackageDoc prevPackage, PackageDoc nextPackage)
+ {
+ if (!optionNoNavBar.getValue()) {
+ output.beginTable(CssClass.NAVBAR_TOP);
+ printNavBarTopRow(output, currentPage, null);
+
+ output.beginRow();
+ output.beginCell(CssClass.NAVBAR_TOP_NAVI);
+ if (null != prevPackage) {
+ output.anchor(output.getPathToRoot() + "/" + getPackageURL(prevPackage) + "package-summary" + filenameExtension, "Prev Package");
+ }
+ else {
+ output.print("Prev Package");
+ }
+ output.print(" | ");
+ if (null != nextPackage) {
+ output.anchor(output.getPathToRoot() + "/" + getPackageURL(nextPackage) + "package-summary" + filenameExtension, "Next Package");
+ }
+ else {
+ output.print("Next Package");
+ }
+ output.endCell();
+
+ printNavBarTopNaviCell(output);
+ output.endRow();
+
+ output.endTable();
+ }
+ }
+
+ private void printNavBarBottom(HtmlPage output, String currentPage)
+ {
+ printNavBarBottom(output, currentPage, null);
+ }
+
+ private void printNavBarBottom(HtmlPage output, String currentPage, ClassDoc currentClass)
+ {
+ if ("class".equals(currentPage)) {
+ String boilerplate = null;
+ Tag[] boilerplateTags = getOuterClassDoc(currentClass).tags("@boilerplate");
+ if (boilerplateTags.length > 0) {
+ boilerplate = boilerplateTags[0].text();
+ }
+ if (null != boilerplate) {
+ output.hr();
+ output.beginDiv(CssClass.CLASS_BOILERPLATE);
+ output.print(boilerplate);
+ output.endDiv(CssClass.CLASS_BOILERPLATE);
+ output.hr();
+ }
+ }
+
+ if (!optionNoNavBar.getValue()) {
+ output.beginDiv(CssClass.NAVBAR_BOTTOM_SPACER);
+ output.print(" ");
+ output.endDiv(CssClass.NAVBAR_BOTTOM_SPACER);
+ output.beginTable(CssClass.NAVBAR_BOTTOM);
+ output.beginRow();
+ output.beginCell();
+ printNavBar(output, currentPage, currentClass);
+ output.endCell();
+ if (null != optionFooter.getValue()) {
+ output.beginCell();
+ output.print(replaceDocRoot(output, optionFooter.getValue()));
+ output.endCell();
+ }
+ output.endRow();
+ output.endTable();
+ }
+
+ if (null != optionBottom.getValue()) {
+ output.hr();
+ output.print(replaceDocRoot(output, optionBottom.getValue()));
+ }
+ }
+
+ private void printPackagePageClasses(HtmlPage output, ClassDoc[] classDocs, String header)
+ {
+ if (classDocs.length > 0) {
+ output.beginDiv(CssClass.TABLE_CONTAINER);
+ output.beginTable(CssClass.PACKAGE_SUMMARY, new String[] { "border", "width" }, new String[] { "1", "100%" });
+ output.rowDiv(CssClass.TABLE_HEADER, header);
+
+ for (int i=0; i<classDocs.length; ++i) {
+ ClassDoc classDoc = classDocs[i];
+ if (classDoc.isIncluded()) {
+ output.beginRow();
+
+ output.beginCell(CssClass.PACKAGE_SUMMARY_LEFT);
+ printType(output, classDoc);
+ output.endCell();
+
+ output.beginCell(CssClass.PACKAGE_SUMMARY_RIGHT);
+ printTags(output, classDoc, classDoc.firstSentenceTags(), true);
+ output.endCell();
+ output.endRow();
+ }
+ }
+ output.endTable();
+ output.endDiv(CssClass.TABLE_CONTAINER);
+ output.print("\n");
+ }
+ }
+
+ private void printPackagesListFile()
+ throws IOException
+ {
+ PrintWriter out
+ = new PrintWriter(new OutputStreamWriter(new FileOutputStream(new File(getTargetDirectory(),
+ "package-list")),
+ "UTF-8"));
+
+ PackageDoc[] packages = getRootDoc().specifiedPackages();
+ for (int i=0; i<packages.length; ++i) {
+ String packageName = packages[i].name();
+ if (packageName.length() > 0) {
+ out.println(packageName);
+ }
+ }
+
+ out.close();
+ }
+
+ private void printPackagePage(File packageDir, String pathToRoot,
+ PackageDoc packageDoc,
+ PackageDoc prevPackageDoc,
+ PackageDoc nextPackageDoc)
+ throws IOException
+ {
+ HtmlPage output = newHtmlPage(new File(packageDir, "package-summary" + filenameExtension),
+ pathToRoot);
+
+ Set keywords = new LinkedHashSet();
+ keywords.add(packageDoc.name() + " packages");
+
+ output.beginPage(getPageTitle(packageDoc.name()), getOutputCharset(),
+ keywords, getStylesheets());
+ output.beginBody(CssClass.BODY_CONTENT_PACKAGE);
+ printNavBarTopPackage(output, "package", prevPackageDoc, nextPackageDoc);
+
+ output.beginDiv(CssClass.PACKAGE_TITLE);
+ output.print("Package ");
+ if (packageDoc.name().length() > 0) {
+ output.print(packageDoc.name());
+ }
+ else {
+ output.print("&lt;Unnamed&gt;");
+ }
+ output.endDiv(CssClass.PACKAGE_TITLE);
+
+ output.beginDiv(CssClass.PACKAGE_DESCRIPTION_TOP);
+ printTags(output, packageDoc, packageDoc.firstSentenceTags(), true);
+ output.endDiv(CssClass.PACKAGE_DESCRIPTION_TOP);
+
+ printPackagePageClasses(output, packageDoc.interfaces(),
+ "Interface Summary");
+ printPackagePageClasses(output, packageDoc.ordinaryClasses(),
+ "Class Summary");
+ printPackagePageClasses(output, packageDoc.exceptions(),
+ "Exception Summary");
+ printPackagePageClasses(output, packageDoc.errors(),
+ "Error Summary");
+
+ output.anchorName("description");
+ output.beginDiv(CssClass.PACKAGE_DESCRIPTION_FULL);
+ printTags(output, packageDoc, packageDoc.inlineTags(), false);
+ output.endDiv(CssClass.PACKAGE_DESCRIPTION_FULL);
+
+ printNavBarBottom(output, "package");
+ output.endBody();
+ output.endPage();
+ output.close();
+ }
+
+ static class TreeNode
+ implements Comparable
+ {
+ ClassDoc classDoc;
+ SortedSet children = new TreeSet();
+
+ TreeNode(ClassDoc classDoc) {
+ TreeNode.this.classDoc = classDoc;
+ }
+
+ public boolean equals(Object other)
+ {
+ return classDoc.equals(((TreeNode)other).classDoc);
+ }
+
+ public int compareTo(Object other)
+ {
+ return classDoc.compareTo(((TreeNode)other).classDoc);
+ }
+
+ public int hashCode()
+ {
+ return classDoc.hashCode();
+ }
+ }
+
+ private TreeNode addClassTreeNode(Map treeMap, ClassDoc classDoc)
+ {
+ TreeNode node = (TreeNode)treeMap.get(classDoc.qualifiedName());
+ if (null == node) {
+ node = new TreeNode(classDoc);
+ treeMap.put(classDoc.qualifiedName(), node);
+
+ ClassDoc superClassDoc = (ClassDoc)classDoc.superclass();
+ if (null != superClassDoc) {
+ TreeNode parentNode = addClassTreeNode(treeMap, superClassDoc);
+ parentNode.children.add(node);
+ }
+ }
+ return node;
+ }
+
+ private TreeNode addInterfaceTreeNode(Map treeMap, ClassDoc classDoc)
+ {
+ TreeNode node = (TreeNode)treeMap.get(classDoc.qualifiedName());
+ if (null == node) {
+ node = new TreeNode(classDoc);
+ treeMap.put(classDoc.qualifiedName(), node);
+
+ ClassDoc[] superInterfaces = classDoc.interfaces();
+ if (null != superInterfaces && superInterfaces.length > 0) {
+ for (int i=0; i<superInterfaces.length; ++i) {
+ TreeNode parentNode = addInterfaceTreeNode(treeMap, superInterfaces[i]);
+ parentNode.children.add(node);
+ }
+ }
+ else {
+ TreeNode rootNode = (TreeNode)treeMap.get("<root>");
+ if (null == rootNode) {
+ rootNode = new TreeNode(null);
+ treeMap.put("<root>", rootNode);
+ }
+ rootNode.children.add(node);
+ }
+ }
+ return node;
+ }
+
+ private void printPackageTreeRec(HtmlPage output, TreeNode node, TreeNode parentNode)
+ {
+ output.beginElement("li", "class", "node");
+ output.beginElement("div");
+ if (node.classDoc.isIncluded()) {
+ String packageName = node.classDoc.containingPackage().name();
+ if (packageName.length() > 0) {
+ output.print(packageName);
+ output.print(".");
+ }
+ output.beginSpan(CssClass.TREE_LINK);
+ printType(output, node.classDoc);
+ output.endSpan(CssClass.TREE_LINK);
+ }
+ else {
+ output.print(possiblyQualifiedName(node.classDoc));
+ }
+ ClassDoc[] interfaces = node.classDoc.interfaces();
+ ClassDoc parentClassDoc = null;
+ if (null != parentNode) {
+ parentClassDoc = parentNode.classDoc;
+ }
+ if (interfaces.length > 0
+ && !(interfaces.length == 1 && interfaces[0].equals(parentClassDoc))) {
+ if (node.classDoc.isInterface()) {
+ output.print(" (also implements ");
+ }
+ else {
+ output.print(" (implements ");
+ }
+
+ boolean firstItem = true;
+ for (int i=0; i<interfaces.length; ++i) {
+ ClassDoc implemented = interfaces[i];
+ if (!implemented.equals(parentClassDoc)) {
+ if (!firstItem) {
+ output.print(", ");
+ }
+ firstItem = false;
+ if (implemented.isIncluded()) {
+ output.print(implemented.containingPackage().name());
+ output.print(".");
+ printType(output, implemented);
+ }
+ else {
+ output.print(possiblyQualifiedName(implemented));
+ }
+ }
+ }
+ output.print(")");
+ }
+
+ output.endElement("div");
+ output.endElement("li");
+ if (!node.children.isEmpty()) {
+ output.beginElement("li", "class", "level");
+ output.beginElement("ul");
+ Iterator it = node.children.iterator();
+ while (it.hasNext()) {
+ TreeNode child = (TreeNode)it.next();
+ printPackageTreeRec(output, child, node);
+ }
+ output.endElement("ul");
+ output.endElement("li");
+ }
+ }
+
+ private void printClassTree(HtmlPage output, ClassDoc[] classDocs)
+ {
+ Map classTreeMap = new HashMap();
+
+ for (int i=0; i<classDocs.length; ++i) {
+ ClassDoc classDoc = classDocs[i];
+ if (!classDoc.isInterface()) {
+ addClassTreeNode(classTreeMap, classDoc);
+ }
+ }
+
+ TreeNode root = (TreeNode)classTreeMap.get("java.lang.Object");
+ if (null != root) {
+ output.div(CssClass.PACKAGE_TREE_SECTION_TITLE, "Class Hierarchy");
+ output.beginDiv(CssClass.PACKAGE_TREE);
+ printPackageTreeRec(output, root, null);
+ output.endDiv(CssClass.PACKAGE_TREE);
+ }
+ }
+
+ private void printInterfaceTree(HtmlPage output, ClassDoc[] classDocs)
+ {
+ Map interfaceTreeMap = new HashMap();
+
+ for (int i=0; i<classDocs.length; ++i) {
+ ClassDoc classDoc = classDocs[i];
+ if (classDoc.isInterface()) {
+ addInterfaceTreeNode(interfaceTreeMap, classDoc);
+ }
+ }
+
+ TreeNode interfaceRoot = (TreeNode)interfaceTreeMap.get("<root>");
+ if (null != interfaceRoot) {
+ Iterator it = interfaceRoot.children.iterator();
+ if (it.hasNext()) {
+ output.div(CssClass.PACKAGE_TREE_SECTION_TITLE, "Interface Hierarchy");
+ output.beginDiv(CssClass.PACKAGE_TREE);
+ while (it.hasNext()) {
+ TreeNode node = (TreeNode)it.next();
+ printPackageTreeRec(output, node, null);
+ }
+ output.endDiv(CssClass.PACKAGE_TREE);
+ }
+ }
+
+ }
+
+ private void printPackageTreePage(File packageDir, String pathToRoot, PackageDoc packageDoc)
+ throws IOException
+ {
+ HtmlPage output = newHtmlPage(new File(packageDir,
+ "tree" + filenameExtension),
+ pathToRoot);
+ output.beginPage(getPageTitle(packageDoc.name() + " Hierarchy"),
+ getOutputCharset(),
+ getStylesheets());
+ output.beginBody(CssClass.BODY_CONTENT_PACKAGE_TREE);
+ printNavBarTop(output, "package-tree");
+
+ output.div(CssClass.PACKAGE_TREE_TITLE, "Hierarchy for Package " + packageDoc.name());
+
+ ClassDoc[] classDocs = packageDoc.allClasses();
+ printClassTree(output, classDocs);
+ printInterfaceTree(output, classDocs);
+
+ printNavBarBottom(output, "package-tree");
+ output.endBody();
+ output.endPage();
+ output.close();
+ }
+
+ private void printFullTreePage()
+ throws IOException
+ {
+ HtmlPage output = newHtmlPage(new File(getTargetDirectory(),
+ "tree" + filenameExtension),
+ ".");
+ output.beginPage(getPageTitle("Hierarchy"),
+ getOutputCharset(),
+ getStylesheets());
+ output.beginBody(CssClass.BODY_CONTENT_FULL_TREE);
+ printNavBarTop(output, "full-tree");
+
+ output.div(CssClass.PACKAGE_TREE_TITLE, "Hierarchy for All Packages");
+
+ output.beginDiv(CssClass.FULL_TREE_PACKAGELIST);
+ output.div(CssClass.FULL_TREE_PACKAGELIST_HEADER, "Package Hierarchies:");
+ output.beginDiv(CssClass.FULL_TREE_PACKAGELIST_ITEM);
+ Set allPackages = getAllPackages();
+ Iterator it = allPackages.iterator();
+ while (it.hasNext()) {
+ PackageDoc packageDoc = (PackageDoc)it.next();
+ output.beginAnchor(getPackageURL(packageDoc) + "tree" + filenameExtension);
+ output.print(packageDoc.name());
+ output.endAnchor();
+ if (it.hasNext()) {
+ output.print(", ");
+ }
+ }
+ output.endDiv(CssClass.FULL_TREE_PACKAGELIST_ITEM);
+ output.endDiv(CssClass.FULL_TREE_PACKAGELIST);
+
+ ClassDoc[] classDocs = getRootDoc().classes();
+ printClassTree(output, classDocs);
+ printInterfaceTree(output, classDocs);
+
+ printNavBarBottom(output, "full-tree");
+ output.endBody();
+ output.endPage();
+ output.close();
+ }
+
+ private void printIndexEntry(HtmlPage output, Doc entry)
+ {
+ output.beginDiv(CssClass.INDEX_ENTRY);
+ output.beginDiv(CssClass.INDEX_ENTRY_KEY);
+ String anchor = null;
+ String description = null;
+ if (entry instanceof PackageDoc) {
+ output.beginAnchor(getPackageURL((PackageDoc)entry) + "package-summary" + filenameExtension);
+ output.print(entry.name());
+ output.endAnchor();
+ output.print(" - package");
+ }
+ else if (entry instanceof ClassDoc) {
+ ClassDoc classDoc = (ClassDoc)entry;
+ output.beginAnchor(getClassURL(classDoc));
+ output.print(entry.name() + getTypeParameters(classDoc));
+ output.endAnchor();
+ output.print(" - ");
+ if (entry.isInterface()) {
+ output.print("interface ");
+ }
+ else if (entry.isException()) {
+ output.print("exception ");
+ }
+ else if (entry.isError()) {
+ output.print("error ");
+ }
+ else {
+ output.print("class ");
+ }
+ String packageName = classDoc.containingPackage().name();
+ if (packageName.length() > 0) {
+ output.print(packageName);
+ output.print(".");
+ }
+ printType(output, classDoc);
+ }
+ else {
+ ProgramElementDoc memberDoc = (ProgramElementDoc)entry;
+ output.beginAnchor(getMemberDocURL(output, memberDoc));
+ output.print(entry.name());
+ if (memberDoc instanceof ExecutableMemberDoc) {
+ output.print(((ExecutableMemberDoc)memberDoc).signature());
+ }
+ output.endAnchor();
+ output.print(" - ");
+
+ if (memberDoc.isStatic()) {
+ output.print("static ");
+ }
+
+ if (entry.isConstructor()) {
+ output.print("constructor for class ");
+ }
+ else if (entry.isMethod()) {
+ output.print("method in class ");
+ }
+ else if (entry.isField()) {
+ output.print("field in class ");
+ }
+ ClassDoc containingClass = memberDoc.containingClass();
+ String packageName = containingClass.containingPackage().name();
+ if (packageName.length() > 0) {
+ output.print(packageName);
+ output.print(".");
+ }
+ printType(output, containingClass);
+ }
+ output.endDiv(CssClass.INDEX_ENTRY_KEY);
+ output.beginDiv(CssClass.INDEX_ENTRY_DESCRIPTION);
+ printTags(output, entry, entry.firstSentenceTags(), true);
+ output.endDiv(CssClass.INDEX_ENTRY_DESCRIPTION);
+ output.endDiv(CssClass.INDEX_ENTRY);
+ }
+
+ private void printFrameSetPage()
+ throws IOException
+ {
+ HtmlPage output = newHtmlPage(new File(getTargetDirectory(),
+ "index" + filenameExtension),
+ ".",
+ HtmlPage.DOCTYPE_FRAMESET);
+
+ String title = getWindowTitle();
+ output.beginPage(title, getOutputCharset(), getStylesheets());
+ output.beginElement("frameset", "cols", "20%,80%");
+
+ String contentURL;
+ if (isSinglePackage()) {
+ output.atomicElement("frame",
+ new String[] { "src", "name" },
+ new String[] { getPackageURL(getSinglePackage()) + "classes" + filenameExtension, "classes" });
+ contentURL = getPackageURL(getSinglePackage()) + "package-summary.html";
+ }
+ else {
+ output.beginElement("frameset", "rows", "25%,75%");
+ output.atomicElement("frame",
+ new String[] { "src", "name" },
+ new String[] { "all-packages" + filenameExtension, "packages" });
+ output.atomicElement("frame",
+ new String[] { "src", "name" },
+ new String[] { "all-classes" + filenameExtension, "classes" });
+ output.endElement("frameset");
+ contentURL = "overview-summary" + filenameExtension;
+ }
+ output.atomicElement("frame",
+ new String[] { "src", "name" },
+ new String[] { contentURL, "content" });
+ output.endElement("frameset");
+ output.endPage();
+ output.close();
+ }
+
+ private void printPackagesMenuPage()
+ throws IOException
+ {
+ HtmlPage output = newHtmlPage(new File(getTargetDirectory(),
+ "all-packages" + filenameExtension),
+ ".");
+ output.beginPage(getPageTitle("Package Menu"), getOutputCharset(), getStylesheets());
+ output.beginBody(CssClass.BODY_MENU_PACKAGES, false);
+
+ output.beginSpan(CssClass.PACKAGE_MENU_ENTRY);
+ output.beginAnchor("all-classes" + filenameExtension,
+ null,
+ "classes");
+ output.print("All Classes");
+ output.endAnchor();
+ output.endSpan(CssClass.PACKAGE_MENU_ENTRY);
+
+ output.div(CssClass.PACKAGE_MENU_TITLE, "Packages");
+
+ output.beginDiv(CssClass.PACKAGE_MENU_LIST);
+
+ Set packageDocs = getAllPackages();
+ Iterator it = packageDocs.iterator();
+ while (it.hasNext()) {
+ PackageDoc packageDoc = (PackageDoc)it.next();
+ output.beginSpan(CssClass.PACKAGE_MENU_ENTRY);
+ output.beginAnchor(getPackageURL(packageDoc) + "classes" + filenameExtension,
+ null,
+ "classes");
+ if (packageDoc.name().length() > 0) {
+ output.print(packageDoc.name());
+ }
+ else {
+ output.print("&lt;unnamed package&gt;");
+ }
+ output.endAnchor();
+ output.endSpan(CssClass.PACKAGE_MENU_ENTRY);
+ output.br();
+ }
+
+ output.endDiv(CssClass.PACKAGE_MENU_LIST);
+ output.endBody();
+ output.endPage();
+ output.close();
+ }
+
+ private void printClassMenuEntry(HtmlPage output, ClassDoc classDoc)
+ {
+ CssClass entryClass;
+ if (classDoc.isInterface()) {
+ entryClass = CssClass.CLASS_MENU_ENTRY_INTERFACE;
+ }
+ else {
+ entryClass = CssClass.CLASS_MENU_ENTRY_CLASS;
+ }
+ output.beginSpan(entryClass);
+ output.beginAnchor(getClassDocURL(output, classDoc),
+ classDoc.qualifiedTypeName(),
+ "content");
+ output.print(classDoc.name());
+ output.endAnchor();
+ output.endSpan(entryClass);
+ output.br();
+ }
+
+ private void printClassMenuSection(HtmlPage output, Collection classDocs, String header)
+ {
+ if (!classDocs.isEmpty()) {
+ output.div(CssClass.CLASS_MENU_SUBTITLE, header);
+ Iterator it = classDocs.iterator();
+ while (it.hasNext()) {
+ ClassDoc classDoc = (ClassDoc)it.next();
+ printClassMenuEntry(output, classDoc);
+ }
+ }
+ }
+
+ private void printClassMenuList(HtmlPage output, ClassDoc[] classDocs, boolean categorized)
+ {
+ output.beginDiv(CssClass.CLASS_MENU_LIST);
+
+ if (categorized) {
+ Set classes = new TreeSet();
+ Set interfaces = new TreeSet();
+ Set exceptions = new TreeSet();
+ Set errors = new TreeSet();
+
+ for (int i=0; i<classDocs.length; ++i) {
+ ClassDoc classDoc = classDocs[i];
+ if (classDoc.isInterface()) {
+ interfaces.add(classDoc);
+ }
+ else if (classDoc.isException()) {
+ exceptions.add(classDoc);
+ }
+ else if (classDoc.isError()) {
+ errors.add(classDoc);
+ }
+ else {
+ classes.add(classDoc);
+ }
+ }
+ printClassMenuSection(output, interfaces, "Interfaces");
+ printClassMenuSection(output, classes, "Classes");
+ printClassMenuSection(output, exceptions, "Exceptions");
+ printClassMenuSection(output, errors, "Errors");
+ }
+ else {
+ for (int i=0; i<classDocs.length; ++i) {
+ ClassDoc classDoc = classDocs[i];
+ if (classDoc.isIncluded()) {
+ printClassMenuEntry(output, classDoc);
+ }
+ }
+ }
+
+ output.endDiv(CssClass.CLASS_MENU_LIST);
+ }
+
+ private void printAllClassesMenuPage()
+ throws IOException
+ {
+ HtmlPage output = newHtmlPage(new File(getTargetDirectory(),
+ "all-classes" + filenameExtension),
+ ".");
+ output.beginPage(getPageTitle("Class Menu"), getOutputCharset(), getStylesheets());
+ output.beginBody(CssClass.BODY_MENU_CLASSES, false);
+
+ output.div(CssClass.CLASS_MENU_TITLE, "All Classes");
+
+ printClassMenuList(output, getRootDoc().classes(), false);
+
+ output.endBody();
+ output.endPage();
+ output.close();
+ }
+
+ private void printPackageClassesMenuPage(File packageDir, String pathToRoot, PackageDoc packageDoc)
+ throws IOException
+ {
+ HtmlPage output = newHtmlPage(new File(packageDir,
+ "classes" + filenameExtension),
+ pathToRoot);
+
+ output.beginPage(getPageTitle(packageDoc.name() + " Class Menu"),
+ getOutputCharset(), getStylesheets());
+ output.beginBody(CssClass.BODY_MENU_CLASSES, false);
+
+ output.beginDiv(CssClass.CLASS_MENU_TITLE);
+ output.beginAnchor("package-summary" + filenameExtension, "", "content");
+ if (packageDoc.name().length() > 0) {
+ output.print(packageDoc.name());
+ }
+ else {
+ output.print("&lt;Unnamed&gt;");
+ }
+ output.endAnchor();
+ output.endDiv(CssClass.CLASS_MENU_TITLE);
+
+ printClassMenuList(output, packageDoc.allClasses(), true);
+
+ output.endBody();
+ output.endPage();
+ output.close();
+ }
+
+ private void printSplitIndex()
+ throws IOException
+ {
+ Map categorizedIndex = getCategorizedIndex();
+ Iterator it = categorizedIndex.keySet().iterator();
+ int n = 1;
+ int count = categorizedIndex.size();
+ while (it.hasNext()) {
+ Character c = (Character)it.next();
+ List classList = (List)categorizedIndex.get(c);
+ printIndexPage(n++, count, c, classList);
+ }
+ }
+
+ private void printIndexPage()
+ throws IOException
+ {
+ printIndexPage(0, 0, null, null);
+ }
+
+ private void printIndexPage(int index, int maxIndex, Character letter, List classList)
+ throws IOException
+ {
+ String pageName = "alphaindex";
+ if (null != letter) {
+ pageName += "-" + index;
+ }
+ HtmlPage output = newHtmlPage(new File(getTargetDirectory(),
+ pageName + filenameExtension),
+ ".");
+ output.beginPage(getPageTitle("Alphabetical Index"),
+ getOutputCharset(),
+ getStylesheets());
+ output.beginBody(CssClass.BODY_CONTENT_INDEX);
+ if (null == letter) {
+ printNavBarTop(output, "index");
+ }
+ else {
+ printNavBarTop(output, "split-index", null,
+ (index > 1) ? new Integer(index - 1) : null,
+ (index < maxIndex) ? new Integer(index + 1) : null);
+ }
+
+ {
+ String title;
+ if (null == letter) {
+ title = "Alphabetical Index";
+ }
+ else {
+ title = "Alphabetical Index: " + letter;
+ }
+ output.div(CssClass.INDEX_TITLE, title);
+
+ if (null != letter || getCategorizedIndex().keySet().size() > 1) {
+ output.beginDiv(CssClass.INDEX_LETTERS);
+
+ Iterator it = getCategorizedIndex().keySet().iterator();
+ int n = 1;
+ while (it.hasNext()) {
+ Character c = (Character)it.next();
+ output.beginSpan(CssClass.INDEX_LETTER);
+ if (letter != null) {
+ output.beginAnchor("alphaindex-" + n + filenameExtension);
+ }
+ else {
+ output.beginAnchor("#" + c);
+ }
+ output.print(c.toString());
+ output.endAnchor();
+ output.endSpan(CssClass.INDEX_LETTER);
+ output.beginSpan(CssClass.INDEX_LETTER_SPACER);
+ output.print(" ");
+ output.endSpan(CssClass.INDEX_LETTER_SPACER);
+ ++n;
+ }
+ }
+
+ output.endDiv(CssClass.INDEX_LETTERS);
+ }
+
+ if (null != letter) {
+ printIndexCategory(output, letter, classList);
+ }
+ else {
+ Map categorizedIndex = getCategorizedIndex();
+ Iterator categoryIt = categorizedIndex.keySet().iterator();
+
+ while (categoryIt.hasNext()) {
+ letter = (Character)categoryIt.next();
+ classList = (List)categorizedIndex.get(letter);
+ output.anchorName(letter.toString());
+ printIndexCategory(output, letter, classList);
+ }
+ }
+
+ printNavBarBottom(output, "index");
+ output.endBody();
+ output.endPage();
+ output.close();
+ }
+
+ private void printIndexCategory(HtmlPage output, Character letter, List classList)
+ {
+ Iterator it = classList.iterator();
+
+ output.div(CssClass.INDEX_CATEGORY_HEADER, letter.toString());
+ output.beginDiv(CssClass.INDEX_CATEGORY);
+ while (it.hasNext()) {
+ Doc entry = (Doc)it.next();
+ printIndexEntry(output, entry);
+ }
+ output.endDiv(CssClass.INDEX_CATEGORY);
+ }
+
+ private void printDeprecationSummary(HtmlPage output, List docs, String header)
+ {
+ if (!docs.isEmpty()) {
+ output.beginDiv(CssClass.TABLE_CONTAINER);
+ output.beginTable(CssClass.DEPRECATION_SUMMARY, new String[] { "border", "width" }, new String[] { "1", "100%" });
+ output.rowDiv(CssClass.TABLE_HEADER, header);
+
+ Iterator it = docs.iterator();
+ while (it.hasNext()) {
+ Doc doc = (Doc)it.next();
+ output.beginRow();
+
+ output.beginCell(CssClass.DEPRECATION_SUMMARY_LEFT);
+ if (doc instanceof Type) {
+ printType(output, (Type)doc);
+ }
+ else {
+ ProgramElementDoc memberDoc = (ProgramElementDoc)doc;
+ output.beginAnchor(getMemberDocURL(output, memberDoc));
+ output.print(memberDoc.containingClass().qualifiedName());
+ output.print(".");
+ output.print(memberDoc.name());
+ if (memberDoc instanceof ExecutableMemberDoc) {
+ output.print(((ExecutableMemberDoc)memberDoc).flatSignature());
+ }
+ output.endAnchor();
+ }
+ output.beginDiv(CssClass.DEPRECATION_SUMMARY_DESCRIPTION);
+ printTags(output, doc, doc.tags("deprecated")[0].firstSentenceTags(), true);
+ output.endDiv(CssClass.DEPRECATION_SUMMARY_DESCRIPTION);
+
+ output.endCell();
+
+ output.endRow();
+ }
+ output.endTable();
+ output.endDiv(CssClass.TABLE_CONTAINER);
+ output.print("\n");
+ }
+ }
+
+
+ private void printSerializationPage()
+ throws IOException
+ {
+ HtmlPage output = newHtmlPage(new File(getTargetDirectory(),
+ "serialized-form" + filenameExtension),
+ ".");
+ output.beginPage(getPageTitle("Serialized Form"),
+ getOutputCharset(),
+ getStylesheets());
+ output.beginBody(CssClass.BODY_CONTENT_DEPRECATED);
+ printNavBarTop(output, "serialized");
+
+ output.div(CssClass.SERIALIZED_TITLE, "Serialized Form");
+
+ Iterator it = getAllPackages().iterator();
+
+ while (it.hasNext()) {
+
+ PackageDoc packageDoc = (PackageDoc)it.next();
+
+ List serializableClasses = new LinkedList();
+ ClassDoc[] classes = packageDoc.allClasses();
+ for (int i=0; i<classes.length; ++i) {
+ ClassDoc classDoc = classes[i];
+ if (classDoc.isSerializable() || classDoc.isExternalizable()) {
+ serializableClasses.add(classDoc);
+ }
+ }
+
+ if (!serializableClasses.isEmpty()) {
+ output.div(CssClass.SERIALIZED_PACKAGE_HEADER, "Package " + packageDoc.name());
+
+ Iterator cit = serializableClasses.iterator();
+ while (cit.hasNext()) {
+ ClassDoc classDoc = (ClassDoc)cit.next();
+
+ output.anchorName(classDoc.qualifiedTypeName());
+
+ output.beginDiv(CssClass.SERIALIZED_CLASS_HEADER);
+ output.print("Class ");
+ printType(output, classDoc, true);
+ output.print(" extends ");
+ printType(output, classDoc.superclass());
+ output.print(" implements Serializable");
+ output.endDiv(CssClass.SERIALIZED_CLASS_HEADER);
+
+ FieldDoc serialVersionUidField = findField(classDoc, "serialVersionUID");
+ if (null != serialVersionUidField
+ && serialVersionUidField.isFinal()
+ && serialVersionUidField.isStatic()
+ && serialVersionUidField.type().typeName().equals("long")) {
+
+ String fieldValue = serialVersionUidField.constantValueExpression();
+ if (null != fieldValue) {
+ output.beginDiv(CssClass.SERIALIZED_SVUID_OUTER);
+ output.span(CssClass.SERIALIZED_SVUID_HEADER, "serialVersionUID: ");
+ output.span(CssClass.SERIALIZED_SVUID_VALUE, fieldValue);
+ output.endDiv(CssClass.SERIALIZED_SVUID_OUTER);
+ }
+ }
+ printMemberDetails(output,
+ classDoc.serializationMethods(),
+ "Serialization Methods",
+ true, null);
+ printMemberDetails(output,
+ classDoc.serializableFields(),
+ "Serialized Fields",
+ true, null);
+ }
+ }
+ }
+
+ printNavBarBottom(output, "serialized");
+
+ output.endBody();
+ output.endPage();
+ output.close();
+ }
+
+
+ private void printDeprecationPage()
+ throws IOException
+ {
+ HtmlPage output = newHtmlPage(new File(getTargetDirectory(),
+ "deprecated" + filenameExtension),
+ ".");
+ output.beginPage(getPageTitle("Deprecated API"),
+ getOutputCharset(),
+ getStylesheets());
+ output.beginBody(CssClass.BODY_CONTENT_DEPRECATED);
+ printNavBarTop(output, "deprecated");
+
+ output.div(CssClass.DEPRECATION_TITLE, "Deprecated API");
+
+ List deprecatedInterfaces = new LinkedList();
+ List deprecatedExceptions = new LinkedList();
+ List deprecatedErrors = new LinkedList();
+ List deprecatedClasses = new LinkedList();
+ List deprecatedFields = new LinkedList();
+ List deprecatedMethods = new LinkedList();
+ List deprecatedConstructors = new LinkedList();
+
+ ClassDoc[] classDocs = getRootDoc().classes();
+ for (int i=0; i<classDocs.length; ++i) {
+ ClassDoc classDoc = classDocs[i];
+ {
+ Tag[] deprecatedTags = classDoc.tags("deprecated");
+ if (null != deprecatedTags && deprecatedTags.length > 0) {
+ if (classDoc.isInterface()) {
+ deprecatedInterfaces.add(classDoc);
+ }
+ else if (classDoc.isException()) {
+ deprecatedExceptions.add(classDoc);
+ }
+ else if (classDoc.isError()) {
+ deprecatedErrors.add(classDoc);
+ }
+ else {
+ deprecatedClasses.add(classDoc);
+ }
+ }
+ }
+ ConstructorDoc[] constructors = classDoc.constructors();
+ for (int j=0; j<constructors.length; ++j) {
+ Tag[] deprecatedTags = constructors[j].tags("deprecated");
+ if (null != deprecatedTags && deprecatedTags.length > 0) {
+ deprecatedConstructors.add(constructors[j]);
+ }
+ }
+ MethodDoc[] methods = classDoc.methods();
+ for (int j=0; j<methods.length; ++j) {
+ Tag[] deprecatedTags = methods[j].tags("deprecated");
+ if (null != deprecatedTags && deprecatedTags.length > 0) {
+ deprecatedMethods.add(methods[j]);
+ }
+ }
+ FieldDoc[] fields = classDoc.fields();
+ for (int j=0; j<fields.length; ++j) {
+ Tag[] deprecatedTags = fields[j].tags("deprecated");
+ if (null != deprecatedTags && deprecatedTags.length > 0) {
+ deprecatedFields.add(fields[j]);
+ }
+ }
+ }
+
+ if (!deprecatedInterfaces.isEmpty()
+ || !deprecatedClasses.isEmpty()
+ || !deprecatedExceptions.isEmpty()
+ || !deprecatedErrors.isEmpty()
+ || !deprecatedFields.isEmpty()
+ || !deprecatedMethods.isEmpty()
+ || !deprecatedConstructors.isEmpty()) {
+
+ output.beginDiv(CssClass.DEPRECATION_TOC);
+ output.div(CssClass.DEPRECATION_TOC_HEADER, "Contents");
+ output.beginDiv(CssClass.DEPRECATION_TOC_LIST);
+ if (!deprecatedInterfaces.isEmpty()) {
+ output.beginDiv(CssClass.DEPRECATION_TOC_ENTRY);
+ output.anchor("#interfaces", "Deprecated Interfaces");
+ output.endDiv(CssClass.DEPRECATION_TOC_ENTRY);
+ }
+ if (!deprecatedClasses.isEmpty()) {
+ output.beginDiv(CssClass.DEPRECATION_TOC_ENTRY);
+ output.anchor("#classes", "Deprecated Classes");
+ output.endDiv(CssClass.DEPRECATION_TOC_ENTRY);
+ }
+ if (!deprecatedExceptions.isEmpty()) {
+ output.beginDiv(CssClass.DEPRECATION_TOC_ENTRY);
+ output.anchor("#exceptions", "Deprecated Exceptions");
+ output.endDiv(CssClass.DEPRECATION_TOC_ENTRY);
+ }
+ if (!deprecatedErrors.isEmpty()) {
+ output.beginDiv(CssClass.DEPRECATION_TOC_ENTRY);
+ output.anchor("#errors", "Deprecated Errors");
+ output.endDiv(CssClass.DEPRECATION_TOC_ENTRY);
+ }
+ if (!deprecatedFields.isEmpty()) {
+ output.beginDiv(CssClass.DEPRECATION_TOC_ENTRY);
+ output.anchor("#fields", "Deprecated Fields");
+ output.endDiv(CssClass.DEPRECATION_TOC_ENTRY);
+ }
+ if (!deprecatedMethods.isEmpty()) {
+ output.beginDiv(CssClass.DEPRECATION_TOC_ENTRY);
+ output.anchor("#methods", "Deprecated Methods");
+ output.endDiv(CssClass.DEPRECATION_TOC_ENTRY);
+ }
+ if (!deprecatedConstructors.isEmpty()) {
+ output.beginDiv(CssClass.DEPRECATION_TOC_ENTRY);
+ output.anchor("#constructors", "Deprecated Constructors");
+ output.endDiv(CssClass.DEPRECATION_TOC_ENTRY);
+ }
+ output.endDiv(CssClass.DEPRECATION_TOC_LIST);
+ output.endDiv(CssClass.DEPRECATION_TOC);
+ output.beginDiv(CssClass.DEPRECATION_LIST);
+
+ output.anchorName("interfaces");
+ printDeprecationSummary(output, deprecatedInterfaces, "Deprecated Interfaces");
+
+ output.anchorName("classes");
+ printDeprecationSummary(output, deprecatedClasses, "Deprecated Classes");
+
+ output.anchorName("exceptions");
+ printDeprecationSummary(output, deprecatedExceptions, "Deprecated Exceptions");
+
+ output.anchorName("errors");
+ printDeprecationSummary(output, deprecatedErrors, "Deprecated Errors");
+
+ output.anchorName("fields");
+ printDeprecationSummary(output, deprecatedFields, "Deprecated Fields");
+
+ output.anchorName("methods");
+ printDeprecationSummary(output, deprecatedMethods, "Deprecated Methods");
+
+ output.anchorName("constructors");
+ printDeprecationSummary(output, deprecatedConstructors, "Deprecated Constructors");
+
+ output.endDiv(CssClass.DEPRECATION_LIST);
+ }
+ else {
+ output.beginDiv(CssClass.DEPRECATION_EMPTY);
+ output.print("No deprecated classes or class members in this API.");
+ output.endDiv(CssClass.DEPRECATION_EMPTY);
+
+ }
+
+ printNavBarBottom(output, "deprecated");
+ output.endBody();
+ output.endPage();
+ output.close();
+ }
+
+ private void printAboutPage()
+ throws IOException
+ {
+ HtmlPage output = newHtmlPage(new File(getTargetDirectory(),
+ "about" + filenameExtension),
+ ".");
+ output.beginPage(getPageTitle("About"),
+ getOutputCharset(),
+ getStylesheets());
+ output.beginBody(CssClass.BODY_CONTENT_ABOUT);
+
+ printNavBarTop(output, "about");
+
+ output.div(CssClass.ABOUT_TITLE, "About");
+
+ output.beginDiv(CssClass.ABOUT_GENERATOR);
+ output.print("Generated by ");
+ output.print("Gjdoc");
+ output.print(" HtmlDoclet ");
+ output.print(getDocletVersion());
+ output.print(", part of ");
+ output.beginAnchor("http://www.gnu.org/software/classpath/cp-tools/", "", "_top");
+ output.print("GNU Classpath Tools");
+ output.endAnchor();
+ output.print(", on ");
+ DateFormat format = DateFormat.getDateTimeInstance(DateFormat.LONG,
+ DateFormat.LONG,
+ Locale.US);
+ Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"),
+ Locale.US);
+ format.setCalendar(cal);
+ output.print(format.format(new Date()));
+ output.print(".");
+ output.endDiv(CssClass.ABOUT_GENERATOR);
+
+ printNavBarBottom(output, "about");
+
+ output.endBody();
+ output.endPage();
+ output.close();
+ }
+
+ private void printSourcePage(File packageDir, ClassDoc classDoc, String sourceXhtml)
+ throws IOException
+ {
+ HtmlPage output = newHtmlPage(new File(packageDir,
+ classDoc.name() + "-source" + filenameExtension),
+ getPathToRoot(packageDir, getTargetDirectory()));
+ output.beginPage(getPageTitle("Source for " + classDoc.qualifiedTypeName()),
+ getOutputCharset(),
+ getStylesheets());
+
+ output.beginBody(CssClass.BODY_CONTENT_SOURCE);
+
+ printNavBarTop(output, "source", classDoc, null, null);
+
+ output.div(CssClass.SOURCE_TITLE, "Source for " + classDoc.qualifiedTypeName());
+ output.beginDiv(CssClass.SOURCE);
+ output.print(sourceXhtml);
+ output.endDiv(CssClass.SOURCE);
+
+ printNavBarBottom(output, "source", classDoc);
+
+ output.endBody();
+ output.endPage();
+
+ output.close();
+ }
+
+ private void printHelpPage()
+ throws IOException
+ {
+ HtmlPage output = newHtmlPage(new File(getTargetDirectory(),
+ "help" + filenameExtension),
+ ".");
+ output.beginPage(getPageTitle("Help"),
+ getOutputCharset(),
+ getStylesheets());
+ output.beginBody(CssClass.BODY_CONTENT_HELP);
+
+ printNavBarTop(output, "help");
+
+ InputStream helpIn;
+ if (null != optionHelpFile.getValue()){
+ helpIn = new FileInputStream(optionHelpFile.getValue());
+ }
+ else {
+ helpIn = getClass().getResourceAsStream("/htmldoclet/help.xhtml");
+ }
+ output.insert(new InputStreamReader(helpIn, "utf-8"));
+ helpIn.close();
+
+ printNavBarBottom(output, "help");
+
+ output.endBody();
+ output.endPage();
+ output.close();
+ }
+
+ private void printOverviewPage()
+ throws IOException
+ {
+ HtmlPage output = newHtmlPage(new File(getTargetDirectory(),
+ "overview-summary" + filenameExtension),
+ ".");
+ output.beginPage(getWindowTitle(),
+ getOutputCharset(),
+ getStylesheets());
+ output.beginBody(CssClass.BODY_CONTENT_OVERVIEW);
+
+ printNavBarTop(output, "overview");
+
+ String overviewHeader;
+ if (null != optionDocTitle.getValue()) {
+ overviewHeader = optionDocTitle.getValue();
+ }
+ else if (null != optionTitle.getValue()) {
+ overviewHeader = optionTitle.getValue();
+ }
+ else {
+ overviewHeader = null;
+ }
+
+ if (null != overviewHeader) {
+ output.div(CssClass.OVERVIEW_TITLE, overviewHeader);
+ }
+
+ output.beginDiv(CssClass.OVERVIEW_DESCRIPTION_TOP);
+ printTags(output, getRootDoc(), getRootDoc().firstSentenceTags(), true);
+ output.endDiv(CssClass.OVERVIEW_DESCRIPTION_TOP);
+
+ List packageGroups = getPackageGroups();
+
+ if (packageGroups.isEmpty()) {
+
+ printOverviewPackages(output, getAllPackages(),
+ "All Packages");
+ }
+ else {
+ Set otherPackages = new LinkedHashSet();
+ otherPackages.addAll(getAllPackages());
+
+ Iterator it = packageGroups.iterator();
+ while (it.hasNext()) {
+ PackageGroup packageGroup = (PackageGroup)it.next();
+ printOverviewPackages(output,
+ packageGroup.getPackages(),
+ packageGroup.getName());
+ otherPackages.removeAll(packageGroup.getPackages());
+ }
+
+ if (!otherPackages.isEmpty()) {
+ printOverviewPackages(output,
+ otherPackages,
+ "Other Packages");
+ }
+ }
+
+ output.anchorName("description");
+ output.beginDiv(CssClass.OVERVIEW_DESCRIPTION_FULL);
+ printTags(output, getRootDoc(), getRootDoc().inlineTags(), false);
+ output.endDiv(CssClass.OVERVIEW_DESCRIPTION_FULL);
+
+ printNavBarBottom(output, "overview");
+ output.endBody();
+ output.endPage();
+ output.close();
+ }
+
+ private void printOverviewPackages(HtmlPage output, Collection packageDocs, String header)
+ {
+ output.beginDiv(CssClass.TABLE_CONTAINER);
+ output.beginTable(CssClass.OVERVIEW_SUMMARY, new String[] { "border", "width" }, new String[] { "1", "100%" });
+ output.rowDiv(CssClass.TABLE_HEADER, header);
+
+ Iterator it = packageDocs.iterator();
+ while (it.hasNext()) {
+ PackageDoc packageDoc = (PackageDoc)it.next();
+ output.beginRow();
+
+ output.beginCell(CssClass.OVERVIEW_SUMMARY_LEFT);
+ output.beginAnchor(getPackageURL(packageDoc) + "package-summary" + filenameExtension);
+ output.print(packageDoc.name());
+ output.endAnchor();
+ output.endCell();
+
+ output.beginCell(CssClass.OVERVIEW_SUMMARY_RIGHT);
+ printTags(output, packageDoc, packageDoc.firstSentenceTags(), true);
+ output.endCell();
+ output.endRow();
+ }
+ output.endTable();
+ output.endDiv(CssClass.TABLE_CONTAINER);
+ }
+
+ private void printClassUsagePage(File packageDir, String pathToRoot, ClassDoc classDoc)
+ throws IOException
+ {
+ HtmlPage output = newHtmlPage(new File(packageDir,
+ classDoc.name() + "-uses" + filenameExtension),
+ pathToRoot);
+ output.beginPage(getPageTitle(classDoc.name()), getOutputCharset(), getStylesheets());
+ output.beginBody(CssClass.BODY_CONTENT_USES);
+ printNavBarTop(output, "uses", classDoc, null, null);
+
+ output.div(CssClass.USAGE_TITLE,
+ "Uses of " + getClassTypeName(classDoc)
+ + " " + classDoc.qualifiedName());
+
+ Map packageToUsageTypeMap = getUsageOfClass(classDoc);
+ if (null != packageToUsageTypeMap && !packageToUsageTypeMap.isEmpty()) {
+
+ Iterator packagesIterator = packageToUsageTypeMap.keySet().iterator();
+ while (packagesIterator.hasNext()) {
+ PackageDoc packageDoc = (PackageDoc)packagesIterator.next();
+
+ output.div(CssClass.USAGE_PACKAGE_TITLE, "Uses in package " + packageDoc.name());
+
+ Map usageTypeToUsersMap = (Map)packageToUsageTypeMap.get(packageDoc);
+ Iterator usageTypeIterator = usageTypeToUsersMap.keySet().iterator();
+ while (usageTypeIterator.hasNext()) {
+ UsageType usageType = (UsageType)usageTypeIterator.next();
+
+ output.beginTable(CssClass.USAGE_SUMMARY, new String[] { "border", "width" }, new String[] { "1", "100%" });
+ output.rowDiv(CssClass.USAGE_TABLE_HEADER, format("usagetype." + usageType.getId(),
+ classDoc.qualifiedName()));
+
+ Set users = (Set)usageTypeToUsersMap.get(usageType);
+ Iterator userIterator = users.iterator();
+ while (userIterator.hasNext()) {
+ Doc user = (Doc)userIterator.next();
+
+ output.beginRow();
+
+ if (user instanceof ClassDoc) {
+ output.beginCell(CssClass.USAGE_SUMMARY_LEFT);
+ output.print("class");
+ output.endCell();
+
+ output.beginCell(CssClass.USAGE_SUMMARY_RIGHT);
+ output.beginDiv(CssClass.USAGE_SUMMARY_SYNOPSIS);
+ printType(output, ((ClassDoc)user));
+ output.endDiv(CssClass.USAGE_SUMMARY_SYNOPSIS);
+ output.beginDiv(CssClass.USAGE_SUMMARY_DESCRIPTION);
+ printTags(output, ((ClassDoc)user), ((ClassDoc)user).firstSentenceTags(), true);
+ output.endDiv(CssClass.USAGE_SUMMARY_DESCRIPTION);
+ output.endCell();
+ }
+ else if (user instanceof FieldDoc) {
+ FieldDoc fieldDoc = (FieldDoc)user;
+
+ output.beginCell(CssClass.USAGE_SUMMARY_LEFT);
+ printType(output, ((FieldDoc)user).type());
+ output.endCell();
+
+ output.beginCell(CssClass.USAGE_SUMMARY_RIGHT);
+ output.beginDiv(CssClass.USAGE_SUMMARY_SYNOPSIS);
+ printType(output, ((FieldDoc)user).containingClass());
+ output.print(".");
+ output.beginAnchor(getMemberDocURL(output, (FieldDoc)user));
+ output.print(((FieldDoc)user).name());
+ output.endAnchor();
+ output.endDiv(CssClass.USAGE_SUMMARY_SYNOPSIS);
+ output.beginDiv(CssClass.USAGE_SUMMARY_DESCRIPTION);
+ printTags(output, ((FieldDoc)user), ((FieldDoc)user).firstSentenceTags(), true);
+ output.endDiv(CssClass.USAGE_SUMMARY_DESCRIPTION);
+ output.endCell();
+ }
+ else if (user instanceof MethodDoc) {
+ MethodDoc methodDoc = (MethodDoc)user;
+
+ output.beginCell(CssClass.USAGE_SUMMARY_LEFT);
+ printType(output, ((MethodDoc)user).returnType());
+ output.endCell();
+
+ output.beginCell(CssClass.USAGE_SUMMARY_RIGHT);
+ output.beginDiv(CssClass.USAGE_SUMMARY_SYNOPSIS);
+ printType(output, ((MethodDoc)user).containingClass());
+ output.print(".");
+ output.beginAnchor(getMemberDocURL(output, (MethodDoc)user));
+ output.print(((MethodDoc)user).name());
+ output.endAnchor();
+ printParameters(output, (ExecutableMemberDoc)user);
+ output.endDiv(CssClass.USAGE_SUMMARY_SYNOPSIS);
+ output.beginDiv(CssClass.USAGE_SUMMARY_DESCRIPTION);
+ printTags(output, ((MethodDoc)user), ((MethodDoc)user).firstSentenceTags(), true);
+ output.endDiv(CssClass.USAGE_SUMMARY_DESCRIPTION);
+ output.endCell();
+ }
+ else if (user instanceof ConstructorDoc) {
+ ConstructorDoc constructorDoc = (ConstructorDoc)user;
+
+ output.beginCell(CssClass.USAGE_SUMMARY_RIGHT);
+ output.beginDiv(CssClass.USAGE_SUMMARY_SYNOPSIS);
+ printType(output, ((ConstructorDoc)user).containingClass());
+ output.print(".");
+ output.beginAnchor(getMemberDocURL(output, (ConstructorDoc)user));
+ output.print(((ConstructorDoc)user).name());
+ output.endAnchor();
+ printParameters(output, (ExecutableMemberDoc)user);
+ output.endDiv(CssClass.USAGE_SUMMARY_SYNOPSIS);
+ output.beginDiv(CssClass.USAGE_SUMMARY_DESCRIPTION);
+ printTags(output, ((ConstructorDoc)user),
+ ((ConstructorDoc)user).firstSentenceTags(), true);
+ output.endDiv(CssClass.USAGE_SUMMARY_DESCRIPTION);
+ output.endCell();
+ }
+
+ output.endRow();
+ }
+ output.endTable();
+ }
+ }
+ }
+ else {
+ output.div(CssClass.USAGE_EMPTY,
+ getClassTypeName(classDoc)
+ + " " + classDoc.qualifiedName() + " is not used by any class in this documentation set.");
+ }
+ printNavBarBottom(output, "uses", classDoc);
+ output.endBody();
+ output.endPage();
+ output.close();
+ }
+
+ private void printSuperTreeRec(HtmlPage output, ListIterator it, int level)
+ {
+ if (it.hasPrevious()) {
+ ClassDoc cd = (ClassDoc)it.previous();
+ output.beginElement("li", new String[] { "class" }, new String[] { "inheritance " + level });
+ output.beginElement("code");
+ if (it.hasPrevious()) {
+ printType(output, cd, true);
+ }
+ else {
+ output.print(cd.qualifiedName() + getTypeParameters(cd));
+ }
+ output.endElement("code");
+ output.endElement("li");
+
+ output.beginElement("li");
+
+ if (it.hasPrevious()) {
+ output.beginElement("ul", new String[] { "class" }, new String[] { "inheritance " + (level + 1) });
+ printSuperTreeRec(output, it, level + 1);
+ output.endElement("ul");
+ }
+
+ output.endElement("li");
+ }
+ }
+
+ private static boolean isSubInterface(ClassDoc classDoc, ClassDoc otherClassDoc)
+ {
+ ClassDoc[] interfaces = otherClassDoc.interfaces();
+ for (int i=0; i<interfaces.length; ++i) {
+ if (classDoc == interfaces[i]) {
+ return true;
+ }
+ else if (isSubInterface(classDoc, interfaces[i])) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void printCommaSeparatedTypes(HtmlPage output,
+ Collection list,
+ String header,
+ CssClass cssClass)
+ {
+ if (!list.isEmpty()) {
+ output.beginDiv(cssClass);
+ output.div(CssClass.CLASS_KNOWNIMPLEMENTING_HEADER, header);
+ output.beginDiv(CssClass.CLASS_KNOWNIMPLEMENTING_ITEM);
+ Iterator it = list.iterator();
+ while (it.hasNext()) {
+ Type type = (Type)it.next();
+ printType(output, type);
+ if (it.hasNext()) {
+ output.print(", ");
+ }
+ }
+ output.endDiv(CssClass.CLASS_KNOWNIMPLEMENTING_ITEM);
+ output.endDiv(cssClass);
+ }
+ }
+
+ private void printClassPage(File packageDir, String pathToRoot,
+ ClassDoc classDoc, ClassDoc prevClassDoc, ClassDoc nextClassDoc)
+ throws IOException
+ {
+ HtmlPage output = newHtmlPage(new File(packageDir,
+ classDoc.name() + filenameExtension),
+ pathToRoot);
+ Set keywords = new LinkedHashSet();
+ {
+ keywords.add(classDoc.qualifiedName() + " class");
+ FieldDoc[] fieldDocs = classDoc.fields();
+ for (int i=0; i<fieldDocs.length; ++i) {
+ FieldDoc fieldDoc = fieldDocs[i];
+ keywords.add(fieldDoc.name());
+ }
+
+ MethodDoc[] methodDocs = classDoc.methods();
+ for (int i=0; i<methodDocs.length; ++i) {
+ MethodDoc methodDoc = methodDocs[i];
+ keywords.add(methodDoc.name() + "()");
+ }
+ }
+ String parameters = getTypeParameters(classDoc);
+
+ output.beginPage(getPageTitle(classDoc.name()), getOutputCharset(),
+ keywords, getStylesheets());
+ output.beginBody(CssClass.BODY_CONTENT_CLASS);
+ printNavBarTop(output, "class", classDoc, prevClassDoc, nextClassDoc);
+
+ output.beginDiv(CssClass.CLASS_TITLE);
+ output.div(CssClass.CLASS_TITLE_PACKAGE,
+ classDoc.containingPackage().name());
+ output.div(CssClass.CLASS_TITLE_CLASS,
+ getClassTypeName(classDoc)
+ + " " + classDoc.name()
+ + parameters);
+ output.endDiv(CssClass.CLASS_TITLE);
+
+ boolean needSep = false;
+
+ if (classDoc.isInterface()) {
+
+ InterfaceRelation relation
+ = (InterfaceRelation)getInterfaceRelations().get(classDoc);
+
+ printCommaSeparatedTypes(output,
+ relation.superInterfaces,
+ "All Superinterfaces:",
+ CssClass.CLASS_KNOWNIMPLEMENTING);
+
+ printCommaSeparatedTypes(output,
+ relation.subInterfaces,
+ "Known Subinterfaces:",
+ CssClass.CLASS_KNOWNIMPLEMENTING);
+
+ printCommaSeparatedTypes(output,
+ relation.implementingClasses,
+ "Known Implementing Classes:",
+ CssClass.CLASS_KNOWNIMPLEMENTING);
+
+ needSep = !relation.superInterfaces.isEmpty()
+ || !relation.subInterfaces.isEmpty()
+ || !relation.implementingClasses.isEmpty();
+ }
+ else {
+ needSep = true;
+
+ if (!"java.lang.Object".equals(classDoc.qualifiedName())) {
+ LinkedList superClasses = new LinkedList();
+ for (ClassDoc cd = classDoc; cd != null; cd = cd.superclass()) {
+ superClasses.add(cd);
+ }
+ output.beginDiv(CssClass.CLASS_INHERITANCETREE);
+ output.beginElement("ul", new String[] { "class" }, new String[] { "inheritance 0" });
+ printSuperTreeRec(output, superClasses.listIterator(superClasses.size()), 0);
+ output.endElement("ul");
+ output.endDiv(CssClass.CLASS_INHERITANCETREE);
+
+ if (null != classDoc.containingClass()) {
+ output.beginDiv(CssClass.CLASS_ENCLOSINGCLASS);
+ output.div(CssClass.CLASS_ENCLOSINGCLASS_HEADER, "Enclosing Class:");
+ output.beginDiv(CssClass.CLASS_ENCLOSINGCLASS_ITEM);
+ printType(output, classDoc.containingClass());
+ output.endDiv(CssClass.CLASS_ENCLOSINGCLASS_ITEM);
+ output.endDiv(CssClass.CLASS_ENCLOSINGCLASS);
+ }
+
+ Set implementedInterfaces = getImplementedInterfaces(classDoc);
+
+ printCommaSeparatedTypes(output,
+ implementedInterfaces,
+ "Implemented Interfaces:",
+ CssClass.CLASS_KNOWNIMPLEMENTING);
+
+ List knownDirectSubclasses = getKnownDirectSubclasses(classDoc);
+ if (!knownDirectSubclasses.isEmpty()) {
+ output.beginDiv(CssClass.CLASS_SUBCLASSES);
+ output.div(CssClass.CLASS_SUBCLASSES_HEADER, "Known Direct Subclasses:");
+ output.beginDiv(CssClass.CLASS_SUBCLASSES_ITEM);
+ Iterator it = knownDirectSubclasses.iterator();
+ while (it.hasNext()) {
+ printType(output, (ClassDoc)it.next());
+ if (it.hasNext()) {
+ output.print(", ");
+ }
+ }
+
+ output.endDiv(CssClass.CLASS_SUBCLASSES_ITEM);
+ output.endDiv(CssClass.CLASS_SUBCLASSES_HEADER);
+ output.endDiv(CssClass.CLASS_SUBCLASSES);
+ }
+ }
+ }
+
+ if (needSep) {
+ output.hr();
+ }
+
+ output.beginDiv(CssClass.CLASS_SYNOPSIS);
+ output.beginDiv(CssClass.CLASS_SYNOPSIS_DECLARATION);
+ output.print(getFullModifiers(classDoc) + ' ' + getClassTypeKeyword(classDoc)
+ + ' ');
+ output.beginSpan(CssClass.CLASS_SYNOPSIS_NAME);
+ if (optionLinkSource.getValue() && null != classDoc.position()) {
+ output.beginAnchor(getOuterClassDoc(classDoc).name() + "-source" + filenameExtension + "#line." + classDoc.position());
+ output.print(classDoc.name() + parameters);
+ output.endAnchor();
+ }
+ else {
+ output.print(classDoc.name() + parameters);
+ }
+ output.endSpan(CssClass.CLASS_SYNOPSIS_NAME);
+ output.endDiv(CssClass.CLASS_SYNOPSIS_DECLARATION);
+
+ if (!classDoc.isInterface()) {
+ if (null != classDoc.superclass()) {
+ output.beginDiv(CssClass.CLASS_SYNOPSIS_SUPERCLASS);
+ output.print("extends ");
+ printType(output, classDoc.superclass());
+ output.endDiv(CssClass.CLASS_SYNOPSIS_SUPERCLASS);
+ }
+ }
+
+ ClassDoc[] interfaces = classDoc.interfaces();
+ if (interfaces.length > 0) {
+ output.beginDiv(CssClass.CLASS_SYNOPSIS_IMPLEMENTS);
+ if (!classDoc.isInterface()) {
+ output.print("implements ");
+ }
+ else {
+ output.print("extends ");
+ }
+ for (int i=0; i<interfaces.length; ++i) {
+ if (i>0) {
+ output.print(", ");
+ }
+ printType(output, interfaces[i]);
+ }
+ output.endDiv(CssClass.CLASS_SYNOPSIS_IMPLEMENTS);
+ }
+ output.endDiv(CssClass.CLASS_SYNOPSIS);
+
+ output.hr();
+
+ if (!optionNoComment.getValue()) {
+ output.beginDiv(CssClass.CLASS_DESCRIPTION);
+ printTags(output, classDoc, classDoc.inlineTags(), false);
+ output.endDiv(CssClass.CLASS_DESCRIPTION);
+
+ printTaglets(output, classDoc.tags(), new HtmlTagletContext(classDoc, output, false));
+ }
+
+
+ Set implementedInterfaces = getImplementedInterfaces(classDoc);
+
+ boolean haveInheritedFields = false;
+ boolean haveInheritedMethods = false;
+ boolean haveInheritedClasses = false;
+ {
+ if (!classDoc.isInterface()) {
+ ClassDoc superClassDoc = classDoc.superclass();
+ while (null != superClassDoc
+ && (!haveInheritedFields
+ || !haveInheritedMethods
+ || !haveInheritedClasses)) {
+ if (superClassDoc.fields().length > 0) {
+ haveInheritedFields = true;
+ }
+ if (superClassDoc.methods().length > 0) {
+ haveInheritedMethods = true;
+ }
+ if (superClassDoc.innerClasses().length > 0) {
+ haveInheritedClasses = true;
+ }
+ superClassDoc = superClassDoc.superclass();
+ }
+ }
+ }
+
+ printProgramElementDocs(output, getSortedInnerClasses(classDoc),
+ "Nested Class Summary", haveInheritedClasses,
+ "summary-inner");
+
+ {
+ ClassDoc superClassDoc = classDoc.superclass();
+ while (null != superClassDoc) {
+ printInheritedMembers(output, getSortedInnerClasses(superClassDoc),
+ "Nested classes/interfaces inherited from class {0}",
+ superClassDoc);
+ superClassDoc = superClassDoc.superclass();
+ }
+ }
+
+ printProgramElementDocs(output, getSortedFields(classDoc),
+ "Field Summary", haveInheritedFields,
+ "summary-fields");
+
+ {
+ ClassDoc superClassDoc = classDoc.superclass();
+ while (null != superClassDoc) {
+ printInheritedMembers(output, getSortedFields(superClassDoc),
+ "Fields inherited from class {0}",
+ superClassDoc);
+ superClassDoc = superClassDoc.superclass();
+ }
+ }
+
+ {
+ Iterator it = implementedInterfaces.iterator();
+ while (it.hasNext()) {
+ ClassDoc implementedInterface
+ = (ClassDoc)it.next();
+ if (!"java.io.Serializable".equals(implementedInterface.qualifiedName())
+ && !"java.io.Externalizable".equals(implementedInterface.qualifiedName())) {
+ printInheritedMembers(output, getSortedFields(implementedInterface),
+ "Fields inherited from interface {0}",
+ implementedInterface);
+ }
+ }
+ }
+
+ printProgramElementDocs(output, getSortedConstructors(classDoc),
+ "Constructor Summary", false,
+ "summary-constructors");
+ printProgramElementDocs(output, getSortedMethods(classDoc),
+ "Method Summary", haveInheritedMethods,
+ "summary-methods");
+
+ if (classDoc.isInterface()) {
+ InterfaceRelation relation
+ = (InterfaceRelation)getInterfaceRelations().get(classDoc);
+ Iterator it = relation.superInterfaces.iterator();
+ while (it.hasNext()) {
+ ClassDoc superClassDoc = (ClassDoc)it.next();
+ printInheritedMembers(output, getSortedMethods(superClassDoc),
+ "Methods inherited from interface {0}",
+ superClassDoc);
+ }
+ }
+ else {
+ ClassDoc superClassDoc = classDoc.superclass();
+ while (null != superClassDoc) {
+ printInheritedMembers(output, getSortedMethods(superClassDoc),
+ "Methods inherited from class {0}",
+ superClassDoc);
+ superClassDoc = superClassDoc.superclass();
+ }
+ }
+
+ printMemberDetails(output, getSortedFields(classDoc),
+ "Field Details", false, "detail-fields");
+ printMemberDetails(output, getSortedConstructors(classDoc),
+ "Constructor Details", false, "detail-constructors");
+ printMemberDetails(output, getSortedMethods(classDoc),
+ "Method Details", false, "detail-methods");
+
+ printNavBarBottom(output, "class", classDoc);
+
+ output.endBody();
+ output.endPage();
+ output.close();
+ }
+
+ private void printInheritedMembers(HtmlPage output,
+ ProgramElementDoc[] memberDocs,
+ String headerFormat,
+ ClassDoc superclass)
+ {
+ if (memberDocs.length > 0) {
+
+ output.beginDiv(CssClass.TABLE_CONTAINER);
+ output.beginTable(CssClass.CLASS_SUMMARY, new String[] { "border", "width" }, new String[] { "1", "100%" });
+ String superclassLink;
+ if (superclass.isIncluded()) {
+ superclassLink = superclass.containingPackage().name()
+ + "." + createTypeHref(output, superclass, false);
+ }
+ else {
+ superclassLink = createTypeHref(output, superclass, true);
+ }
+ output.rowDiv(CssClass.TABLE_SUB_HEADER,
+ new MessageFormat(headerFormat).format(new Object[] {
+ superclassLink
+ }));
+
+ output.beginRow();
+ output.beginCell(CssClass.CLASS_SUMMARY_INHERITED);
+ for (int i=0; i<memberDocs.length; ++i) {
+ ProgramElementDoc memberDoc = memberDocs[i];
+ if (i > 0) {
+ output.print(", ");
+ }
+ String title = null;
+ if (memberDoc.isMethod()) {
+ title = memberDoc.name() + ((MethodDoc)memberDoc).flatSignature();
+ }
+ else if (memberDoc.isInterface()) {
+ title = "interface " + ((ClassDoc)memberDoc).qualifiedName();
+ }
+ else if (memberDoc.isClass()) {
+ title = "class " + ((ClassDoc)memberDoc).qualifiedName();
+ }
+ output.beginAnchor(getMemberDocURL(output, memberDoc), title);
+ output.beginSpan(CssClass.CLASS_SUMMARY_INHERITED_MEMBER);
+ output.print(memberDoc.name());
+ output.endSpan(CssClass.CLASS_SUMMARY_INHERITED_MEMBER);
+ output.endAnchor();
+ }
+ output.endCell();
+ output.endRow();
+ output.endTable();
+ output.endDiv(CssClass.TABLE_CONTAINER);
+ }
+ }
+
+ private void collectSpecifiedByRecursive(Set specifyingInterfaces,
+ ClassDoc classDoc,
+ MethodDoc methodDoc)
+ {
+ ClassDoc[] interfaces = classDoc.interfaces();
+ for (int i=0; i<interfaces.length; ++i) {
+ MethodDoc[] methods = interfaces[i].methods();
+ for (int j=0; j<methods.length; ++j) {
+ if (methods[j].name().equals(methodDoc.name())
+ && methods[j].signature().equals(methodDoc.signature())) {
+ specifyingInterfaces.add(methods[j]);
+ break;
+ }
+ }
+ collectSpecifiedByRecursive(specifyingInterfaces,
+ interfaces[i],
+ methodDoc);
+ }
+ }
+
+ private void printMemberDetails(HtmlPage output,
+ ProgramElementDoc[] memberDocs, String header,
+ boolean isOnSerializedPage,
+ String anchor)
+ {
+ if (memberDocs.length > 0) {
+
+ if (null != anchor) {
+ output.anchorName(anchor);
+ }
+
+ CssClass sectionClass;
+ CssClass headerClass;
+ if (isOnSerializedPage) {
+ sectionClass = CssClass.SERIALIZED_SECTION;
+ headerClass = CssClass.SERIALIZED_SECTION_HEADER;
+ }
+ else {
+ sectionClass = CssClass.SECTION;
+ headerClass = CssClass.SECTION_HEADER;
+ }
+ output.div(headerClass, header);
+ output.beginDiv(sectionClass);
+
+ for (int i=0; i<memberDocs.length; ++i) {
+ if (i>0) {
+ output.hr();
+ }
+
+ ProgramElementDoc memberDoc = memberDocs[i];
+
+ output.anchorName(getMemberAnchor(memberDoc));
+
+ output.beginDiv(CssClass.MEMBER_DETAIL);
+ output.div(CssClass.MEMBER_DETAIL_NAME, memberDoc.name());
+
+ StringBuffer synopsis = new StringBuffer();
+ int synopsisLength = 0;
+
+ if (!isOnSerializedPage || !memberDoc.isField()) {
+ String fullModifiers = getFullModifiers(memberDoc);
+ synopsis.append(fullModifiers);
+ synopsisLength += fullModifiers.length();
+
+ }
+ if (memberDoc.isMethod() || memberDoc.isField()) {
+ Type type;
+ if (memberDoc.isMethod()) {
+ type = ((MethodDoc)memberDoc).returnType();
+ }
+ else {
+ type = ((FieldDoc)memberDoc).type();
+ }
+
+ synopsis.append(" ");
+ synopsisLength ++;
+ synopsis.append(createTypeHref(output, type, false));
+ if (null != type.asClassDoc() && type.asClassDoc().isIncluded()) {
+ synopsisLength += type.asClassDoc().name().length();
+ }
+ else {
+ synopsisLength += type.qualifiedTypeName().length();
+ }
+ synopsisLength += type.dimension().length();
+ }
+
+ synopsis.append(" ");
+ synopsisLength ++;
+
+ if (optionLinkSource.getValue() && null != memberDoc.position()) {
+ ClassDoc containingClass = memberDoc.containingClass();
+ while (null != containingClass.containingClass()) {
+ containingClass = containingClass.containingClass();
+ }
+ String href = containingClass.name() + "-source" + filenameExtension + "#line." + memberDoc.position().line();
+ synopsis.append(output.createHrefString(href, memberDoc.name()));
+ }
+ else {
+ synopsis.append(memberDoc.name());
+ }
+ synopsisLength += memberDoc.name().length();
+
+ if (memberDoc.isConstructor() || memberDoc.isMethod()) {
+ //printParameters(output, (ExecutableMemberDoc)memberDoc);
+ synopsis.append("(");
+ ++ synopsisLength;
+ StringBuffer paddingLeft = new StringBuffer();
+ for (int j=0; j<synopsisLength; ++j) {
+ paddingLeft.append(' ');
+ }
+ Parameter[] parameters = ((ExecutableMemberDoc)memberDoc).parameters();
+ for (int j=0; j<parameters.length; ++j) {
+ Parameter parameter = parameters[j];
+ synopsis.append(createTypeHref(output, parameter.type(), false));
+ synopsis.append(" ");
+ synopsis.append(parameter.name());
+ if (j < parameters.length - 1) {
+ synopsis.append(",\n");
+ synopsis.append(paddingLeft);
+ }
+ }
+ synopsis.append(")");
+ ClassDoc[] exceptions = ((ExecutableMemberDoc)memberDoc).thrownExceptions();
+ if (exceptions.length > 0) {
+ synopsis.append("\n throws ");
+ for (int j=0; j<exceptions.length; ++j) {
+ ClassDoc exception = exceptions[j];
+ synopsis.append(createTypeHref(output, exception, false));
+ if (j < exceptions.length - 1) {
+ synopsis.append(",\n ");
+ }
+ }
+ }
+ }
+
+ output.beginDiv(CssClass.MEMBER_DETAIL_SYNOPSIS);
+ output.print(synopsis.toString());
+ output.endDiv(CssClass.MEMBER_DETAIL_SYNOPSIS);
+
+ output.beginDiv(CssClass.MEMBER_DETAIL_BODY);
+
+ Tag[] deprecatedTags = memberDoc.tags("deprecated");
+ if (deprecatedTags.length > 0) {
+ output.beginDiv(CssClass.DEPRECATED_INLINE);
+ output.beginSpan(CssClass.DEPRECATED_HEADER);
+ output.print("Deprecated. ");
+ output.endSpan(CssClass.DEPRECATED_HEADER);
+ output.beginSpan(CssClass.DEPRECATED_BODY);
+ }
+ for (int j=0; j<deprecatedTags.length; ++j) {
+ printTags(output, memberDoc, deprecatedTags[j].inlineTags(), true);
+ }
+ if (deprecatedTags.length > 0) {
+ output.endSpan(CssClass.DEPRECATED_BODY);
+ output.beginDiv(CssClass.DEPRECATED_INLINE);
+ }
+
+ output.beginDiv(CssClass.MEMBER_DETAIL_DESCRIPTION);
+ printTags(output, memberDoc, memberDoc.inlineTags(), false);
+ output.endDiv(CssClass.MEMBER_DETAIL_DESCRIPTION);
+
+ if (memberDoc.isConstructor() || memberDoc.isMethod()) {
+
+ if (memberDoc.isMethod()) {
+ Set specifyingInterfaces = new LinkedHashSet();
+ if (memberDoc.containingClass().isInterface()) {
+ collectSpecifiedByRecursive(specifyingInterfaces,
+ memberDoc.containingClass(),
+ (MethodDoc)memberDoc);
+ }
+ else {
+ for (ClassDoc cd = memberDoc.containingClass();
+ null != cd; cd = cd.superclass()) {
+ collectSpecifiedByRecursive(specifyingInterfaces,
+ cd,
+ (MethodDoc)memberDoc);
+ }
+ }
+
+ if (!specifyingInterfaces.isEmpty()
+ && !isOnSerializedPage) {
+ output.beginDiv(CssClass.MEMBER_DETAIL_SPECIFIED_BY_LIST);
+ output.div(CssClass.MEMBER_DETAIL_SPECIFIED_BY_HEADER, "Specified by:");
+ Iterator it = specifyingInterfaces.iterator();
+ while (it.hasNext()) {
+ MethodDoc specifyingInterfaceMethod = (MethodDoc)it.next();
+ output.beginDiv(CssClass.MEMBER_DETAIL_SPECIFIED_BY_ITEM);
+ output.beginAnchor(getMemberDocURL(output,
+ specifyingInterfaceMethod));
+ output.print(memberDoc.name());
+ output.endAnchor();
+ output.print(" in interface ");
+ printType(output, specifyingInterfaceMethod.containingClass());
+ output.endDiv(CssClass.MEMBER_DETAIL_SPECIFIED_BY_ITEM);
+ }
+ output.endDiv(CssClass.MEMBER_DETAIL_SPECIFIED_BY_LIST);
+ }
+
+ ClassDoc overriddenClassDoc = null;
+ MemberDoc specifyingSuperMethod = null;
+
+ for (ClassDoc superclassDoc = memberDoc.containingClass().superclass();
+ null != superclassDoc && null == overriddenClassDoc;
+ superclassDoc = superclassDoc.superclass()) {
+
+ MethodDoc[] methods = superclassDoc.methods();
+ for (int j=0; j<methods.length; ++j) {
+ if (methods[j].name().equals(memberDoc.name())
+ && methods[j].signature().equals(((MethodDoc)memberDoc).signature())) {
+ overriddenClassDoc = superclassDoc;
+ specifyingSuperMethod = methods[j];
+ break;
+ }
+ }
+ }
+
+ if (null != overriddenClassDoc) {
+ output.beginDiv(CssClass.MEMBER_DETAIL_OVERRIDDEN_LIST);
+ output.div(CssClass.MEMBER_DETAIL_OVERRIDDEN_HEADER, "Overrides:");
+ output.beginDiv(CssClass.MEMBER_DETAIL_OVERRIDDEN_ITEM);
+
+ output.beginAnchor(getMemberDocURL(output,
+ specifyingSuperMethod));
+ output.print(memberDoc.name());
+ output.endAnchor();
+ output.print(" in interface ");
+ printType(output, overriddenClassDoc);
+
+ output.endDiv(CssClass.MEMBER_DETAIL_OVERRIDDEN_ITEM);
+ output.endDiv(CssClass.MEMBER_DETAIL_OVERRIDDEN_LIST);
+ }
+ }
+
+ if (!optionNoComment.getValue()) {
+
+ ExecutableMemberDoc execMemberDoc
+ = (ExecutableMemberDoc)memberDoc;
+
+ if (execMemberDoc.paramTags().length > 0) {
+ output.beginDiv(CssClass.MEMBER_DETAIL_PARAMETER_LIST);
+ output.div(CssClass.MEMBER_DETAIL_PARAMETER_HEADER, "Parameters:");
+ Parameter[] parameters = execMemberDoc.parameters();
+ for (int j=0; j<parameters.length; ++j) {
+ Parameter parameter = parameters[j];
+ ParamTag[] paramTags = execMemberDoc.paramTags();
+ ParamTag paramTag = null;
+ for (int k=0; k<paramTags.length; ++k) {
+ if (paramTags[k].parameterName().equals(parameter.name())) {
+ paramTag = paramTags[k];
+ break;
+ }
+ }
+
+ if (null != paramTag) {
+ output.beginDiv(CssClass.MEMBER_DETAIL_PARAMETER_ITEM);
+ output.beginSpan(CssClass.MEMBER_DETAIL_PARAMETER_ITEM_NAME);
+ output.print(parameter.name());
+ output.endSpan(CssClass.MEMBER_DETAIL_PARAMETER_ITEM_NAME);
+ output.beginSpan(CssClass.MEMBER_DETAIL_PARAMETER_ITEM_SEPARATOR);
+ output.print(" - ");
+ output.endSpan(CssClass.MEMBER_DETAIL_PARAMETER_ITEM_SEPARATOR);
+ output.beginSpan(CssClass.MEMBER_DETAIL_PARAMETER_ITEM_DESCRIPTION);
+ printTags(output, execMemberDoc, paramTag.inlineTags(), false);
+ output.endSpan(CssClass.MEMBER_DETAIL_PARAMETER_ITEM_DESCRIPTION);
+ output.endDiv(CssClass.MEMBER_DETAIL_PARAMETER_ITEM);
+ }
+ }
+ output.endDiv(CssClass.MEMBER_DETAIL_PARAMETER_LIST);
+ }
+
+ if (execMemberDoc.isMethod()
+ && !"void".equals(((MethodDoc)execMemberDoc).returnType().typeName())) {
+
+ Tag[] returnTags = execMemberDoc.tags("return");
+ if (returnTags.length > 0) {
+ Tag returnTag = returnTags[0];
+
+ output.beginDiv(CssClass.MEMBER_DETAIL_RETURN_LIST);
+ output.div(CssClass.MEMBER_DETAIL_RETURN_HEADER, "Returns:");
+ output.beginDiv(CssClass.MEMBER_DETAIL_RETURN_ITEM);
+
+ printTags(output, execMemberDoc, returnTag.inlineTags(), false);
+
+ output.endDiv(CssClass.MEMBER_DETAIL_RETURN_ITEM);
+ output.endDiv(CssClass.MEMBER_DETAIL_RETURN_LIST);
+ }
+ }
+
+ Set thrownExceptions = getThrownExceptions(execMemberDoc);
+ boolean haveThrowsInfo = false;
+ ThrowsTag[] throwsTags = execMemberDoc.throwsTags();
+ for (int k=0; k<throwsTags.length; ++k) {
+ ThrowsTag throwsTag = throwsTags[k];
+ if (null != throwsTags[k].exception()
+ && (isUncheckedException(throwsTags[k].exception())
+ || thrownExceptions.contains(throwsTag.exception()))) {
+ haveThrowsInfo = true;
+ break;
+ }
+ }
+
+ if (haveThrowsInfo) {
+ output.beginDiv(CssClass.MEMBER_DETAIL_THROWN_LIST);
+ output.div(CssClass.MEMBER_DETAIL_THROWN_HEADER, "Throws:");
+
+ for (int k=0; k<throwsTags.length; ++k) {
+ ThrowsTag throwsTag = throwsTags[k];
+ if (null != throwsTag.exception()
+ && (isUncheckedException(throwsTag.exception())
+ || thrownExceptions.contains(throwsTag.exception()))) {
+ output.beginDiv(CssClass.MEMBER_DETAIL_THROWN_ITEM);
+ output.beginSpan(CssClass.MEMBER_DETAIL_THROWN_ITEM_NAME);
+ printType(output, throwsTags[k].exception());
+ output.endSpan(CssClass.MEMBER_DETAIL_THROWN_ITEM_NAME);
+ if (null != throwsTag) {
+ output.beginSpan(CssClass.MEMBER_DETAIL_THROWN_ITEM_SEPARATOR);
+ output.print(" - ");
+ output.endSpan(CssClass.MEMBER_DETAIL_THROWN_ITEM_SEPARATOR);
+ output.beginSpan(CssClass.MEMBER_DETAIL_THROWN_ITEM_DESCRIPTION);
+ printTags(output, execMemberDoc, throwsTag.inlineTags(), false);
+ output.endSpan(CssClass.MEMBER_DETAIL_THROWN_ITEM_DESCRIPTION);
+ }
+ output.endDiv(CssClass.MEMBER_DETAIL_THROWN_ITEM);
+ }
+ }
+ output.endDiv(CssClass.MEMBER_DETAIL_THROWN_LIST);
+ }
+ }
+ }
+
+ if (!optionNoComment.getValue()) {
+
+ if (memberDoc.isField()) {
+ FieldDoc fieldDoc = ((FieldDoc)memberDoc);
+ if (null != fieldDoc.constantValue()) {
+ output.beginDiv(CssClass.MEMBER_DETAIL_THROWN_LIST);
+ output.div(CssClass.MEMBER_DETAIL_THROWN_HEADER, "Field Value:");
+ output.div(CssClass.MEMBER_DETAIL_THROWN_ITEM,
+ fieldDoc.constantValueExpression().toString());
+ output.endDiv(CssClass.MEMBER_DETAIL_THROWN_LIST);
+ }
+ }
+
+ TagletContext context = new HtmlTagletContext(memberDoc, output, isOnSerializedPage);
+ printTaglets(output, memberDoc.tags(), context);
+ }
+
+ output.endDiv(CssClass.MEMBER_DETAIL_BODY);
+ output.endDiv(CssClass.MEMBER_DETAIL);
+ }
+ output.endDiv(sectionClass);
+ }
+ }
+
+
+ private void printParameters(HtmlPage output, ExecutableMemberDoc memberDoc)
+ {
+ Parameter[] parameters = memberDoc.parameters();
+ output.print("(");
+ for (int j=0; j<parameters.length; ++j) {
+ if (j > 0) {
+ output.print(", ");
+ }
+ printType(output, parameters[j].type());
+ output.print("&nbsp;");
+ output.print(parameters[j].name());
+ }
+ output.print(")");
+ }
+
+ private void printProgramElementDocs(HtmlPage output,
+ ProgramElementDoc[] memberDocs,
+ String header,
+ boolean forceOutputHeader,
+ String anchor)
+ {
+ if (memberDocs.length > 0 || forceOutputHeader) {
+ output.anchorName(anchor);
+ output.beginDiv(CssClass.TABLE_CONTAINER);
+ output.beginTable(CssClass.CLASS_SUMMARY, new String[] { "border", "width" }, new String[] { "1", "100%" });
+ output.rowDiv(CssClass.TABLE_HEADER, header);
+
+ for (int i=0; i<memberDocs.length; ++i) {
+ ProgramElementDoc memberDoc = memberDocs[i];
+ output.beginRow();
+
+ if (!memberDoc.isConstructor()) {
+ output.beginCell(CssClass.CLASS_SUMMARY_LEFT);
+ output.beginDiv(CssClass.CLASS_SUMMARY_LEFT_SYNOPSIS);
+ output.print(getSummaryModifiers(memberDoc) + " ");
+ if (memberDoc.isMethod()) {
+ printType(output, ((MethodDoc)memberDoc).returnType());
+ }
+ else if (memberDoc.isField()) {
+ printType(output, ((FieldDoc)memberDoc).type());
+ }
+ else if (memberDoc.isInterface()) {
+ output.print(" interface");
+ }
+ else if (memberDoc.isClass()) {
+ output.print(" class");
+ }
+ output.endDiv(CssClass.CLASS_SUMMARY_LEFT_SYNOPSIS);
+ output.endCell();
+ }
+
+ output.beginCell(CssClass.CLASS_SUMMARY_RIGHT);
+ output.beginDiv(CssClass.CLASS_SUMMARY_RIGHT_LIST);
+ output.beginDiv(CssClass.CLASS_SUMMARY_RIGHT_SYNOPSIS);
+ if (memberDoc.isClass() || memberDoc.isInterface()) {
+ output.beginAnchor(getClassDocURL(output, (ClassDoc)memberDoc));
+ }
+ else {
+ output.beginAnchor("#" + getMemberAnchor(memberDoc));
+ }
+ output.print(memberDoc.name());
+ output.endAnchor();
+ if (memberDoc.isConstructor() || memberDoc.isMethod()) {
+ printParameters(output, (ExecutableMemberDoc)memberDoc);
+ }
+ output.endDiv(CssClass.CLASS_SUMMARY_RIGHT_SYNOPSIS);
+ Tag[] firstSentenceTags;
+ Tag[] deprecatedTags = memberDoc.tags("deprecated");
+ if (deprecatedTags.length > 0) {
+ firstSentenceTags = deprecatedTags[0].firstSentenceTags();
+ }
+ else {
+ firstSentenceTags = memberDoc.firstSentenceTags();
+ }
+
+ if (null != firstSentenceTags && firstSentenceTags.length > 0) {
+ output.beginDiv(CssClass.CLASS_SUMMARY_RIGHT_DESCRIPTION);
+ if (deprecatedTags.length > 0) {
+ output.beginDiv(CssClass.DEPRECATED);
+ output.beginSpan(CssClass.DEPRECATED_HEADER);
+ output.print("Deprecated. ");
+ output.endSpan(CssClass.DEPRECATED_HEADER);
+ output.beginSpan(CssClass.DEPRECATED_BODY);
+ }
+ printTags(output, memberDoc, firstSentenceTags, true);
+ if (deprecatedTags.length > 0) {
+ output.endSpan(CssClass.DEPRECATED_BODY);
+ output.beginDiv(CssClass.DEPRECATED);
+ }
+ output.endDiv(CssClass.CLASS_SUMMARY_RIGHT_DESCRIPTION);
+ }
+ output.endDiv(CssClass.CLASS_SUMMARY_RIGHT_LIST);
+ output.endCell();
+ output.endRow();
+ }
+ output.endTable();
+ output.endDiv(CssClass.TABLE_CONTAINER);
+ }
+ }
+
+ private void printTag(final HtmlPage output,
+ HtmlRepairer repairer,
+ Tag tag, boolean firstSentence,
+ boolean inline,
+ Doc contextDoc)
+ {
+ TagletContext context = new HtmlTagletContext(contextDoc, output, false);
+ if (firstSentence) {
+ output.print(renderInlineTags(tag.firstSentenceTags(), context));
+ }
+ else {
+ output.print(renderInlineTags(tag.inlineTags(), context));
+ }
+ }
+
+ private void printTags(HtmlPage output, Doc contextDoc, Tag[] tags, boolean firstSentence)
+ {
+ printTags(output, contextDoc, tags, firstSentence, false);
+ }
+
+ private void printTags(HtmlPage output, Doc contextDoc, Tag[] tags, boolean firstSentence, boolean inline)
+ {
+ if (!optionNoComment.getValue()) {
+ output.print(renderInlineTags(tags, new HtmlTagletContext(contextDoc, output, false)));
+ }
+
+ /*
+ if (!optionNoComment.getValue()) {
+ output.print(renderInlineTags(tag.firstSentenceTags(), output));
+ HtmlRepairer repairer = new HtmlRepairer(getRootDoc(),
+ true, false,
+ null, null,
+ true);
+ for (int i=0; i<tags.length; ++i) {
+ printTag(output, repairer, tags[i], firstSentence, inline);
+ }
+ output.print(repairer.terminateText());
+ }
+ */
+ }
+
+ private String getClassDocURL(HtmlPage output, ClassDoc classDoc)
+ {
+ return output.getPathToRoot()
+ + "/"
+ + getPackageURL(classDoc.containingPackage())
+ + classDoc.name() + filenameExtension;
+ }
+
+ private String getMemberDocURL(HtmlPage output, ProgramElementDoc memberDoc)
+ {
+ ClassDoc classDoc = memberDoc.containingClass();
+ PackageDoc packageDoc = classDoc.containingPackage();
+ ExternalDocSet externalDocSet = null;
+ if (classDoc.containingPackage().name().length() > 0) {
+ externalDocSet = (ExternalDocSet)packageNameToDocSet.get(packageDoc.name());
+ }
+ StringBuffer result = new StringBuffer();
+ result.append(getClassDocURL(output, classDoc));
+ result.append('#');
+ if (null == externalDocSet) {
+ result.append(getMemberAnchor(memberDoc));
+ }
+ else {
+ result.append(getMemberAnchor(memberDoc, externalDocSet.isJavadocCompatible()));
+ }
+ return result.toString();
+ }
+
+ private void printType(HtmlPage output, Type type)
+ {
+ printType(output, type, false);
+ }
+
+ private void printType(HtmlPage output, Type type, boolean fullyQualified)
+ {
+ output.print(createTypeHref(output, type, fullyQualified));
+ }
+
+ private String createTypeHref(HtmlPage output, Type type, boolean fullyQualified)
+ {
+ ClassDoc asClassDoc = type.asClassDoc();
+ String url = null;
+ if (null != asClassDoc && asClassDoc.isIncluded()) {
+ url = getClassDocURL(output, asClassDoc);
+ }
+ else if (!type.isPrimitive()) {
+ if (type.qualifiedTypeName().length() > type.typeName().length()) {
+ String packageName = type.qualifiedTypeName();
+ packageName = packageName.substring(0, packageName.length() - type.typeName().length() - 1);
+
+ ExternalDocSet externalDocSet
+ = (ExternalDocSet)packageNameToDocSet.get(packageName);
+ if (null != externalDocSet) {
+ url = externalDocSet.getClassDocURL(packageName, type.typeName());
+ }
+ }
+ }
+
+ StringBuffer result = new StringBuffer();
+
+ if (null != url && null != asClassDoc) {
+ String parameters = getTypeParameters(asClassDoc);
+ if (fullyQualified) {
+ result.append(output.createHrefString(url,possiblyQualifiedName(asClassDoc) + parameters));
+ }
+ else {
+ StringBuffer title = new StringBuffer();
+ title.append(getClassTypeName(asClassDoc));
+ title.append(" in ");
+ title.append(asClassDoc.containingPackage().name());
+ result.append(output.createHrefString(url, asClassDoc.name() + parameters, title.toString()));
+ }
+ }
+ else {
+ result.append(possiblyQualifiedName(type));
+ }
+ result.append(type.dimension());
+ return result.toString();
+ }
+
+ private void printTaglets(final HtmlPage output, Tag[] tags, TagletContext context)
+ {
+ super.printMainTaglets(tags, context, new TagletPrinter() {
+ public void printTagletString(String tagletString) {
+ output.beginDiv(CssClass.TAGLET);
+ output.print(tagletString);
+ output.endDiv(CssClass.TAGLET);
+ }
+ });
+ }
+
+ private String getPackageURL(PackageDoc packageDoc)
+ {
+ if (packageDoc.name().length() > 0) {
+ ExternalDocSet externalDocSet = (ExternalDocSet)packageNameToDocSet.get(packageDoc.name());
+ String url;
+ if (null != externalDocSet) {
+ url = externalDocSet.getPackageDocURL(packageDoc.name());
+ }
+ else {
+ url = packageDoc.name().replace('.', '/');
+ }
+ if (!url.endsWith("/")) {
+ return url + '/';
+ }
+ else {
+ return url;
+ }
+ }
+ else {
+ return "";
+ }
+ }
+
+ private String getClassURL(ClassDoc classDoc)
+ {
+ ExternalDocSet externalDocSet = null;
+ if (classDoc.containingPackage().name().length() > 0) {
+ externalDocSet = (ExternalDocSet)packageNameToDocSet.get(classDoc.containingPackage().name());
+ }
+ if (null != externalDocSet) {
+ return externalDocSet.getClassDocURL(classDoc.containingPackage().name(),
+ classDoc.name());
+ }
+ else {
+ return getPackageURL(classDoc.containingPackage()) + classDoc.name() + filenameExtension;
+ }
+ }
+
+ protected void run()
+ throws DocletConfigurationException, IOException
+ {
+ if (optionSerialWarn.getValue()) {
+ printWarning("Option -serialwarn is currently ignored.");
+ }
+
+ if (null != optionTitle.getValue()) {
+ printWarning("Option -title is deprecated.");
+ }
+
+ if (!optionValidHtml.getValue()) {
+ printWarning("Option -validhtml hasn't been specified. Generated HTML will not validate.");
+ }
+
+
+ {
+ boolean warningEmitted = false;
+ Iterator it = externalDocSets.iterator();
+ while (it.hasNext()) {
+ ExternalDocSet externalDocSet = (ExternalDocSet)it.next();
+ printNotice("Fetching package list for external documentation set.");
+ try {
+ externalDocSet.load(getTargetDirectory());
+ if (!isJavadocCompatibleNames() && externalDocSet.isJavadocCompatible()
+ && !warningEmitted) {
+ printWarning("Linking to javadoc-compatible documentation. Generated HTML will not validate ");
+ warningEmitted = true;
+ }
+ }
+ catch (FileNotFoundException e) {
+ printWarning("Cannot fetch package list from " + externalDocSet.getPackageListDir());
+ }
+ Iterator pit = externalDocSet.getPackageNames().iterator();
+ while (pit.hasNext()) {
+ String packageName = (String)pit.next();
+ packageNameToDocSet.put(packageName, externalDocSet);
+ }
+ }
+ }
+ printNotice("Building cross-reference information...");
+ getInterfaceRelations();
+ getAllSubClasses();
+
+ printNotice("Writing overview files...");
+ printFrameSetPage();
+ if (!isSinglePackage()) {
+ printPackagesMenuPage();
+ printAllClassesMenuPage();
+ printOverviewPage();
+ if (!optionNoTree.getValue()) {
+ printNotice("Writing full tree...");
+ printFullTreePage();
+ }
+ }
+ printPackagesListFile();
+ printAboutPage();
+ if (!optionNoIndex.getValue()) {
+ printNotice("Writing index...");
+ if (!optionSplitIndex.getValue()) {
+ printIndexPage();
+ }
+ else {
+ printSplitIndex();
+ }
+ }
+ if (outputHelpPage && !optionNoHelp.getValue()) {
+ printHelpPage();
+ }
+
+ // Copy resources
+
+ File resourcesDir = new File(getTargetDirectory(),
+ "resources");
+
+ if ((resourcesDir.exists() && !resourcesDir.isDirectory())
+ || (!resourcesDir.exists() && !resourcesDir.mkdirs())) {
+ throw new IOException("Cannot create directory " + resourcesDir);
+ }
+
+ // Copy resources
+
+ String[] resourceNames = {
+ "gjdoc.js",
+ "gjdochtml-clean-layout.css",
+ "gjdochtml-clean-color1.css",
+ "inherit.png",
+ "xhtml11-target10.dtd",
+ };
+
+ for (int i=0; i<resourceNames.length; ++i) {
+ String resourceName = resourceNames[i];
+ File targetFile = new File(resourcesDir,
+ resourceName);
+ InputStream in = getClass().getResourceAsStream("/htmldoclet/" + resourceName);
+ if (in == null) {
+ in = new FileInputStream("src/resources/htmldoclet/" + resourceName);
+ }
+ FileOutputStream out = new FileOutputStream(targetFile);
+ IOToolkit.copyStream(in, out);
+ in.close();
+ out.close();
+ }
+
+ // Copy stylesheets
+
+ if (null != optionAddStylesheet.getValue()) {
+ File addStylesheetTargetFile = new File(resourcesDir,
+ "user.css");
+
+ IOToolkit.copyFile(optionAddStylesheet.getValue(),
+ addStylesheetTargetFile);
+ }
+
+ if (null != optionStylesheetFile.getValue()) {
+ File stylesheetTargetFile = new File(resourcesDir,
+ "user.css");
+
+ IOToolkit.copyFile(optionStylesheetFile.getValue(),
+ stylesheetTargetFile);
+ }
+
+ // Write gjdoc.properties
+
+ File gjdocPropertiesTargetFile = new File(getTargetDirectory(),
+ "gjdoc.properties");
+ writeGjdocProperties(gjdocPropertiesTargetFile);
+
+ /*
+ else {
+ InputStream cssIn = getClass().getResourceAsStream("/htmldoclet/gjdochtml-vanilla.css");
+ FileOutputStream cssOut = new FileOutputStream(stylesheetTargetFile);
+ IOToolkit.copyStream(cssIn, cssOut);
+ cssIn.close();
+ cssOut.close();
+ }
+ */
+
+ if (!optionNoDeprecatedList.getValue()) {
+ printDeprecationPage();
+ }
+
+ printSerializationPage();
+
+ Collection packageDocsCollection = getAllPackages();
+ PackageDoc[] packageDocs
+ = (PackageDoc[])packageDocsCollection.toArray(new PackageDoc[0]);
+
+ for (int i=0; i<packageDocs.length; ++i) {
+ PackageDoc packageDoc = packageDocs[i];
+ File packageDir = new File(getTargetDirectory(),
+ packageDoc.name().replace('.', File.separatorChar));
+ if (!packageDir.exists() && !packageDir.mkdirs()) {
+ throw new IOException("Couldn't create directory " + packageDir);
+ }
+ try {
+ List packageSourceDirs = getPackageSourceDirs(packageDoc);
+ Iterator pdIt = packageSourceDirs.iterator();
+ while (pdIt.hasNext()) {
+ File sourcePackageDir = (File)pdIt.next();
+ copyDocFiles(sourcePackageDir, packageDir);
+ }
+ }
+ catch (IOException ignore) {
+ }
+ String pathToRoot = getPathToRoot(packageDir, getTargetDirectory());
+ String packageName = packageDoc.name();
+ if (0 == packageName.length()) {
+ packageName = "<unnamed>";
+ }
+ printNotice("Writing HTML files for package " + packageName);
+ printPackagePage(packageDir, pathToRoot, packageDoc,
+ (i > 0) ? packageDocs[i - 1] : null,
+ (i < packageDocs.length - 1) ? packageDocs[i + 1] : null);
+ if (!optionNoTree.getValue()) {
+ printPackageTreePage(packageDir, pathToRoot, packageDoc);
+ }
+ printPackageClassesMenuPage(packageDir, pathToRoot, packageDoc);
+ ClassDoc[] classDocs = packageDoc.allClasses();
+ for (int j=0; j<classDocs.length; ++j) {
+ ClassDoc classDoc = classDocs[j];
+ if (classDoc.isIncluded()) {
+ printClassPage(packageDir, pathToRoot,
+ classDocs[j],
+ (j > 0) ? classDocs[j - 1] : null,
+ (j < classDocs.length - 1) ? classDocs[j + 1] : null
+ );
+ if (optionUse.getValue()) {
+ printClassUsagePage(packageDir, pathToRoot, classDocs[j]);
+ }
+ if (optionLinkSource.getValue() && null == classDoc.containingClass()) {
+ try {
+ File sourceFile = getSourceFile(classDoc);
+
+ Java2xhtml java2xhtml = new Java2xhtml();
+ Properties properties = new Properties();
+ properties.setProperty("isCodeSnippet", "true");
+ properties.setProperty("hasLineNumbers", "true");
+ java2xhtml.setProperties(properties);
+
+ StringWriter sourceBuffer = new StringWriter();
+ FileReader sourceReader = new FileReader(sourceFile);
+ IOToolkit.copyStream(sourceReader, sourceBuffer);
+ sourceReader.close();
+ String result = java2xhtml.makeHTML(sourceBuffer.getBuffer(), sourceFile.getName());
+
+ printSourcePage(packageDir,
+ classDoc,
+ result);
+ }
+ catch (IOException e) {
+ printWarning("Cannot locate source file for class " + classDoc.qualifiedTypeName());
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private String getPathToRoot(File subDir, File rootDir)
+ {
+ StringBuffer result = new StringBuffer();
+ while (!subDir.equals(rootDir)) {
+ if (result.length() > 0) {
+ result.append("/");
+ }
+ subDir = subDir.getParentFile();
+ result.append("..");
+ }
+ if (0 == result.length()) {
+ result.append(".");
+ }
+ return result.toString();
+ }
+
+ private String getClassTypeName(ClassDoc classDoc)
+ {
+ if (classDoc.isInterface()) {
+ return "Interface";
+ }
+ else {
+ return "Class";
+ }
+ }
+
+ private String getClassTypeKeyword(ClassDoc classDoc)
+ {
+ if (classDoc.isInterface()) {
+ return "interface";
+ }
+ else {
+ return "class";
+ }
+ }
+
+ private String getMemberAnchor(ProgramElementDoc memberDoc)
+ {
+ return getMemberAnchor(memberDoc, isJavadocCompatibleNames());
+ }
+
+ private String getMemberAnchor(ProgramElementDoc memberDoc, boolean javadocCompatibility)
+ {
+ StringBuffer anchor = new StringBuffer();
+ anchor.append(memberDoc.name());
+ if (memberDoc.isConstructor() || memberDoc.isMethod()) {
+ if (javadocCompatibility) {
+ anchor.append(((ExecutableMemberDoc)memberDoc).signature());
+ }
+ else {
+ anchor.append(':');
+ Parameter[] parameters = ((ExecutableMemberDoc)memberDoc).parameters();
+ for (int i=0; i<parameters.length; ++i) {
+ anchor.append(parameters[i].type().typeName());
+ for (int j=0; j<parameters[i].type().dimension().length()/2; ++j) {
+ anchor.append('-');
+ }
+ if (i < parameters.length - 1) {
+ anchor.append(':');
+ }
+ }
+ }
+ }
+ return anchor.toString();
+ }
+
+ private String getFullModifiers(ProgramElementDoc memberDoc)
+ {
+ StringBuffer result = new StringBuffer();
+ if (memberDoc.isPackagePrivate()) {
+ result.append("(package private) ");
+ }
+ result.append(memberDoc.modifiers());
+ if ((memberDoc.isClass() && ((ClassDoc)memberDoc).isAbstract())
+ || (memberDoc.isMethod() && ((MethodDoc)memberDoc).isAbstract())) {
+ result.append(" abstract");
+ }
+ return result.toString();
+ }
+
+ private String getSummaryModifiers(ProgramElementDoc memberDoc)
+ {
+ StringBuffer result = new StringBuffer();
+ if (memberDoc.isPackagePrivate()) {
+ result.append("(package private) ");
+ }
+ else if (memberDoc.isPrivate()) {
+ result.append("private ");
+ }
+ else if (memberDoc.isProtected()) {
+ result.append("protected ");
+ }
+ if (memberDoc.isStatic()) {
+ result.append("static");
+ }
+ else if ((memberDoc.isClass() && ((ClassDoc)memberDoc).isAbstract())
+ || (memberDoc.isMethod() && ((MethodDoc)memberDoc).isAbstract())) {
+ result.append("abstract");
+ }
+ return result.toString();
+ }
+
+ protected DocletOption[] getOptions()
+ {
+ return options;
+ }
+
+ private DocletOptionFlag optionNoNavBar =
+ new DocletOptionFlag("-nonavbar");
+
+ private DocletOptionFlag optionNoTree =
+ new DocletOptionFlag("-notree");
+
+ private DocletOptionFlag optionNoDeprecatedList =
+ new DocletOptionFlag("-nodeprecatedlist");
+
+ private DocletOptionFlag optionNoIndex =
+ new DocletOptionFlag("-noindex");
+
+ private DocletOptionFlag optionUse =
+ new DocletOptionFlag("-use");
+
+ private DocletOptionFlag optionNoHelp =
+ new DocletOptionFlag("-nohelp");
+
+ private DocletOptionFlag optionNoComment =
+ new DocletOptionFlag("-nocomment");
+
+ private DocletOptionFlag optionSerialWarn =
+ new DocletOptionFlag("-serialwarn");
+
+ private DocletOptionFlag optionSplitIndex =
+ new DocletOptionFlag("-splitindex");
+
+ private DocletOptionString optionHeader =
+ new DocletOptionString("-header");
+
+ private DocletOptionString optionFooter =
+ new DocletOptionString("-footer");
+
+ private DocletOptionString optionBottom =
+ new DocletOptionString("-bottom");
+
+ private DocletOptionString optionWindowTitle =
+ new DocletOptionString("-windowtitle");
+
+ private DocletOptionString optionDocTitle =
+ new DocletOptionString("-doctitle");
+
+ private DocletOptionString optionTitle =
+ new DocletOptionString("-title");
+
+ private DocletOptionFile optionHelpFile =
+ new DocletOptionFile("-helpfile");
+
+ private DocletOptionFile optionStylesheetFile =
+ new DocletOptionFile("-stylesheetfile");
+
+ private DocletOptionFlag optionLinkSource =
+ new DocletOptionFlag("-linksource");
+
+ private DocletOption optionLink =
+ new DocletOption("-link") {
+
+ public int getLength()
+ {
+ return 2;
+ }
+
+ public boolean set(String[] optionArr)
+ {
+ externalDocSets.add(new ExternalDocSet(optionArr[1], null));
+ return true;
+ }
+ };
+
+ private DocletOption optionLinkOffline =
+ new DocletOption("-linkoffline") {
+
+ public int getLength()
+ {
+ return 3;
+ }
+
+ public boolean set(String[] optionArr)
+ {
+ externalDocSets.add(new ExternalDocSet(optionArr[1], optionArr[2]));
+ return true;
+ }
+ };
+
+ private DocletOptionString optionDocEncoding =
+ new DocletOptionString("-docencoding");
+
+ private DocletOptionString optionEncoding =
+ new DocletOptionString("-encoding");
+
+ private DocletOptionString optionCharset =
+ new DocletOptionString("-charset");
+
+ private DocletOptionFile optionAddStylesheet =
+ new DocletOptionFile("-addstylesheet");
+
+ private DocletOptionFlag optionValidHtml =
+ new DocletOptionFlag("-validhtml");
+
+ private DocletOptionString optionBaseUrl =
+ new DocletOptionString("-baseurl");
+
+ private DocletOption[] options =
+ {
+ optionNoNavBar,
+ optionNoTree,
+ optionNoDeprecatedList,
+ optionNoIndex,
+ optionNoHelp,
+ optionNoComment,
+ optionUse,
+ optionSplitIndex,
+ optionHeader,
+ optionFooter,
+ optionBottom,
+ optionHelpFile,
+ optionStylesheetFile,
+ optionWindowTitle,
+ optionDocTitle,
+ optionTitle,
+ optionLinkSource,
+ optionLink,
+ optionLinkOffline,
+ optionDocEncoding,
+ optionEncoding,
+ optionCharset,
+ optionAddStylesheet,
+ optionValidHtml,
+ optionBaseUrl,
+ };
+
+ static {
+ setInstance(new HtmlDoclet());
+ }
+
+ private static String replaceDocRoot(HtmlPage output, String str)
+ {
+ return StringToolkit.replace(str, "{@docRoot}", output.getPathToRoot());
+ }
+
+ private String getOutputDocEncoding()
+ {
+ String encoding = optionDocEncoding.getValue();
+
+ if (null == encoding) {
+ encoding = optionEncoding.getValue();
+ }
+
+ return encoding;
+ }
+
+ private String getOutputCharset()
+ {
+ if (null == outputCharset) {
+
+ if (null != optionCharset.getValue()) {
+ outputCharset = optionCharset.getValue();
+ }
+ else {
+ String fileEncoding = System.getProperty("file.encoding");
+ if (null != fileEncoding) {
+ try {
+ outputCharset = Charset.forName(fileEncoding).name();
+ }
+ catch (Exception ignore) {
+ }
+ }
+
+ if (null == outputCharset) {
+ printWarning("Cannot determine platform default charset, falling back to ISO-8859-1.");
+ outputCharset = "ISO-8859-1";
+ }
+ }
+ }
+ return outputCharset;
+ }
+
+ public InlineTagRenderer getInlineTagRenderer()
+ {
+ return this;
+ }
+
+ public String renderInlineTags(Tag[] tags, TagletContext context)
+ {
+ StringBuffer result = new StringBuffer();
+
+ HtmlRepairer repairer = new HtmlRepairer(getRootDoc(),
+ true, false,
+ null, null,
+ true);
+
+ for (int i=0; i<tags.length; ++i) {
+
+ Tag tag = tags[i];
+
+ if ("Text".equals(tag.name())) {
+ result.append(repairer.getWellformedHTML(tag.text()));
+ }
+ else if ("@link".equals(tag.name())) {
+ result.append(renderSeeTag((SeeTag)tag, context, false));
+ }
+ else if ("@linkplain".equals(tag.name())) {
+ result.append(renderSeeTag((SeeTag)tag, context, true));
+ }
+ else if ("@docRoot".equals(tag.name())) {
+ result.append(((HtmlTagletContext)context).getOutput().getPathToRoot());
+ }
+ else {
+ //TagletContext context = TagletContext.OVERVIEW; // FIXME
+ Taglet taglet = (Taglet)tagletMap.get(tag.name().substring(1));
+ if (null != taglet) {
+ if (taglet instanceof GnuExtendedTaglet) {
+ result.append(((GnuExtendedTaglet)taglet).toString(tag, context));
+ }
+ else {
+ result.append(taglet.toString(tag));
+ }
+ }
+ }
+ }
+ result.append(repairer.terminateText());
+ return result.toString();
+ }
+
+ public String renderSeeTag(SeeTag seeTag, TagletContext context, boolean plainFont)
+ {
+ StringBuffer result = new StringBuffer();
+
+ String href = null;
+ String label = null;
+ MemberDoc referencedMember = seeTag.referencedMember();
+ if (null != seeTag.referencedClass()) {
+
+ href = getClassDocURL(((HtmlTagletContext)context).getOutput(), seeTag.referencedClass());
+
+ Doc doc = context.getDoc();
+ ClassDoc classDoc = null;
+ if (doc.isClass() || doc.isInterface()) {
+ classDoc = (ClassDoc)doc;
+ }
+ else if (doc.isField() || doc.isMethod() || doc.isConstructor()) {
+ classDoc = ((MemberDoc)doc).containingClass();
+ }
+
+ if (null == referencedMember
+ || seeTag.referencedClass() != classDoc
+ || ((HtmlTagletContext)context).isOnSerializedPage()) {
+
+ if (!seeTag.referencedClass().isIncluded()) {
+ label = possiblyQualifiedName(seeTag.referencedClass());
+ }
+ else {
+ label = seeTag.referencedClass().typeName();
+ }
+ if (null != referencedMember) {
+ label += '.';
+ }
+ }
+ else {
+ label = "";
+ }
+
+ if (null != referencedMember) {
+ label += referencedMember.name();
+ if (referencedMember.isMethod() || referencedMember.isConstructor()) {
+ label += ((ExecutableMemberDoc)referencedMember).flatSignature();
+ }
+ href += '#' + getMemberAnchor(referencedMember);
+ }
+ else if (null != seeTag.referencedMemberName()) {
+ href = null;
+ }
+ }
+ else {
+ String referencedClassName = seeTag.referencedClassName();
+
+ if (null != referencedClassName) {
+
+ String referencedPackageName = null;
+
+ Iterator it = packageNameToDocSet.keySet().iterator();
+ while (it.hasNext()) {
+ String packageName = (String)it.next();
+ if ((null == referencedPackageName
+ || packageName.length() > referencedPackageName.length())
+ && referencedClassName.startsWith(packageName + '.')) {
+ referencedPackageName = packageName;
+ }
+ }
+
+ if (null != referencedPackageName) {
+ ExternalDocSet externalDocSet
+ = (ExternalDocSet)packageNameToDocSet.get(referencedPackageName);
+
+ String className = referencedClassName.substring(referencedPackageName.length() + 1);
+ href = externalDocSet.getClassDocURL(referencedPackageName,
+ className);
+ label = className;
+
+ String referencedMemberName = seeTag.referencedMemberName();
+
+ if (null != referencedMemberName) {
+ label += '.';
+ label += referencedMemberName;
+ href += '#' + transformReferencedMemberName(referencedMemberName,
+ externalDocSet.isJavadocCompatible());
+ }
+ else if (null != seeTag.referencedMemberName()) {
+ href = null;
+ }
+ }
+ }
+ }
+
+ if (null != seeTag.label()
+ && seeTag.label().length() > 0) {
+ label = seeTag.label();
+ }
+
+ if (null == label) {
+ label = seeTag.text();
+ if (label.startsWith("#")) {
+ label = label.substring(1);
+ }
+ else {
+ label = label.replace('#', '.');
+ }
+ label.trim();
+ }
+
+ if (null != href) {
+ result.append("<a href=\"");
+ result.append(href);
+ result.append("\">");
+ if (!plainFont) {
+ result.append("<code>");
+ }
+ result.append(label);
+ if (!plainFont) {
+ result.append("</code>");
+ }
+ result.append("</a>");
+ }
+ else {
+ if (!plainFont) {
+ result.append("<code>");
+ }
+ result.append(label);
+ if (!plainFont) {
+ result.append("</code>");
+ }
+ }
+
+ return result.toString();
+ }
+
+ protected String renderTag(String tagName, Tag[] tags, TagletContext context)
+ {
+ Doc doc = context.getDoc();
+
+ if ("see".equals(tagName)
+ && ((tags.length > 0)
+ || (doc.isClass()
+ && (((ClassDoc)doc).isSerializable()
+ || ((ClassDoc)doc).isExternalizable())))) {
+
+ StringBuffer result = new StringBuffer();
+ result.append("<dl class=\"tag list\">");
+ result.append("<dt class=\"tag section header\"><b>");
+ result.append("See Also:");
+ result.append("</b></dt>");
+
+ boolean oneLine = true;
+
+ if (oneLine) {
+ result.append("<dd>");
+ }
+
+ for (int i = 0; i < tags.length; ++i) {
+ if (oneLine) {
+ if (i > 0) {
+ result.append(", ");
+ }
+ }
+ else {
+ result.append("<dd>");
+ }
+ result.append(renderSeeTag((SeeTag)tags[i], context, false));
+ if (!oneLine) {
+ result.append("</dd>");
+ }
+ }
+
+ if ((doc instanceof ClassDoc)
+ && (((ClassDoc)doc).isSerializable() || ((ClassDoc)doc).isExternalizable())) {
+ if (tags.length > 0) {
+ result.append(", ");
+ }
+ HtmlPage output = ((HtmlTagletContext)context).getOutput();
+ result.append("<a href=\"" + output.getPathToRoot() + "/serialized-form" + filenameExtension + "#" + ((ClassDoc)doc).qualifiedName() + "\">Serialized Form</a>");
+ }
+
+ if (oneLine) {
+ result.append("</dd>");
+ }
+ result.append("</dl>");
+ return result.toString();
+ }
+ else if (tags.length > 0
+ && "serial".equals(tagName)
+ && ((HtmlTagletContext)context).isOnSerializedPage()) {
+
+ return renderInlineTags(tags[0].inlineTags(), context);
+ }
+ else {
+ return "";
+ }
+ }
+
+ private String getWindowTitle()
+ {
+ if (null == optionWindowTitle.getValue()) {
+ return "Generated API Documentation";
+ }
+ else {
+ return optionWindowTitle.getValue();
+ }
+ }
+
+ private String getPageTitle(String title)
+ {
+ if (null == optionWindowTitle.getValue()) {
+ return title;
+ }
+ else {
+ return title + " (" + optionWindowTitle.getValue() + ")";
+ }
+ }
+
+ protected String getDocletVersion()
+ {
+ if (null == docletVersion) {
+ try {
+ Properties versionProperties = new Properties();
+ InputStream in = getClass().getResourceAsStream("/version.properties");
+ if (in == null) {
+ in = new FileInputStream("src/resources/version.properties");
+ }
+ versionProperties.load(in);
+ docletVersion = versionProperties.getProperty("gjdoc.version");
+ }
+ catch (IOException ignore) {
+ }
+ if (null == docletVersion) {
+ docletVersion = "unknown";
+ }
+ }
+ return docletVersion;
+ }
+
+ private Map getStylesheets()
+ {
+ Map sheets = new HashMap();
+ if (null != optionStylesheetFile.getValue()) {
+ sheets.put("User-specified", new String[] {
+ "resources/user.css"
+ });
+ }
+ else {
+ List cleanSheets = new LinkedList();
+ cleanSheets.add("resources/gjdochtml-clean-layout.css");
+ cleanSheets.add("resources/gjdochtml-clean-color1.css");
+ if (null != optionAddStylesheet.getValue()) {
+ cleanSheets.add("resources/user.css");
+ }
+ sheets.put("GNU Clean", cleanSheets.toArray(new String[0]));
+ }
+ return sheets;
+ }
+
+ protected boolean isSinglePackage()
+ {
+ if (getRootDoc().firstSentenceTags().length > 0) {
+ return false;
+ }
+ else if (null != optionDocTitle.getValue()
+ || null != optionTitle.getValue()) {
+ return false;
+ }
+ else {
+ return super.isSinglePackage();
+ }
+ }
+
+ private String getTypeParameters(ClassDoc classDoc)
+ {
+ String parameters = "";
+ TypeVariable[] params = classDoc.typeParameters();
+ if (params != null && params.length > 0)
+ {
+ parameters = "&lt;";
+ for (int a = 0; a < params.length; ++a)
+ {
+ parameters += params[a].typeName();
+ Type[] bounds = params[a].bounds();
+ if (bounds != null)
+ {
+ parameters += " extends ";
+ for (int b = 0; a < bounds.length; ++b)
+ {
+ parameters += bounds[a];
+ if (b != bounds.length - 1)
+ parameters += " & ";
+ }
+ }
+ if (a != params.length - 1)
+ parameters += ",";
+ }
+ parameters += "&gt;";
+ }
+ return parameters;
+ }
+
+ private String transformReferencedMemberName(String referencedMemberName,
+ boolean javadocCompatibility)
+ {
+ if (!javadocCompatibility) {
+ StringBuffer result = new StringBuffer();
+ for (int i=0; i<referencedMemberName.length(); ++i) {
+ char c = referencedMemberName.charAt(i);
+ switch (c) {
+ case '(': result.append(':'); break;
+ case ')': break;
+ case ',': result.append(':'); break;
+ case '[': result.append('-'); break;
+ case ']': break;
+ default: result.append(c); break;
+ }
+ }
+ return result.toString();
+ }
+ else {
+ return referencedMemberName;
+ }
+ }
+
+ public void writeGjdocProperties(File outputFile)
+ throws IOException
+ {
+ Properties properties = new Properties();
+ properties.setProperty("gjdoc.version", getDocletVersion());
+ properties.setProperty("gjdoc.compat", Boolean.toString(isJavadocCompatibleNames()));
+
+ FileOutputStream out = new FileOutputStream(outputFile);
+ properties.store(out, "GNU Gjdoc API Documentation Set Descriptor");
+ out.close();
+ }
+
+ public boolean isJavadocCompatibleNames()
+ {
+ return !optionValidHtml.getValue();
+ }
+
+ private HtmlPage newHtmlPage(File file,
+ String pathToRoot)
+ throws IOException
+ {
+ return new HtmlPage(file,
+ pathToRoot,
+ getOutputDocEncoding(),
+ optionBaseUrl.getValue(),
+ getTargetDirectory());
+ }
+
+ private HtmlPage newHtmlPage(File file,
+ String pathToRoot,
+ String docType)
+ throws IOException
+ {
+ return new HtmlPage(file,
+ pathToRoot,
+ getOutputDocEncoding(),
+ optionBaseUrl.getValue(),
+ getTargetDirectory(),
+ docType);
+ }
+}
diff --git a/tools/gnu/classpath/tools/doclets/htmldoclet/HtmlPage.java b/tools/gnu/classpath/tools/doclets/htmldoclet/HtmlPage.java
new file mode 100644
index 000000000..0026e0b8a
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/htmldoclet/HtmlPage.java
@@ -0,0 +1,518 @@
+/* gnu.classpath.tools.doclets.htmldoclet.HtmlPage
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.doclets.htmldoclet;
+
+import gnu.classpath.tools.IOToolkit;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.Reader;
+import java.io.Writer;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import com.sun.javadoc.Tag;
+
+/**
+ * Allows outputting an HTML document without having to build the
+ * document tree in-memory.
+ */
+public class HtmlPage
+{
+ private File file;
+ private PrintWriter out;
+ private String pathToRoot;
+ private String docType;
+ private String baseUrl;
+ private File rootDir;
+
+ public static final String DOCTYPE_FRAMESET = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">";
+
+ public HtmlPage(File file, String pathToRoot, String encoding, String baseUrl, File rootDir)
+ throws IOException
+ {
+ this(file, pathToRoot, encoding, baseUrl, rootDir, "<!DOCTYPE html PUBLIC \"-//gnu.org///DTD XHTML 1.1 plus Target 1.0//EN\" \"" + pathToRoot + "/resources/xhtml11-target10.dtd\">");
+ }
+
+ public HtmlPage(File file, String pathToRoot, String encoding, String baseUrl, File rootDir, String docType)
+ throws IOException
+ {
+ this.file = file;
+ OutputStream fileOut = new FileOutputStream(file);
+ Writer writer;
+ if (null != encoding) {
+ writer = new OutputStreamWriter(fileOut,
+ encoding);
+ }
+ else {
+ writer = new OutputStreamWriter(fileOut);
+ }
+ this.out = new PrintWriter(new BufferedWriter(writer));
+ this.pathToRoot = pathToRoot;
+ this.docType = docType;
+ this.baseUrl = baseUrl;
+ this.rootDir = rootDir;
+ }
+
+ public void beginElement(String elementName)
+ {
+ print('<');
+ print(elementName);
+ print('>');
+ }
+
+ public void beginElement(String elementName, String attributeName, String attributeValue)
+ {
+ print('<');
+ print(elementName);
+ print(' ');
+ print(attributeName);
+ print('=');
+ print('\"');
+ print(attributeValue);
+ print('\"');
+ print('>');
+ }
+
+ public void beginElement(String elementName, String[] attributeNames, String[] attributeValues)
+ {
+ print('<');
+ print(elementName);
+ for (int i=0; i<attributeNames.length; ++i) {
+ if (null != attributeValues[i]) {
+ print(' ');
+ print(attributeNames[i]);
+ print('=');
+ print('\"');
+ print(attributeValues[i]);
+ print('\"');
+ }
+ }
+ print('>');
+ }
+
+ public void beginElement(String elementName, String attributeName, String attributeValue, String[] attributeNames, String[] attributeValues)
+ {
+ print('<');
+ print(elementName);
+ print(' ');
+ print(attributeName);
+ print('=');
+ print('\"');
+ print(attributeValue);
+ print('\"');
+ if (null != attributeNames) {
+ for (int i=0; i<attributeNames.length; ++i) {
+ if (null != attributeValues[i]) {
+ print(' ');
+ print(attributeNames[i]);
+ print('=');
+ print('\"');
+ print(attributeValues[i]);
+ print('\"');
+ }
+ }
+ }
+ print('>');
+ }
+
+ public void atomicElement(String elementName)
+ {
+ print('<');
+ print(elementName);
+ print("/>");
+ }
+
+ public void atomicElement(String elementName, String attributeName, String attributeValue)
+ {
+ print('<');
+ print(elementName);
+ print(' ');
+ print(attributeName);
+ print('=');
+ print('\"');
+ print(attributeValue);
+ print('\"');
+ print("/>");
+ }
+
+ public void atomicElement(String elementName, String[] attributeNames, String[] attributeValues)
+ {
+ print('<');
+ print(elementName);
+ for (int i=0; i<attributeNames.length; ++i) {
+ if (null != attributeValues[i]) {
+ print(' ');
+ print(attributeNames[i]);
+ print('=');
+ print('\"');
+ print(attributeValues[i]);
+ print('\"');
+ }
+ }
+ print("/>");
+ }
+
+
+ public void endElement(String elementName)
+ {
+ print("</");
+ print(elementName);
+ print('>');
+ }
+
+
+ public void beginDiv(CssClass cssClass)
+ {
+ String[] divAttributeNames = cssClass.getAttributeNames();
+ String[] divAttributeValues = cssClass.getAttributeValues();
+ if (null == divAttributeNames) {
+ divAttributeNames = new String[0];
+ }
+ if (null == divAttributeValues) {
+ divAttributeValues = new String[0];
+ }
+
+ String[] attributeNames = new String[1 + divAttributeNames.length];
+ String[] attributeValues = new String[1 + divAttributeValues.length];
+
+ System.arraycopy(divAttributeNames, 0, attributeNames, 1, divAttributeNames.length);
+ System.arraycopy(divAttributeValues, 0, attributeValues, 1, divAttributeNames.length);
+
+ attributeNames[0] = "class";
+ attributeValues[0] = cssClass.getName();
+
+ beginElement(cssClass.getDivElementName(), attributeNames, attributeValues);
+ if (null != cssClass.getInnerElementName()) {
+ beginElement(cssClass.getInnerElementName());
+ }
+ }
+
+ public void endDiv(CssClass cssClass)
+ {
+ if (null != cssClass.getInnerElementName()) {
+ endElement(cssClass.getInnerElementName());
+ }
+ endElement(cssClass.getDivElementName());
+ }
+
+ public void beginSpan(CssClass cssClass)
+ {
+ beginElement(cssClass.getSpanElementName(), "class", cssClass.getName());
+ }
+
+ public void endSpan(CssClass cssClass)
+ {
+ endElement(cssClass.getSpanElementName());
+ }
+
+ public void hr()
+ {
+ atomicElement("hr");
+ }
+
+ public void br()
+ {
+ atomicElement("br");
+ }
+
+ public void print(String text)
+ {
+ out.print(text);
+ }
+
+ public void print(char c)
+ {
+ out.print(c);
+ }
+
+ public void div(CssClass cssClass, String contents)
+ {
+ beginDiv(cssClass);
+ print(contents);
+ endDiv(cssClass);
+ }
+
+ public void span(CssClass cssClass, String contents)
+ {
+ beginSpan(cssClass);
+ print(contents);
+ endSpan(cssClass);
+ }
+
+ public void beginPage(String title, String charset, Map stylesheets)
+ throws IOException
+ {
+ beginPage(title, charset, Collections.EMPTY_SET, stylesheets);
+ }
+
+ public void beginPage(String title, String charset,
+ Collection keywords, Map stylesheets)
+ throws IOException
+ {
+ print("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\n");
+ print(docType);
+ print("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">");
+ beginElement("head");
+ beginElement("title");
+ print(title);
+ endElement("title");
+ if (null != baseUrl && baseUrl.length() > 0) {
+ StringBuffer url = new StringBuffer();
+ url.append(baseUrl);
+ if ('/' == url.charAt(url.length() - 1)) {
+ url.delete(url.length() - 1, url.length());
+ }
+ url.append(file.getCanonicalPath().substring(rootDir.getCanonicalPath().length()));
+ atomicElement("base",
+ new String[] { "href" },
+ new String[] { url.toString() });
+ }
+ beginElement("script",
+ new String[] { "src", "type" },
+ new String[] { pathToRoot + "/resources/gjdoc.js", "text/javascript" });
+ print("<!-- this comment required for konqueror 3.2.2 -->");
+ endElement("script");
+ atomicElement("meta",
+ new String[] { "http-equiv", "content" },
+ new String[] { "Content-Type", "text/html; charset=" + charset });
+ atomicElement("meta",
+ new String[] { "name", "content" },
+ new String[] { "generator", "GNU Gjdoc Standard Doclet" });
+ Iterator keywordIt = keywords.iterator();
+ while (keywordIt.hasNext()) {
+ String keyword = (String)keywordIt.next();
+ atomicElement("meta",
+ new String[] { "name", "content" },
+ new String[] { "keywords", keyword });
+ }
+
+ Iterator cssIt = stylesheets.keySet().iterator();
+ while (cssIt.hasNext()) {
+ String sheetName = (String)cssIt.next();
+ String[] sheetFiles = (String[])stylesheets.get(sheetName);
+
+ for (int i=0; i<sheetFiles.length; ++i) {
+ String sheetFile = sheetFiles[i];
+ atomicElement("link",
+ new String[] { "rel", "type", "href", "title" },
+ new String[] { "stylesheet", "text/css",
+ pathToRoot + "/" + sheetFile, sheetName });
+ }
+ }
+
+ endElement("head");
+ }
+
+ public void endPage()
+ {
+ endElement("html");
+ }
+
+ public void close()
+ {
+ out.close();
+ }
+
+ public void beginTable(CssClass cssClass)
+ {
+ beginElement("table", "class", cssClass.getName());
+ }
+
+ public void beginTable(CssClass cssClass, String[] attributeNames, String[] attributeValues)
+ {
+ beginElement("table", "class", cssClass.getName(), attributeNames, attributeValues);
+ }
+
+ public void beginRow()
+ {
+ beginElement("tr");
+ }
+
+ public void beginRow(CssClass cssClass)
+ {
+ beginElement("tr", "class", cssClass.getName(), cssClass.getAttributeNames(), cssClass.getAttributeValues());
+ }
+
+ public void beginRow(String attribute, String value)
+ {
+ beginElement("tr", attribute, value);
+ }
+
+ public void beginCell()
+ {
+ beginElement("td");
+ }
+
+ public void beginCell(String attribute, String value)
+ {
+ beginElement("td", attribute, value);
+ }
+
+ public void beginCell(CssClass cssClass)
+ {
+ beginElement("td", "class", cssClass.getName(), cssClass.getAttributeNames(), cssClass.getAttributeValues());
+ }
+
+ public void endCell()
+ {
+ endElement("td");
+ }
+
+ public void cell(CssClass cssClass, String contents)
+ {
+ beginCell(cssClass);
+ print(contents);
+ endCell();
+ }
+
+ public void endRow()
+ {
+ endElement("tr");
+ }
+
+ public void rowDiv(CssClass cssClass, String contents)
+ {
+ beginRow(cssClass);
+ beginCell("colspan", "2");
+ beginDiv(cssClass);
+ print(contents);
+ endDiv(cssClass);
+ endCell();
+ endRow();
+ }
+
+ public void endTable()
+ {
+ endElement("table");
+ }
+
+ public void beginAnchor(String href)
+ {
+ beginElement("a", "href", href);
+ }
+
+ public void beginAnchor(String href, String title)
+ {
+ beginElement("a",
+ new String[] { "href", "title" },
+ new String[] { href, title });
+ }
+
+ public void beginAnchor(String href, String title, String target)
+ {
+ beginElement("a",
+ new String[] { "href", "title", "target" },
+ new String[] { href, title, target });
+ }
+
+ public void endAnchor()
+ {
+ endElement("a");
+ }
+
+ public void anchor(String href, String label)
+ {
+ beginAnchor(href);
+ print(label);
+ endAnchor();
+ }
+
+ public void anchorName(String name)
+ {
+ atomicElement("a", new String[] { "name", "id" }, new String[] { name, name });
+ }
+
+ public String getPathToRoot()
+ {
+ return pathToRoot;
+ }
+
+ public void beginBody(CssClass cssClass)
+ {
+ beginBody(cssClass, true);
+ }
+
+ public void beginBody(CssClass cssClass, boolean setTitle)
+ {
+ if (setTitle) {
+ beginElement("body",
+ new String[] { "class", "onload" },
+ new String[] { cssClass.getName(), "if(parent.contentPageLoaded)parent.contentPageLoaded(document.title)" }
+ );
+ }
+ else {
+ beginElement("body",
+ new String[] { "class", "onload" },
+ new String[] { cssClass.getName(), "if(parent.contentPageLoaded)parent.contentPageLoaded()" }
+ );
+ }
+ }
+
+ public void endBody()
+ {
+ endElement("body");
+ }
+
+ public void insert(Reader in)
+ throws IOException
+ {
+ IOToolkit.copyStream(in, out);
+ }
+
+ public String createHrefString(String url, String content)
+ {
+ return createHrefString(url, content, null);
+ }
+
+ public String createHrefString(String url, String content, String title)
+ {
+ StringBuffer result = new StringBuffer();
+ result.append("<a href=\"");
+ result.append(url);
+ result.append("\"");
+ if (null != title) {
+ result.append(" title=\"");
+ result.append(title);
+ result.append("\"");
+ }
+ result.append(">");
+ result.append(content);
+ result.append("</a>");
+ return result.toString();
+ }
+
+ public File getFile()
+ {
+ return this.file;
+ }
+}
diff --git a/tools/gnu/classpath/tools/doclets/htmldoclet/HtmlTagletContext.java b/tools/gnu/classpath/tools/doclets/htmldoclet/HtmlTagletContext.java
new file mode 100644
index 000000000..5c6e84913
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/htmldoclet/HtmlTagletContext.java
@@ -0,0 +1,48 @@
+/* gnu.classpath.tools.doclets.htmldoclet.HtmlTagletContext
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.doclets.htmldoclet;
+
+import com.sun.javadoc.Doc;
+import gnu.classpath.tools.taglets.TagletContext;
+
+public class HtmlTagletContext
+ extends TagletContext
+{
+ private HtmlPage output;
+ private boolean isOnSerializedPage;
+
+ public HtmlTagletContext(Doc doc, HtmlPage output, boolean isOnSerializedPage)
+ {
+ super(doc);
+ this.output = output;
+ this.isOnSerializedPage = isOnSerializedPage;
+ }
+
+ public HtmlPage getOutput()
+ {
+ return output;
+ }
+
+ public boolean isOnSerializedPage()
+ {
+ return isOnSerializedPage;
+ }
+}
diff --git a/tools/gnu/classpath/tools/doclets/xmldoclet/.cvsignore b/tools/gnu/classpath/tools/doclets/xmldoclet/.cvsignore
new file mode 100644
index 000000000..74e8a83b2
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/xmldoclet/.cvsignore
@@ -0,0 +1,4 @@
+.deps
+.dirstamp
+.libs
+*.lo
diff --git a/tools/gnu/classpath/tools/doclets/xmldoclet/Driver.java b/tools/gnu/classpath/tools/doclets/xmldoclet/Driver.java
new file mode 100644
index 000000000..6f90338b2
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/xmldoclet/Driver.java
@@ -0,0 +1,2434 @@
+/* gnu.classpath.tools.doclets.xmldoclet.Driver
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.doclets.xmldoclet;
+
+import com.sun.javadoc.*;
+import java.io.*;
+
+import com.sun.tools.doclets.Taglet;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+import java.text.DateFormat;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.TreeSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Properties;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.StringTokenizer;
+import java.util.TreeMap;
+
+import gnu.classpath.tools.gjdoc.TemporaryStore;
+import gnu.classpath.tools.gjdoc.GjdocPackageDoc;
+
+import gnu.classpath.tools.doclets.PackageGroup;
+import gnu.classpath.tools.doclets.PackageMatcher;
+import gnu.classpath.tools.doclets.InvalidPackageWildcardException;
+
+import gnu.classpath.tools.doclets.xmldoclet.doctranslet.DocTranslet;
+import gnu.classpath.tools.doclets.xmldoclet.doctranslet.DocTransletOptions;
+
+import gnu.classpath.tools.taglets.AuthorTaglet;
+import gnu.classpath.tools.taglets.VersionTaglet;
+import gnu.classpath.tools.taglets.SinceTaglet;
+import gnu.classpath.tools.taglets.DeprecatedTaglet;
+import gnu.classpath.tools.taglets.GenericTaglet;
+import gnu.classpath.tools.doclets.StandardTaglet;
+
+import gnu.classpath.tools.java2xhtml.Java2xhtml;
+
+import gnu.classpath.tools.IOToolkit;
+import gnu.classpath.tools.FileSystemClassLoader;
+
+/**
+ * A Doclet which retrieves all information presented by the Doclet
+ * API, dumping it to stdout in XML format.
+ *
+ * @author Julian Scheid
+ */
+public class Driver {
+
+ public static final String XMLDOCLET_VERSION = "0.6.1";
+
+ /**
+ * Used for redirecting error messages to <code>/dev/null</code>.
+ */
+ private static class NullErrorReporter implements DocErrorReporter {
+ public void printError(String ignore) {}
+ public void printWarning(String ignore) {}
+ public void printNotice(String ignore) {}
+ }
+
+ /*
+ * Taglet context constants.
+ */
+ private static final int CONTEXT_CONSTRUCTOR = 1;
+ private static final int CONTEXT_FIELD = 2;
+ private static final int CONTEXT_METHOD = 3;
+ private static final int CONTEXT_OVERVIEW = 4;
+ private static final int CONTEXT_PACKAGE = 5;
+ private static final int CONTEXT_TYPE = 6;
+
+ /**
+ * All XML output will go to this stream.
+ */
+ private PrintWriter out;
+
+ /**
+ * How many spaces to indent each XML node level,
+ * i.e. Tab size for output.
+ */
+ private static int indentStep = 1;
+
+ /**
+ * Won't output superfluous spaces if set to true.
+ * If set to false, output will be more legible.
+ */
+ private boolean compress = false;
+
+ /**
+ * Won't output warning messages while fixing
+ * HTML code if set to true.
+ */
+ private boolean noHTMLWarn = false;
+
+ /**
+ * Won't output warning messages when encountering tags
+ * that look like an email address if set to true.
+ */
+ private boolean noEmailWarn = false;
+
+ /**
+ * Will fix HTML if necessary so that each comment
+ * contains valid XML code if set to true. If set
+ * to false, HTML code will not be modified and
+ * instead encapsulated in a CDATA section.
+ */
+ private boolean fixHTML = true;
+
+ /**
+ * User-specified name of the directory where the final version of
+ * the generated files will be written to.
+ *
+ * If no XSLT sheet is given, the XML output will go directly into
+ * this directory. Otherwise, XML output will go to a temporary
+ * directory and XSLT output will go to this directory.
+ */
+ private File targetDirectory = null;
+
+ /**
+ * Directory where XML output will be written to. If no XSLT
+ * sheet was given, this is the target directory specified
+ * by the user. Otherwise, this is a temporary directory.
+ */
+ private File xmlTargetDirectory;
+
+ /**
+ * Contains a number of TargetContexts which describe which XSLT
+ * sheet to apply to the output of this doclet, to what directory
+ * the XSLT output is written, and which postprocess driver to use
+ * to process XSLT output.
+ */
+ private List targets = new ArrayList();
+
+ /**
+ * XML text to include at the end of every generated page. Read
+ * from the file specified on the command line using -bottomnote.
+ * If present, this will be written to the main output file
+ * (index.xml) in node /gjdoc:rootDoc/gjdoc:bottomnote.
+ */
+ private String bottomNote;
+
+ /**
+ * Brief description of the package set. Can be specified on the
+ * command line using -title. This will be written to the main
+ * output file (index.xml) in node
+ * /gjdoc:rootDoc/gjdoc:title. The HTML generating XSLT sheet
+ * uses this for example in window titles.
+ */
+ private String title;
+
+ /**
+ * Path to the directory where temporary files should be stored.
+ * Defaults to system tempdir, but can be overridden by user
+ * with -workpath.
+ */
+ private String workingPath = System.getProperty("java.io.tmpdir");
+
+ /**
+ * Temporary directory created by this doclet where all
+ * temporary files will be stored in. If no temporary
+ * files are needed (i.e. no XSLT postprocessing stage
+ * specified by user), this is <code>null</code>.
+ */
+ private File workingDirectory;
+
+ /**
+ * Whether to deep-copy the doc-files subdirectory.
+ */
+ private boolean docFilesSubdirsEnabled = false;
+
+ /**
+ * Which direct subdirectories of the doc-files directories to exclude.
+ * Set of String.
+ */
+ private Set excludeDocFilesSubDirs = new HashSet();
+
+ /**
+ * Stores the Doclet API RootDoc we are operating on.
+ */
+ private RootDoc rootDoc;
+
+ /**
+ * XML namespace prefix used for all tags, except for HTML
+ * tags copied from Javadoc comments. Excluding colon.
+ */
+ public static final String tagPrefix = "gjdoc";
+
+ /**
+ * Classpath for loading Taglet classes.
+ */
+ private String tagletPath = null;
+
+ /**
+ * The current class that is being processed.
+ * Set in outputClassDoc().
+ */
+ private ClassDoc currentClass;
+
+ /**
+ * The current member that is being processed.
+ * Set in outputMemberDoc().
+ */
+ private MemberDoc currentMember;
+
+ /**
+ * The current constructor/method that is being processed.
+ * Set in outputExecutableMemberDoc().
+ */
+ private ExecutableMemberDoc currentExecMember;
+
+ /**
+ * Mapping from tag type to Taglet for user Taglets specified on
+ * the command line.
+ */
+ private Map tagletMap = new LinkedHashMap();
+
+ /**
+ * Keeps track of the tags mentioned by the user during option
+ * processiong so that an error can be emitted if a tag is
+ * mentioned more than once.
+ */
+ private List mentionedTags = new LinkedList();
+
+ /**
+ * Stores options to be passed to the DocTranslet.
+ */
+ private DocTransletOptions docTransletOptions = new DocTransletOptions();
+
+ /**
+ * Stores the package groups specified in the user
+ * options. Contains objects of type PackageGroup.
+ */
+ private List packageGroups = new LinkedList();
+
+ private HtmlRepairer htmlRepairer;
+
+ public static boolean start(TemporaryStore _rootDocWrapper) {
+ return new Driver().instanceStart((RootDoc)_rootDocWrapper.getAndClear());
+ }
+
+ /**
+ * Official Doclet entry point.
+ */
+ public static boolean start(RootDoc _rootDoc) {
+
+ // Create a new XmlDoclet instance and delegate control.
+ TemporaryStore tstore = new TemporaryStore(_rootDoc);
+ _rootDoc = null;
+ return new Driver().instanceStart((RootDoc)tstore.getAndClear());
+ }
+
+ /**
+ * Output an XML tag describing a com.sun.javadoc.Type object.
+ * Assumes that the tag does not have subtags.
+ *
+ * @param level Level of indentation. Will be multiplied by
+ * <code>indentStep</code> to yield actual amount
+ * of whitespace inserted at start of line.
+ * @param tag Identifier for the XML tag being output.
+ * @param type The Javadoc Type to be output.
+ */
+ protected void outputType(int level, String tag, Type type) {
+ outputType(level, tag, type, true);
+ }
+
+ protected void outputType(int level, String tag, Type type, boolean atomic) {
+
+ boolean isIncluded = false;
+ ClassDoc typeAsClassDoc = type.asClassDoc();
+ String packageName = null;
+ if (null != typeAsClassDoc) {
+ isIncluded = typeAsClassDoc.isIncluded();
+ packageName = typeAsClassDoc.containingPackage().name();
+ }
+ println(level, "<"+tagPrefix+":"+tag + " typename=\""+type.typeName()+"\""+
+ " qualifiedtypename=\""+type.qualifiedTypeName()+"\""
+ +(type.dimension().length()==0?"":" dimension=\""+type.dimension()+"\"")
+ +(isIncluded?" isIncluded=\"true\"" : "")
+ +((null != packageName)?" package=\"" + packageName + "\"" : "")
+ +(atomic?"/":"")+">");
+ }
+
+ protected void outputExecutableMemberDocBody(int level, ExecutableMemberDoc memberDoc) {
+
+ currentExecMember = memberDoc;
+
+ outputMemberDocBody(level, memberDoc);
+
+ Parameter[] parameters = memberDoc.parameters();
+ for (int i=0, ilim=parameters.length; i<ilim; ++i) {
+ Parameter parameter = parameters[i];
+ outputType(level, "parameter name=\""+parameter.name()+"\"", parameter.type());
+ }
+
+ ClassDoc[] exceptions = memberDoc.thrownExceptions();
+ for (int i=0, ilim=exceptions.length; i<ilim; ++i) {
+ ClassDoc exception = exceptions[i];
+ outputType(level, "thrownException", exception);
+ }
+
+ printAtomTag(level, "signature full=\""+memberDoc.signature()+"\" flat=\""+memberDoc.flatSignature()+"\"");
+
+ if (memberDoc.isNative()) {
+ printAtomTag(level, "isNative");
+ }
+
+ if (memberDoc.isSynchronized()) {
+ printAtomTag(level, "isSynchronized");
+ }
+ }
+
+ protected void outputMethodDoc(int level, MethodDoc methodDoc) {
+ println();
+ printOpenTag(level, "methoddoc name=\""+methodDoc.name()+"\"");
+ outputExecutableMemberDocBody(level+1, methodDoc);
+ outputType(level+1, "returns", methodDoc.returnType());
+ printCloseTag(level, "methoddoc");
+ }
+
+ protected void outputMemberDocBody(int level, MemberDoc memberDoc) {
+ currentMember = memberDoc;
+ outputProgramElementDocBody(level, memberDoc);
+ }
+
+ protected void outputFieldDocBody(int level, FieldDoc fieldDoc) {
+ outputType(level, "type", fieldDoc.type());
+ if (fieldDoc.isTransient()) {
+ printAtomTag(level, "isTransient");
+ }
+ if (fieldDoc.isVolatile()) {
+ printAtomTag(level, "isVolatile");
+ }
+ }
+
+ private void outputFieldDoc(int level, FieldDoc fieldDoc) {
+ println();
+ printOpenTag(level, "fielddoc name=\""+fieldDoc.name()+"\"");
+ outputMemberDocBody(level+1, fieldDoc);
+ outputFieldDocBody(level+1, fieldDoc);
+ printCloseTag(level, "fielddoc");
+ }
+
+ protected void outputConstructorDoc(int level, ConstructorDoc constructorDoc) {
+ println();
+ printOpenTag(level, "constructordoc name=\""+constructorDoc.name()+"\"");
+ outputExecutableMemberDocBody(level+1, constructorDoc);
+ printCloseTag(level, "constructordoc");
+ }
+
+ protected void outputSuperInterfacesRec(int level, ClassDoc classDoc) {
+ if (null!=classDoc) {
+ ClassDoc[] interfaces = classDoc.interfaces();
+ if (null != interfaces) {
+ for (int i=0, ilim=interfaces.length; i<ilim; ++i) {
+ outputType(level, "superimplements", interfaces[i]);
+ }
+ }
+ outputSuperInterfacesRec(level, classDoc.superclass());
+ }
+ }
+
+ protected void outputClassDocSummary(ClassDoc classDoc) {
+ println();
+ printOpenTag(1, "classdoc name=\""+classDoc.name()+"\" qualifiedtypename=\""+classDoc.qualifiedName()+"\" isIncluded=\"true\"");
+ if (null!=classDoc.superclass()) {
+ outputType(2, "superclass", classDoc.superclass());
+ }
+
+ ClassDoc[] interfaces = classDoc.interfaces();
+ for (int i=0, ilim=interfaces.length; i<ilim; ++i) {
+ outputType(2, "implements", interfaces[i]);
+ }
+ outputSuperInterfacesRec(2, classDoc.superclass());
+
+ printAtomTag(2, "containingPackage name=\""+classDoc.containingPackage().name()+"\"");
+ if (classDoc.isError()) {
+ printAtomTag(2, "isError");
+ }
+ if (classDoc.isException()) {
+ printAtomTag(2, "isException");
+ }
+ if (classDoc.isInterface()) {
+ printAtomTag(2, "isInterface");
+ }
+ if (classDoc.isOrdinaryClass()) {
+ printAtomTag(2, "isOrdinaryClass");
+ }
+
+ printCloseTag(1, "classdoc");
+ }
+
+ protected void outputPackageDoc(PackageDoc packageDoc) {
+ println();
+ printOpenTag(1, "packagedoc name=\""+packageDoc.name()+"\"");
+ if (packageDoc.firstSentenceTags().length > 0) {
+ printOpenTag(2, "firstSentenceTags", false);
+ outputTags(3, packageDoc.firstSentenceTags(), true, CONTEXT_PACKAGE);
+ printCloseTag(0, "firstSentenceTags");
+ printOpenTag(2, "inlineTags", false);
+ outputTags(3, packageDoc.inlineTags(), true, CONTEXT_PACKAGE);
+ printCloseTag(0, "inlineTags");
+ }
+
+ if (packageDoc.tags().length > 0) {
+ printOpenTag(2, "tags");
+ outputTags(3, packageDoc.tags(), true, CONTEXT_PACKAGE);
+ printCloseTag(2, "tags");
+ }
+
+ if (packageDoc.seeTags().length > 0) {
+ printOpenTag(2, "seeTags");
+ outputTags(3, packageDoc.seeTags(), true, CONTEXT_PACKAGE);
+ printCloseTag(2, "seeTags");
+ }
+
+ ClassDoc[] allClasses = (ClassDoc[]) packageDoc.allClasses().clone();
+ Arrays.sort(allClasses);
+
+ if (false) {
+ for (int i = 0, ilim = allClasses.length; i < ilim; ++ i) {
+ printAtomTag(2, "containsClass qualifiedtypename=\""+allClasses[i].qualifiedTypeName()+"\"");
+ }
+ }
+
+ printCloseTag(1, "packagedoc");
+ }
+
+ protected void outputClassDoc(ClassDoc classDoc) throws IOException {
+
+ currentClass = classDoc;
+
+ println();
+ printOpenTag(1, "classdoc xmlns=\"http://www.w3.org/TR/REC-html40\" xmlns:"+tagPrefix+"=\"http://www.gnu.org/software/cp-tools/gjdocxml\" name=\""+classDoc.name()+"\" qualifiedtypename=\""+classDoc.qualifiedName()+"\"");
+
+ ClassDoc[] interfaces = classDoc.interfaces();
+ for (int i=0, ilim=interfaces.length; i<ilim; ++i) {
+ outputType(2, "implements", interfaces[i]);
+ }
+ outputSuperInterfacesRec(2, classDoc.superclass());
+
+ outputProgramElementDocBody(2, classDoc);
+ if (classDoc.isAbstract())
+ printAtomTag(2, "isAbstract");
+ if (classDoc.isSerializable())
+ printAtomTag(2, "isSerializable");
+ if (classDoc.isExternalizable())
+ printAtomTag(2, "isExternalizable");
+ if (classDoc.definesSerializableFields()) {
+ printAtomTag(2, "definesSerializableFields");
+ }
+
+ ConstructorDoc[] constructors = classDoc.constructors();
+ for (int i=0, ilim=constructors.length; i<ilim; ++i) {
+ outputConstructorDoc(2, constructors[i]);
+ }
+
+ MethodDoc[] methods = classDoc.methods();
+ for (int i=0, ilim=methods.length; i<ilim; ++i) {
+ outputMethodDoc(2, methods[i]);
+ }
+
+ FieldDoc[] fields = classDoc.fields();
+ for (int i=0, ilim=fields.length; i<ilim; ++i) {
+ outputFieldDoc(2, fields[i]);
+ }
+
+ if (classDoc.serializableFields().length > 0) {
+ printOpenTag(2, "serializableFields");
+
+ FieldDoc[] sfields = classDoc.serializableFields();
+ for (int i=0, ilim=sfields.length; i<ilim; ++i) {
+ outputFieldDoc(2, sfields[i]);
+ }
+ printCloseTag(2, "serializableFields");
+ }
+
+ Java2xhtml java2xhtml = new Java2xhtml();
+ Properties properties = new Properties();
+ properties.setProperty("isCodeSnippet", "true");
+ properties.setProperty("hasLineNumbers", "true");
+ java2xhtml.setProperties(properties);
+
+ if (null == classDoc.containingClass() && docTransletOptions.linksource) {
+ printOpenTag(2, "source");
+ StringWriter sourceBuffer = new StringWriter();
+ File sourceFile = new File(((GjdocPackageDoc)classDoc.containingPackage()).packageDirectory(),
+ classDoc.name() + ".java");
+ FileReader sourceReader = new FileReader(sourceFile);
+ IOToolkit.copyStream(sourceReader, sourceBuffer);
+ print(java2xhtml.makeHTML(sourceBuffer.getBuffer(), sourceFile.getName()));
+ printCloseTag(2, "source");
+ }
+
+ ClassDoc superclassDoc = classDoc.superclass();
+ while (superclassDoc != null) {
+ outputType(2, "superclass", superclassDoc, false);
+
+ // FIXME: remove the following after adjusting the XSLT sheets:
+ printAtomTag(3, "containingPackage name=\"" + superclassDoc.containingPackage().name() + "\"");
+
+ MethodDoc[] superMethods = superclassDoc.methods();
+ if (null != superMethods) {
+ for (int i=0, ilim=superMethods.length; i<ilim; ++i) {
+ printAtomTag(3, "methoddoc name=\"" + superMethods[i].name() + "\" signature=\"" + superMethods[i].signature() + "\"");
+ }
+ }
+
+ FieldDoc[] superFields = superclassDoc.fields();
+ if (null != superFields) {
+ for (int i=0, ilim=superFields.length; i<ilim; ++i) {
+ printAtomTag(3, "fielddoc name=\"" + superFields[i].name() + "\"");
+ }
+ }
+ printCloseTag(2, "superclass");
+
+ superclassDoc = superclassDoc.superclass();
+ }
+
+ outputUsage(classDoc, 2);
+
+ printCloseTag(1, "classdoc");
+
+ currentClass = null;
+ currentMember = null;
+ currentExecMember = null;
+ }
+
+ protected int outputHeritageOpen(int level, ClassDoc classDoc) {
+
+ ClassDoc superClassDoc = classDoc.superclass();
+ if (null != superClassDoc) {
+ level = outputHeritageOpen(level, superClassDoc);
+ ++ level;
+ }
+ outputType(level, "heritage", classDoc, false);
+ return level;
+ }
+
+ protected void outputHeritageClose(int level, ClassDoc classDoc) {
+
+ ClassDoc superClassDoc = classDoc.superclass();
+ if (null != superClassDoc) {
+ outputHeritageClose(level + 1, superClassDoc);
+ }
+ printCloseTag(level, "heritage");
+ }
+
+ protected void outputDocBody(int level, Doc doc) {
+
+ int context = CONTEXT_TYPE;
+
+ if (doc.isClass()) {
+ printAtomTag(level, "isClass");
+
+ ClassDoc classDoc = (ClassDoc)doc;
+ ClassDoc[] classes = rootDoc.classes();
+ for (int i=0, ilim=classes.length; i<ilim; ++i) {
+ if (classes[i].superclass() == classDoc) {
+ outputType(level, "extended-by", classes[i]);
+ }
+ }
+
+ outputHeritageOpen(level, classDoc);
+ outputHeritageClose(level, classDoc);
+ }
+ if (doc.isConstructor()) {
+ printAtomTag(level, "isConstructor");
+ context = CONTEXT_CONSTRUCTOR;
+ }
+ if (doc.isError()) {
+ printAtomTag(level, "isError");
+ }
+ if (doc.isException()) {
+ printAtomTag(level, "isException");
+ }
+ if (doc.isField()) {
+ printAtomTag(level, "isField");
+ context = CONTEXT_FIELD;
+ }
+ if (doc.isIncluded()) {
+ printAtomTag(level, "isIncluded");
+ }
+ if (doc.isInterface()) {
+ printAtomTag(level, "isInterface");
+
+ ClassDoc classDoc = (ClassDoc)doc;
+ ClassDoc[] classes = rootDoc.classes();
+ for (int i=0, ilim=classes.length; i<ilim; ++i) {
+ ClassDoc[] implementedInterfaces = classes[i].interfaces();
+ for (int j=0; j<implementedInterfaces.length; ++j) {
+ if (implementedInterfaces[j] == classDoc) {
+ if (classDoc.isInterface()) {
+ outputType(level, "subinterface", classes[i]);
+ }
+ else {
+ outputType(level, "implemented-by", classes[i]);
+ }
+ break;
+ }
+ }
+ }
+ }
+ if (doc.isMethod()) {
+ printAtomTag(level, "isMethod");
+ context = CONTEXT_METHOD;
+ }
+ if (doc.isOrdinaryClass()) {
+ printAtomTag(level, "isOrdinaryClass");
+ }
+
+ if (doc.inlineTags().length > 0) {
+ printOpenTag(level, "inlineTags", false);
+ outputTags(level+1, doc.inlineTags(), true, context);
+ printCloseTag(0, "inlineTags");
+ }
+
+ if (doc.firstSentenceTags().length > 0) {
+ printOpenTag(level, "firstSentenceTags", false);
+ outputTags(level+1, doc.firstSentenceTags(), true, context);
+ printCloseTag(0, "firstSentenceTags");
+ }
+
+ if (doc.tags().length > 0) {
+ printOpenTag(level, "tags");
+ outputTaglets(level+1, doc.tags(), true, context);
+ printCloseTag(level, "tags");
+ }
+
+ if (doc.seeTags().length > 0) {
+ printOpenTag(level, "seeTags");
+ outputTags(level+1, doc.seeTags(), true, context);
+ printCloseTag(level, "seeTags");
+ }
+
+ SourcePosition position = doc.position();
+ if (null != position) {
+ printAtomTag(level, "position file=\"" + position.file().getAbsolutePath() + "\" line=\"" + position.line() + "\" column=\"" + position.column() + "\"");
+ }
+ }
+
+ protected void outputProgramElementDocBody(int level, ProgramElementDoc programElementDoc) {
+ outputDocBody(level, programElementDoc);
+ printAtomTag(level, "containingPackage name=\""+programElementDoc.containingPackage().name()+"\"");
+ if (null!=programElementDoc.containingClass()) {
+ outputType(level, "containingClass", programElementDoc.containingClass());
+ }
+ String access;
+ if (programElementDoc.isPublic())
+ access="public";
+ else if (programElementDoc.isProtected())
+ access="protected";
+ else if (programElementDoc.isPrivate())
+ access="private";
+ else if (programElementDoc.isPackagePrivate())
+ access="package";
+ else
+ throw new RuntimeException("Huh? "+programElementDoc+" is neither public, protected, private nor package protected.");
+ printAtomTag(level, "access scope=\""+access+"\"");
+ if (programElementDoc.isFinal())
+ printAtomTag(level, "isFinal");
+ if (programElementDoc.isStatic())
+ printAtomTag(level, "isStatic");
+ }
+
+ protected void outputTags(int level, Tag[] tags, boolean descend, int context) {
+
+ for (int i=0; i<tags.length; ++i) {
+ outputTag(tags[i], level, descend, context, i == tags.length-1);
+ }
+ }
+
+ protected void outputTag(Tag tag, int level, boolean descend, int context, boolean lastTag) {
+
+ if (!"Text".equals(tag.name())) {
+ printOpenTag(0 /* don't introduce additional whitespace */,
+ "tag kind=\""+tag.kind()+"\" name=\""+tag.name()+"\"", false);
+ }
+ if (tag instanceof ThrowsTag) {
+ ThrowsTag throwsTag = (ThrowsTag)tag;
+ if (null!=throwsTag.exception()) {
+ outputType(level+1, "exception", throwsTag.exception());
+ }
+ else {
+ StringBuffer sb = new StringBuffer("Exception ");
+ sb.append(throwsTag.exceptionName());
+ sb.append(" not found in ");
+ if (currentExecMember instanceof MethodDoc) {
+ MethodDoc m = (MethodDoc)currentExecMember;
+ sb.append(m.returnType().typeName());
+ sb.append(m.returnType().dimension());
+ sb.append(' ');
+ }
+ sb.append(currentClass.qualifiedName());
+ sb.append('.');
+ sb.append(currentExecMember.name());
+ sb.append('(');
+ Parameter[] params = currentExecMember.parameters();
+ for (int j=0; j < params.length; j++) {
+ sb.append(params[j].type().typeName());
+ sb.append(params[j].type().dimension());
+ sb.append(' ');
+ sb.append(params[j].name());
+ if (j != params.length-1)
+ sb.append(", ");
+ }
+ sb.append(')');
+ printWarning(sb.toString());
+
+ printAtomTag(level+1, "exception typename=\""+throwsTag.exceptionName()+"\"");
+ }
+ }
+ else if (tag instanceof ParamTag) {
+ ParamTag paramTag = (ParamTag)tag;
+ printAtomTag(level+1, "parameter name=\""+paramTag.parameterName()+"\"");
+ }
+
+ if (null != tag.text()) {
+ //printOpenTag(level+1, "text", false);
+ if (fixHTML) {
+ print(htmlRepairer.getWellformedHTML(tag.text()));
+ }
+ else {
+ print("<![CDATA["+cdata(tag.text())+"]]>");
+ }
+ //printCloseTag(0 /* don't introduce additional whitespace */, "text");
+ }
+ else {
+ printWarning("Tag got null text: "+tag);
+ }
+
+ if ((descend && ("@throws".equals(tag.name()) || "@param".equals(tag.name()))) || "@deprecated".equals(tag.name())) {
+ if (tag.firstSentenceTags().length>0) {
+ printOpenTag(level+1, "firstSentenceTags", false);
+ outputTags(level+2, tag.firstSentenceTags(), false, context);
+ printCloseTag(0, "firstSentenceTags");
+ }
+
+ if (tag.inlineTags().length>0) {
+ printOpenTag(level+1, "inlineTags", false);
+ outputTags(level+2, tag.firstSentenceTags(), false, context);
+ printCloseTag(0, "inlineTags");
+ }
+ }
+
+ if (fixHTML && lastTag) {
+ String terminateText = htmlRepairer.terminateText();
+ if (null != terminateText && terminateText.length() > 0) {
+ print(terminateText);
+ }
+ }
+
+ if (!"Text".equals(tag.name())) {
+
+ Taglet inlineTaglet = (Taglet)tagletMap.get(tag.name().substring(1));
+ if (null != inlineTaglet && inlineTaglet.isInlineTag()) {
+ printOpenTag(0, "inlineTagletText", false);
+ print(inlineTaglet.toString(tag));
+ printCloseTag(0, "inlineTagletText");
+ }
+
+ printCloseTag(0, "tag", false);
+ }
+ }
+
+ void outputTaglets(int level, Tag[] tags, boolean descend, int context)
+ {
+ for (Iterator it = tagletMap.keySet().iterator(); it.hasNext(); ) {
+ String tagName = (String)it.next();
+ Object o = tagletMap.get(tagName);
+ Taglet taglet = (Taglet)o;
+
+ if (!taglet.isInlineTag()
+ && ((context != CONTEXT_CONSTRUCTOR || taglet.inConstructor())
+ || (context != CONTEXT_FIELD || taglet.inField())
+ || (context != CONTEXT_METHOD || taglet.inMethod())
+ || (context != CONTEXT_OVERVIEW || taglet.inOverview())
+ || (context != CONTEXT_PACKAGE || taglet.inPackage())
+ || (context != CONTEXT_TYPE || taglet.inType()))) {
+
+ List tagsOfThisType = new ArrayList();
+ for (int i=0, ilim=tags.length; i<ilim; ++i) {
+ if (tags[i].name().substring(1).equals(tagName)) {
+ tagsOfThisType.add(tags[i]);
+ }
+ }
+
+ if (!tagsOfThisType.isEmpty()) {
+ Tag[] tagletTags = (Tag[])tagsOfThisType.toArray(new Tag[tagsOfThisType.size()]);
+ if (taglet instanceof StandardTaglet) {
+ Iterator tagIterator = tagsOfThisType.iterator();
+ while (tagIterator.hasNext()) {
+ Tag tag = (Tag)tagIterator.next();
+ outputTag(tag, level, descend, context, !tagIterator.hasNext());
+ }
+ }
+ else {
+ String tagletString = taglet.toString(tagletTags);
+ if (null != tagletString) {
+ printOpenTag(0, "tag name=\"" + tagName + "\" taglet-generated=\"true\"");
+ if (fixHTML) {
+ print(htmlRepairer.getWellformedHTML(tagletString));
+ print(htmlRepairer.terminateText());
+ }
+ else {
+ print("<![CDATA["+cdata(tagletString)+"]]>");
+ }
+ printCloseTag(0, "tag", false);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Inofficial entry point. We got an instance here.
+ */
+ protected boolean instanceStart(RootDoc _rootDoc) {
+
+ this.rootDoc = _rootDoc;
+ _rootDoc = null;
+
+ boolean xmlOnly = true;
+
+ // Set the default Taglet order
+
+ registerTaglet(new VersionTaglet());
+ registerTaglet(new AuthorTaglet());
+ //registerTaglet(new SinceTaglet());
+ registerTaglet(new StandardTaglet("deprecated"));
+ registerTaglet(new StandardTaglet("see"));
+ registerTaglet(new StandardTaglet("param"));
+
+ // Set the built-in Taglet filter
+
+ AuthorTaglet.setTagletEnabled(false);
+ VersionTaglet.setTagletEnabled(false);
+ SinceTaglet.setTagletEnabled(true);
+ DeprecatedTaglet.setTagletEnabled(true);
+
+ try {
+ {
+
+ // Process command line options passed through to this doclet
+
+ TargetContext targetContext = null;
+
+ TargetContext htmlTargetContext
+ = new TargetContext(DocTranslet.fromClasspath("/doctranslets/html/gjdoc.xsl"),
+ targetDirectory);
+
+ for (int i=0, ilim=rootDoc.options().length; i<ilim; ++i) {
+
+ String[] option = rootDoc.options()[i];
+ String optionTag = option[0];
+
+ if ("-d".equals(optionTag)) {
+ if (null == targetDirectory) {
+ targetDirectory = new File(option[1]);
+ }
+ if (null != targetContext) {
+ targetContext.setTargetDirectory(targetDirectory);
+ }
+ }
+
+ else if ("-nofixhtml".equals(optionTag)) {
+ fixHTML = false;
+ printError("-nofixhtml currently not supported.");
+ return false;
+ }
+ else if ("-compress".equals(optionTag)) {
+ compress = true;
+ }
+ else if ("-nohtmlwarn".equals(optionTag)) {
+ noHTMLWarn = true;
+ }
+ else if ("-noemailwarn".equals(optionTag)) {
+ noEmailWarn = true;
+ }
+ else if ("-indentstep".equals(optionTag)) {
+ indentStep = Integer.parseInt(option[1]);
+ }
+ else if ("-doctranslet".equals(optionTag)) {
+ targets.add(targetContext = new TargetContext(DocTranslet.fromJarFile(new File(option[1])),
+ targetDirectory));
+ }
+ else if ("-genhtml".equals(optionTag)) {
+ htmlTargetContext.setTargetDirectory(targetDirectory);
+ targets.add(targetContext = htmlTargetContext);
+ xmlOnly = false;
+ }
+ else if ("-geninfo".equals(optionTag)) {
+ targetContext
+ = new TargetContext(DocTranslet.fromClasspath("/doctranslets/info/gengj.xsl"),
+ targetDirectory);
+ targets.add(targetContext);
+ if (!fixHTML) {
+ printNotice("NOTE: -geninfo implies -fixhtml.");
+ fixHTML = true;
+ }
+ xmlOnly = false;
+ }
+ else if ("-gendocbook".equals(optionTag)) {
+ targetContext = new TargetContext(DocTranslet.fromClasspath("/doctranslets/docbook/gengj.xsl"),
+ targetDirectory);
+ targets.add(targetContext);
+ if (!fixHTML) {
+ printNotice("NOTE: -gendocbook implies -fixhtml.");
+ fixHTML = true;
+ }
+ }
+ else if ("-genpdf".equals(optionTag)) {
+ targetContext
+ = new TargetContext(DocTranslet.fromClasspath("/doctranslets/docbook/gengj.xsl"),
+ targetDirectory);
+ /** "gnu.classpath.tools.doclets.xmldoclet.DocBookPostprocessor") **/
+ targets.add(targetContext);
+ if (!fixHTML) {
+ printNotice("NOTE: -genpdf implies -fixhtml.");
+ fixHTML = true;
+ }
+ }
+ else if ("-xmlonly".equals(optionTag)) {
+ xmlOnly = true;
+ }
+ else if ("-bottomnote".equals(optionTag)) {
+
+ FileReader reader = new FileReader(option[1]);
+ StringWriter writer = new StringWriter();
+ char[] buf = new char[256];
+ int nread;
+ while ((nread = reader.read(buf)) >= 0) {
+ writer.write(buf, 0, nread);
+ }
+ writer.flush();
+ bottomNote = writer.toString();
+ writer.close();
+ reader.close();
+ }
+ else if ("-title".equals(optionTag)) {
+
+ title = option[1];
+ }
+ else if ("-workpath".equals(optionTag)) {
+
+ workingPath = option[1];
+ }
+ else if ("-tagletpath".equals(optionTag)) {
+
+ if (null == tagletPath) {
+ tagletPath = option[1];
+ }
+ else {
+ tagletPath = tagletPath + File.pathSeparator + option[1];
+ }
+ }
+ else if ("-taglet".equals(optionTag)) {
+
+ boolean tagletLoaded = false;
+
+ String useTagletPath = this.tagletPath;
+ if (null == useTagletPath) {
+ useTagletPath = System.getProperty("java.class.path");
+ }
+
+ try {
+ Class tagletClass;
+ try {
+ tagletClass
+ = new FileSystemClassLoader(useTagletPath).loadClass(option[1]);
+ }
+ catch (ClassNotFoundException e) {
+ // If not found on specified tagletpath, try default classloader
+ tagletClass
+ = Class.forName(option[1]);
+ }
+ Method registerTagletMethod
+ = tagletClass.getDeclaredMethod("register", new Class[] { java.util.Map.class });
+
+ if (!registerTagletMethod.getReturnType().equals(Void.TYPE)) {
+ printError("Taglet class '" + option[1] + "' found, but register method doesn't return void.");
+ }
+ else if (registerTagletMethod.getExceptionTypes().length > 0) {
+ printError("Taglet class '" + option[1] + "' found, but register method contains throws clause.");
+ }
+ else if ((registerTagletMethod.getModifiers() & (Modifier.STATIC | Modifier.PUBLIC | Modifier.ABSTRACT)) != (Modifier.STATIC | Modifier.PUBLIC)) {
+ printError("Taglet class '" + option[1] + "' found, but register method isn't public static, or is abstract..");
+ }
+ else {
+ Map tempMap = new HashMap();
+ registerTagletMethod.invoke(null, new Object[] { tempMap });
+ tagletLoaded = true;
+ String name = (String)tempMap.keySet().iterator().next();
+ Taglet taglet = (Taglet)tempMap.get(name);
+ tagletMap.put(name, taglet);
+ mentionedTags.add(taglet);
+ }
+ }
+ catch (NoSuchMethodException e) {
+ printError("Taglet class '" + option[1] + "' found, but doesn't contain the register method.");
+ }
+ catch (SecurityException e) {
+ printError("Taglet class '" + option[1] + "' cannot be loaded: " + e.getMessage());
+ }
+ catch (InvocationTargetException e) {
+ printError("Taglet class '" + option[1] + "' found, but register method throws exception: " + e.toString());
+ }
+ catch (IllegalAccessException e) {
+ printError("Taglet class '" + option[1] + "' found, but there was a problem when accessing the register method: " + e.toString());
+ }
+ catch (IllegalArgumentException e) {
+ printError("Taglet class '" + option[1] + "' found, but there was a problem when accessing the register method: " + e.toString());
+ }
+ catch (ClassNotFoundException e) {
+ printError("Taglet class '" + option[1] + "' cannot be found.");
+ }
+ if (!tagletLoaded) {
+ return false;
+ }
+ }
+ else if ("-author".equals(optionTag)) {
+ AuthorTaglet.setTagletEnabled(true);
+ }
+ else if ("-version".equals(optionTag)) {
+ VersionTaglet.setTagletEnabled(true);
+ }
+ else if ("-nosince".equals(optionTag)) {
+ SinceTaglet.setTagletEnabled(false);
+ }
+ else if ("-nodeprecated".equals(optionTag)) {
+ DeprecatedTaglet.setTagletEnabled(false);
+ }
+ else if ("-authormail".equals(optionTag)) {
+
+ if ("no-replace".equalsIgnoreCase(option[1])) {
+ AuthorTaglet.setEmailReplacementType(AuthorTaglet.EmailReplacement.NO_REPLACEMENT);
+ }
+ else if ("mailto-name".equalsIgnoreCase(option[1])) {
+ AuthorTaglet.setEmailReplacementType(AuthorTaglet.EmailReplacement.MAILTO_NAME);
+ }
+ else if ("name-mailto-address".equalsIgnoreCase(option[1])) {
+ AuthorTaglet.setEmailReplacementType(AuthorTaglet.EmailReplacement.NAME_MAILTO_ADDRESS);
+ }
+ else if ("name-mangled-address".equalsIgnoreCase(option[1])) {
+ AuthorTaglet.setEmailReplacementType(AuthorTaglet.EmailReplacement.NAME_MANGLED_ADDRESS);
+ }
+ else {
+ printError("Invalid value for option '-authortag-email'. Allowed values are:"
+ + " no-replace, mailto-name, name-mailto-address, name-mangled-address.");
+ return false;
+ }
+ }
+ else if ("-mailmangledot".equals(optionTag)) {
+ AuthorTaglet.setDotReplacement(option[1]);
+ }
+ else if ("-mailmangleat".equals(optionTag)) {
+ AuthorTaglet.setAtReplacement(option[1]);
+ }
+ else if ("-docfilessubdirs".equals(optionTag)) {
+ docFilesSubdirsEnabled = true;
+ }
+ else if ("-excludedocfilessubdir".equals(optionTag)) {
+ StringTokenizer st = new StringTokenizer(option[1]);
+ while (st.hasMoreTokens()) {
+ excludeDocFilesSubDirs.add(st.nextToken());
+ }
+ }
+ else if ("-nonavbar".equals(optionTag)) {
+ docTransletOptions.nonavbar = true;
+ }
+ else if ("-noindex".equals(optionTag)) {
+ docTransletOptions.noindex = true;
+ }
+ else if ("-notree".equals(optionTag)) {
+ docTransletOptions.notree = true;
+ }
+ else if ("-nocomment".equals(optionTag)) {
+ docTransletOptions.nocomment = true;
+ }
+ else if ("-nohelp".equals(optionTag)) {
+ docTransletOptions.nohelp = true;
+ }
+ else if ("-splitindex".equals(optionTag)) {
+ docTransletOptions.splitindex = true;
+ }
+ else if ("-linksource".equals(optionTag)) {
+ docTransletOptions.linksource = true;
+ }
+ else if ("-windowtitle".equals(optionTag)) {
+ docTransletOptions.windowtitle = option[1];
+ }
+ else if ("-helpfile".equals(optionTag)) {
+ docTransletOptions.helpfile = new File(option[1]).toURL().toString();
+ }
+ else if ("-stylesheetfile".equals(optionTag)) {
+ docTransletOptions.stylesheetfile = new File(option[1]).toURL().toString();
+ }
+ else if ("-header".equals(optionTag)) {
+ docTransletOptions.header = option[1];
+ }
+ else if ("-footer".equals(optionTag)) {
+ docTransletOptions.footer = option[1];
+ }
+ else if ("-bottom".equals(optionTag)) {
+ docTransletOptions.bottom = option[1];
+ }
+ else if ("-doctitle".equals(optionTag)) {
+ docTransletOptions.doctitle = option[1];
+ }
+ else if ("-nodeprecatedlist".equals(optionTag)) {
+ docTransletOptions.nodeprecatedlist = true;
+ }
+ else if ("-uses".equals(optionTag)) {
+ docTransletOptions.uses = true;
+ }
+ else if ("-group".equals(optionTag)) {
+ if (!processGroupOption(option[1], option[2])) {
+ printError("Invalid package wildcard list in -group option \"" + option[1] + "\" " + option[2]);
+ return false;
+ }
+ }
+ else if ("-tag".equals(optionTag)) {
+ String tagSpec = option[1];
+ boolean validTagSpec = false;
+ int ndx1 = tagSpec.indexOf(':');
+ if (ndx1 < 0) {
+ Taglet taglet = (Taglet)tagletMap.get(tagSpec);
+ if (null == taglet) {
+ printError("There is no standard tag '" + tagSpec + "'.");
+ }
+ else {
+ if (mentionedTags.contains(taglet)) {
+ printError("Tag '" + tagSpec + "' has been added or moved before.");
+ }
+ else {
+ mentionedTags.add(taglet);
+
+ // re-append taglet
+ tagletMap.remove(tagSpec);
+ tagletMap.put(tagSpec, taglet);
+ }
+ }
+ }
+ else {
+ int ndx2 = tagSpec.indexOf(':', ndx1 + 1);
+ if (ndx2 > ndx1 && ndx2 < tagSpec.length() - 1) {
+ String tagName = tagSpec.substring(0, ndx1);
+ String tagHead = null;
+ if (tagSpec.charAt(ndx2 + 1) == '\"') {
+ if (tagSpec.charAt(tagSpec.length() - 1) == '\"') {
+ tagHead = tagSpec.substring(ndx2 + 2, tagSpec.length() - 1);
+ validTagSpec = true;
+ }
+ }
+ else {
+ tagHead = tagSpec.substring(ndx2 + 1);
+ validTagSpec = true;
+ }
+
+ boolean tagScopeOverview = false;
+ boolean tagScopePackages = false;
+ boolean tagScopeTypes = false;
+ boolean tagScopeConstructors = false;
+ boolean tagScopeMethods = false;
+ boolean tagScopeFields = false;
+ boolean tagDisabled = false;
+
+ tag_option_loop:
+ for (int n=ndx1+1; n<ndx2; ++n) {
+ switch (tagSpec.charAt(n)) {
+ case 'X':
+ tagDisabled = true;
+ break;
+ case 'a':
+ tagScopeOverview = true;
+ tagScopePackages = true;
+ tagScopeTypes = true;
+ tagScopeConstructors = true;
+ tagScopeMethods = true;
+ tagScopeFields = true;
+ break;
+ case 'o':
+ tagScopeOverview = true;
+ break;
+ case 'p':
+ tagScopePackages = true;
+ break;
+ case 't':
+ tagScopeTypes = true;
+ break;
+ case 'c':
+ tagScopeConstructors = true;
+ break;
+ case 'm':
+ tagScopeMethods = true;
+ break;
+ case 'f':
+ tagScopeFields = true;
+ break;
+ default:
+ validTagSpec = false;
+ break tag_option_loop;
+ }
+ }
+
+ if (validTagSpec) {
+ GenericTaglet taglet
+ = new GenericTaglet(tagName,
+ tagHead,
+ tagScopeOverview,
+ tagScopePackages,
+ tagScopeTypes,
+ tagScopeConstructors,
+ tagScopeMethods,
+ tagScopeFields);
+ taglet.setTagletEnabled(!tagDisabled);
+ taglet.register(tagletMap);
+ mentionedTags.add(taglet);
+ }
+ }
+ }
+ if (!validTagSpec) {
+ printError("Value for option -tag must be in format \"<tagname>:Xaoptcmf:<taghead>\".");
+ }
+ }
+ }
+
+ // Use current directory if target directory hasn't been set.
+ if (null == targetDirectory) {
+ targetDirectory = new File(System.getProperty("user.dir"));
+ }
+ if (null != targetContext) {
+ targetContext.setTargetDirectory(targetDirectory);
+ }
+
+ // It is illegal to specify targets AND -xmlonly.
+
+ if (xmlOnly && targets.size() > 0) {
+
+ printError("You can only specify one of -xmlonly and a target format.");
+ return false;
+ }
+
+ // If no target was specified and XML only was not
+ // requested, use HTML as default target.
+
+ if (!xmlOnly && targets.size() == 0) {
+ targets.add(targetContext = htmlTargetContext);
+ }
+
+ // Set the same target directory for all output.
+
+ // FIXME: Allow separate target directories for different
+ // output formats.
+
+ for (Iterator it = targets.iterator(); it.hasNext(); ) {
+ TargetContext t = (TargetContext)it.next();
+ t.setTargetDirectory(targetDirectory);
+ }
+
+ // Create temporary directory if necessary
+
+ if (xmlOnly) {
+
+ xmlTargetDirectory = targetDirectory;
+ }
+ else {
+
+ File workingTopDirectory = new File(workingPath);
+
+ workingDirectory = new File(workingTopDirectory, "gjdoc.tmp."+System.currentTimeMillis());
+
+ if (!workingDirectory.mkdir()) {
+ printError("Cannot create temporary directory at "+System.getProperty("java.io.tmpdir"));
+ return false;
+ }
+
+ File xmlTempDirectory = new File(workingDirectory, "xmloutput");
+
+ if (!xmlTempDirectory.mkdir()) {
+ printError("Cannot create temporary directory for XML output at "+System.getProperty("java.io.tmpdir"));
+ return false;
+ }
+
+ xmlTargetDirectory = xmlTempDirectory;
+ }
+
+ // Create target directory if necessary
+
+ if (!targetDirectory.exists()) {
+ printNotice("Creating destination directory: \""
+ + targetDirectory + "\"");
+ if (!targetDirectory.mkdirs()) {
+ printError("Failed to create destination directory \""
+ + targetDirectory + "\"");
+ return false;
+ }
+ }
+
+ // Check for deprecation
+
+ boolean hasDeprecatedClasses = false;
+ boolean hasDeprecatedInterfaces = false;
+ boolean hasDeprecatedExceptions = false;
+ boolean hasDeprecatedErrors = false;
+ boolean hasDeprecatedMethods = false;
+ boolean hasDeprecatedFields = false;
+
+ {
+ ClassDoc[] classes = rootDoc.classes();
+ for (int i = 0, ilim = classes.length; i < ilim; ++ i) {
+ ClassDoc c = classes[i];
+ Tag[] deprecatedTags = c.tags("deprecated");
+ if (null != deprecatedTags && 0 != deprecatedTags.length) {
+ if (c.isInterface()) {
+ hasDeprecatedInterfaces = true;
+ }
+ else if (c.isException()) {
+ hasDeprecatedExceptions = true;
+ }
+ else if (c.isError()) {
+ hasDeprecatedErrors = true;
+ }
+ else /*if (c.isOrdinaryClass())*/ {
+ hasDeprecatedClasses = true;
+ }
+ }
+
+ MethodDoc[] methods = c.methods();
+ for (int j = 0, jlim = methods.length; j < jlim; ++ j) {
+ MethodDoc m = methods[j];
+ deprecatedTags = m.tags("deprecated");
+ if (null != deprecatedTags && 0 != deprecatedTags.length) {
+ hasDeprecatedMethods = true;
+ }
+ }
+
+ FieldDoc[] fields = c.fields();
+ for (int j = 0, jlim = fields.length; j < jlim; ++ j) {
+ FieldDoc f = fields[j];
+ deprecatedTags = f.tags("deprecated");
+ if (null != deprecatedTags && 0 != deprecatedTags.length) {
+ hasDeprecatedFields = true;
+ }
+ }
+ }
+ }
+
+ htmlRepairer = new HtmlRepairer(rootDoc, noHTMLWarn, noEmailWarn,
+ currentClass, currentMember,
+ false);
+
+ collectUsage();
+
+ // Begin XML generation
+
+ printNotice("Writing XML Index file...");
+
+ // Assign output stream
+
+ setTargetFile("index.xml");
+
+ // Output XML document header
+
+ println(0, "<?xml version=\"1.0\"?>");
+ println("<!DOCTYPE gjdoc SYSTEM \"dtd/gjdoc.dtd\">");
+ println();
+ printOpenTag(0, "rootdoc xmlns=\"http://www.w3.org/TR/REC-html40\" xmlns:gjdoc=\"http://www.gnu.org/software/cp-tools/gjdocxml\"");
+
+ println();
+ println(1, "<!-- Tags from overview page, if available -->");
+
+ if (rootDoc.firstSentenceTags().length > 0) {
+ printOpenTag(2, "firstSentenceTags", false);
+ outputTags(3, rootDoc.firstSentenceTags(), true, CONTEXT_PACKAGE);
+ printCloseTag(0, "firstSentenceTags");
+ }
+
+ if (rootDoc.inlineTags().length > 0) {
+ printOpenTag(2, "inlineTags");
+ outputTags(3, rootDoc.inlineTags(), true, CONTEXT_PACKAGE);
+ printCloseTag(2, "inlineTags");
+ }
+
+ if (null != bottomNote) {
+ printOpenTag(1, "bottomnote");
+ print(bottomNote);
+ printCloseTag(1, "bottomnote");
+ }
+
+ if (null != title) {
+ printOpenTag(1, "title");
+ println(2, title);
+ printCloseTag(1, "title");
+ }
+
+ printOpenTag(1, "created");
+ println(2, DateFormat.getDateInstance(DateFormat.LONG, Locale.US).format(new java.util.Date()));
+ printCloseTag(1, "created");
+
+ if (hasDeprecatedClasses) printAtomTag(1, "hasDeprecatedClasses");
+ if (hasDeprecatedInterfaces) printAtomTag(1, "hasDeprecatedInterfaces");
+ if (hasDeprecatedExceptions) printAtomTag(1, "hasDeprecatedExceptions");
+ if (hasDeprecatedErrors) printAtomTag(1, "hasDeprecatedErrors");
+ if (hasDeprecatedMethods) printAtomTag(1, "hasDeprecatedMethods");
+ if (hasDeprecatedFields) printAtomTag(1, "hasDeprecatedFields");
+
+ // Output summary of all classes specified on command line
+
+ println();
+ println(1, "<!-- Classes specified by user on command line -->");
+ ClassDoc[] specifiedClasses = rootDoc.specifiedClasses();
+ for (int i=0, ilim=specifiedClasses.length; i<ilim; ++i) {
+ ClassDoc sc = specifiedClasses[i];
+ printAtomTag(1, "specifiedclass fqname=\""+sc.qualifiedName()+"\" name=\""+sc.name()+"\"");
+ }
+ specifiedClasses = null;
+
+ // Output summary of all packages specified on command line
+
+ println();
+ println(1, "<!-- Packages specified by user on command line -->");
+ PackageDoc[] specifiedPackages = rootDoc.specifiedPackages();
+ for (int i=0, ilim=specifiedPackages.length; i<ilim; ++i) {
+ PackageDoc sp = specifiedPackages[i];
+ printAtomTag(1, "specifiedpackage name=\""+sp.name()+"\"");
+ }
+ specifiedPackages = null;
+
+ // Output package group information specified on the
+ // command line
+
+ println();
+ println(1, "<!-- Package groups specified by user on command line -->");
+ {
+ Iterator packageGroupIt = packageGroups.iterator();
+ while (packageGroupIt.hasNext()) {
+ PackageGroup packageGroup = (PackageGroup)packageGroupIt.next();
+ SortedSet groupedPackages = packageGroup.getPackages();
+ if (groupedPackages.isEmpty()) {
+ printWarning("Package group named '"
+ + packageGroup.getName() + "' didn't match any packages.");
+ }
+ else {
+ printOpenTag(1, "packagegroup name=\"" + packageGroup.getName() + "\"");
+ Iterator groupedPackageIt = groupedPackages.iterator();
+ while (groupedPackageIt.hasNext()) {
+ PackageDoc groupedPackageDoc = (PackageDoc)groupedPackageIt.next();
+ printAtomTag(2, "package name=\"" + groupedPackageDoc.name() + "\"");
+ }
+ printCloseTag(1, "packagegroup");
+ }
+ }
+ packageGroups = null;
+ }
+
+ // Output information on all packages for which documentation
+ // has been made available via the Doclet API
+
+ println();
+ println(1, "<!-- Documentation for all packages -->");
+ PackageDoc[] packages = rootDoc.specifiedPackages();
+ for (int i=0, ilim=packages.length; i<ilim; ++i) {
+ PackageDoc c = packages[i];
+ outputPackageDoc(c);
+ }
+ packages = null;
+
+ // Output brief summary on all classes for which documentation
+ // has been made available via the Doclet API.
+ //
+ // While this is redundant, it can speed up XSLT
+ // processing by orders of magnitude
+
+ println();
+ println(1, "<!-- Brief summary for all classes -->");
+ ClassDoc[] sumclasses = rootDoc.classes();
+ for (int i=0, ilim=sumclasses.length; i<ilim; ++i) {
+ ClassDoc c = sumclasses[i];
+ outputClassDocSummary(c);
+ }
+ sumclasses = null;
+
+ // Output closing tag, finish output stream
+
+ println();
+ printCloseTag(0, "rootdoc");
+
+ closeTargetFile();
+
+ createIndexByName();
+
+
+
+ // Output information on all classes for which documentation
+ // has been made available via the Doclet API
+
+ println();
+ println(1, "<!-- Documentation for all classes -->");
+ ClassDoc[] classes = rootDoc.classes();
+ String prevPackageName = null;
+ for (int i = 0, ilim = classes.length; i < ilim; ++ i) {
+ ClassDoc c = classes[i];
+
+ if (isVerbose()) {
+ printNotice("Writing XML information for "+c.qualifiedName()+"...");
+ }
+ else {
+ String packageName = c.containingPackage().name();
+ if (null == prevPackageName || !packageName.equals(prevPackageName)) {
+ printNotice("Writing XML information for "+packageName+"...");
+ prevPackageName = packageName;
+ }
+ }
+
+ setTargetFile(c.qualifiedName().replace('/','.')+".xml");
+
+ println("<?xml version=\"1.0\"?>");
+ println("<!DOCTYPE gjdoc SYSTEM \"dtd/gjdoc.dtd\">");
+
+ outputClassDoc(c);
+
+ closeTargetFile();
+ }
+ classes = null;
+ }
+
+ // Copy DTD files to temporary directory
+
+ // FIXME: try to solve this via jar: URLs. but this will
+ // probably break libxmlj compatibility (?)
+
+ String[] resources = new String[] {
+ "gjdoc.dtd",
+ "gjdoc-alphaindex.dtd",
+ "dbcentx.mod",
+ "ent/iso-amsa.ent",
+ "ent/iso-amsb.ent",
+ "ent/iso-amsc.ent",
+ "ent/iso-amsn.ent",
+ "ent/iso-amso.ent",
+ "ent/iso-amsr.ent",
+ "ent/iso-box.ent",
+ "ent/iso-cyr1.ent",
+ "ent/iso-cyr2.ent",
+ "ent/iso-dia.ent",
+ "ent/iso-grk1.ent",
+ "ent/iso-grk2.ent",
+ "ent/iso-grk3.ent",
+ "ent/iso-grk4.ent",
+ "ent/iso-lat1.ent",
+ "ent/iso-lat2.ent",
+ "ent/iso-num.ent",
+ "ent/iso-pub.ent",
+ "ent/iso-tech.ent",
+ };
+
+ File tempDtdDirectory = new File(xmlTargetDirectory, "dtd");
+ File tempDtdEntDirectory = new File(tempDtdDirectory, "ent");
+
+ if ((tempDtdDirectory.exists() || tempDtdDirectory.mkdir())
+ && (tempDtdEntDirectory.exists() || tempDtdEntDirectory.mkdir())) {
+ for (int i = 0; i < resources.length; ++ i) {
+ copyResourceToFile("/dtd/" + resources[i],
+ new File(tempDtdDirectory, resources[i]));
+ }
+ }
+ else {
+ printError("Cannot create temporary directories for DTD data at " + tempDtdDirectory);
+ return false;
+ }
+
+ // Copy package data-dir directory
+
+ {
+ PackageDoc[] packages = rootDoc.specifiedPackages();
+ for (int i=0, ilim=packages.length; i<ilim; ++i) {
+ PackageDoc c = packages[i];
+ if (c instanceof GjdocPackageDoc) {
+ copyPackageDataDir((GjdocPackageDoc)c);
+ }
+ }
+ }
+
+ // All information has been output. Apply stylesheet if given.
+
+ gnu.classpath.tools.gjdoc.Main.releaseRootDoc();
+
+ this.currentClass = null;
+ this.currentMember = null;
+ this.currentExecMember = null;
+
+ System.gc();
+
+ // From this point we are only operating on files, so we don't
+ // need this anymore and can free up some memory
+
+ for (Iterator it = targets.iterator(); it.hasNext(); ) {
+
+ TargetContext target = (TargetContext)it.next();
+
+ // We have XSLT postprocessing, run DocTranslet.
+
+ //DocTranslet docTranslet = DocTranslet.fromClasspath("/doctranslets/html/gjdoc.xsl");
+
+ //docTranslet.setOptions(docTransletOptions);
+
+ target.getDocTranslet().setOptions(docTransletOptions);
+
+ target.getDocTranslet().apply(xmlTargetDirectory,
+ target.getTargetDirectory(),
+ rootDoc);
+ }
+
+ // Done
+
+ targets = null;
+
+ System.gc();
+ Runtime.getRuntime().runFinalization();
+
+ return true;
+ }
+ catch (Exception e) {
+
+ // Something went wrong. Report to stderr and pass error to
+ // Javadoc Reporter
+
+ e.printStackTrace();
+ printError(e.toString());
+
+ Throwable rootCause = e.getCause();
+ if (null != rootCause) {
+ while (null != rootCause.getCause()) {
+ rootCause = rootCause.getCause();
+ }
+ System.err.println("Root cause:");
+ rootCause.printStackTrace();
+ }
+
+ return false;
+ }
+ finally {
+
+ // In any case, delete the working directory if we created one
+
+ if (null != workingDirectory) {
+
+ if (!deleteRecursive(workingDirectory)) {
+ printWarning("Could not delete temporary directory at "+workingDirectory);
+ }
+ }
+
+ printNotice("Done.");
+ }
+ }
+
+ /**
+ * Recursively delete the specified directory and its contents,
+ * like <code>rm -Rf directory</code>
+ *
+ * @return <code>true</code> on success
+ */
+ private static boolean deleteRecursive(File directory) {
+
+ boolean success = true;
+
+ File[] files = directory.listFiles();
+
+ for (int i=0, ilim=files.length; i<ilim; ++i) {
+
+ File file = files[i];
+
+ if (file.isDirectory()) {
+
+ success = deleteRecursive(file) && success;
+ }
+ else {
+
+ success = file.delete() && success;
+ }
+ }
+
+ return directory.delete() && success;
+ }
+
+ /**
+ * Prints a string to stdout and appends a newline. Convenience
+ * method.
+ */
+ protected void println(String str) {
+ out.println(str);
+ }
+
+ /**
+ * Prints a string to stdout without appending a newline.
+ * Convenience method.
+ */
+ protected void print(String str) {
+ out.print(str);
+ }
+
+ /**
+ * In standard mode, prints an empty line to stdout.
+ * In thight mode, nothing happens.
+ * Convenience method.
+ */
+ protected void println() {
+ if (!compress) {
+ out.println();
+ }
+ }
+
+ /**
+ * In standard mode, prints the given text indented to stdout and appends newline.
+ * In tight mode, doesn't print indentation or newlines.
+ */
+ protected void print(int indentLevel, String msg) {
+ if (compress) {
+ out.print(msg);
+ }
+ else {
+ StringBuffer indentation = new StringBuffer();
+ for (int i=0; i<indentLevel*indentStep; ++i) {
+ indentation.append(' ');
+ }
+ out.print(indentation+msg);
+ }
+ }
+
+ /**
+ * In tight mode, prints a message at a given indentation level.
+ * In standard mode, appends a newline in addition.
+ */
+ protected void println(int indentLevel, String msg) {
+ print(indentLevel, msg);
+ if (!compress) out.println();
+ }
+
+ /**
+ * Prints an atom tag at the given indentation level.
+ */
+ protected void printAtomTag(int level, String tag) {
+ println(level, "<"+tagPrefix+":"+replaceCharsInTag(tag)+"/>");
+ }
+
+ /**
+ * Prints an open tag at the given indentation level.
+ */
+ protected void printOpenTag(int level, String tag) {
+ printOpenTag(level, replaceCharsInTag(tag), true);
+ }
+
+ /**
+ * Prints an open tag at the given indentation level and
+ * conditionally appends a newline (if not in tight mode).
+ */
+ protected void printOpenTag(int level, String tag, boolean appendNewline) {
+ if (appendNewline && !compress) {
+ println(level, "<"+tagPrefix+":"+replaceCharsInTag(tag)+">");
+ }
+ else {
+ print(level, "<"+tagPrefix+":"+replaceCharsInTag(tag)+">");
+ }
+ }
+
+ /**
+ * Prints a close tag at the given indentation level.
+ */
+ protected void printCloseTag(int level, String tag) {
+ printCloseTag(level, tag, true);
+ }
+
+ /**
+ * Prints a close tag at the given indentation level and
+ * conditionally appends a newline (if not in tight mode).
+ */
+ protected void printCloseTag(int level, String tag, boolean appendNewline) {
+ if (appendNewline && !compress) {
+ println(level, "</"+tagPrefix+":"+replaceCharsInTag(tag)+">");
+ }
+ else {
+ print(level, "</"+tagPrefix+":"+replaceCharsInTag(tag)+">");
+ }
+ }
+
+ public static int optionLength(String option) {
+ if ("-d".equals(option)) return 2;
+ else if ("-fixhtml".equals(option)) return 1;
+ else if ("-compress".equals(option)) return 1;
+ else if ("-nohtmlwarn".equals(option)) return 1;
+ else if ("-noemailwarn".equals(option)) return 1;
+ else if ("-indentstep".equals(option)) return 2;
+ else if ("-xslsheet".equals(option)) return 2;
+ else if ("-xsltdriver".equals(option)) return 2;
+ else if ("-postprocess".equals(option)) return 2;
+ else if ("-genhtml".equals(option)) return 1;
+ else if ("-geninfo".equals(option)) return 1;
+ else if ("-gendocbook".equals(option)) return 1;
+ else if ("-xmlonly".equals(option)) return 1;
+ else if ("-bottomnote".equals(option)) return 2;
+ else if ("-workpath".equals(option)) return 2;
+ else if ("-title".equals(option)) return 2;
+ else if ("-tagletpath".equals(option)) return 2;
+ else if ("-taglet".equals(option)) return 2;
+ else if ("-authormail".equals(option)) return 2;
+ else if ("-mailmangledot".equals(option)) return 2;
+ else if ("-mailmangleat".equals(option)) return 2;
+ else if ("-noindex".equals(option)) return 1;
+ else if ("-nocomment".equals(option)) return 1;
+ else if ("-notree".equals(option)) return 1;
+ else if ("-nohelp".equals(option)) return 1;
+ else if ("-nonavbar".equals(option)) return 1;
+ else if ("-splitindex".equals(option)) return 1;
+ else if ("-author".equals(option)) return 1;
+ else if ("-version".equals(option)) return 1;
+ else if ("-nosince".equals(option)) return 1;
+ else if ("-nodeprecated".equals(option)) return 1;
+ else if ("-linksource".equals(option)) return 1;
+ else if ("-windowtitle".equals(option)) return 2;
+ else if ("-helpfile".equals(option)) return 2;
+ else if ("-stylesheetfile".equals(option)) return 2;
+ else if ("-tag".equals(option)) return 2;
+ else if ("-header".equals(option)) return 2;
+ else if ("-footer".equals(option)) return 2;
+ else if ("-bottom".equals(option)) return 2;
+ else if ("-doctitle".equals(option)) return 2;
+ else if ("-nodeprecatedlist".equals(option)) return 1;
+ else if ("-uses".equals(option)) return 1;
+ else if ("-group".equals(option)) return 3;
+
+ else return -1;
+ }
+
+ public static boolean validOptions(String[][] options) {
+ return true;
+ }
+
+
+ /**
+ * Workaround for non well-formed comments: fix tag contents
+ * by replacing <code>&lt;</code> with <code>&amp;lt;</code>,
+ * <code>&gt;</code> with <code>&amp;gt;</code> and
+ * <code>&amp;</code> with <code>&amp;amp;</code>.
+ *
+ * @param tagContent String to process
+ *
+ * @return given String with all special characters replaced by
+ * HTML entities.
+ */
+ private static String replaceCharsInTag(String tagContent) {
+ return
+ replaceString(
+ replaceString(
+ replaceString(
+ tagContent,
+ "<", "&lt;"
+ ),
+ ">", "&gt;"
+ ),
+ "&", "&amp;"
+ );
+ }
+
+ /**
+ * Replaces all occurences of string <code>needle</code> within string
+ * <code>haystack</code> by string <code>replacement</code>.
+ *
+ * @param haystack The string to search and replace in.
+ * @param needle The string which is searched for.
+ * @param replacement The string by which every occurence of <code>needle</code> is replaced.
+ */
+ private static String replaceString(String haystack, String needle, String replacement) {
+ int ndx = haystack.indexOf(needle);
+ if (ndx<0)
+ return haystack;
+ else
+ return haystack.substring(0, ndx) + replacement
+ + replaceString(haystack.substring(ndx+needle.length()), needle, replacement);
+ }
+
+ protected void setTargetFile(String filename) throws IOException {
+
+ OutputStream fileOut = new FileOutputStream(new File(xmlTargetDirectory, filename));
+ out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(fileOut, "UTF8")));;
+ }
+
+ protected void closeTargetFile() {
+
+ out.flush();
+ out.close();
+ }
+
+ private String cdata(String str) {
+
+ if (null==str) {
+ return str;
+ } // end of if ((null==str)
+
+ StringBuffer rc = new StringBuffer();
+ for (int i=0; i<str.length(); ++i) {
+ char c = str.charAt(i);
+ if (c==0x09 || c==0x0a || c==0x0d || (c>=0x20 && c<=0xd7ff) || (c>=0xe000 && c<=0xfffd) || (c>=0x10000 && c<=0x10ffff)) {
+ rc.append(c);
+ }
+ else {
+ printWarning("Invalid Unicode character 0x"+Integer.toString(c, 16)+" in javadoc markup has been stripped.");
+ } // end of else
+
+ }
+ return rc.toString();
+ }
+
+ static void copyResourceToFile(String resourceName, File target) throws IOException {
+
+ InputStream in = Driver.class.getResourceAsStream(resourceName);
+
+ if (null != in) {
+
+ FileOutputStream out = new FileOutputStream(target);
+ int size;
+ byte[] buffer = new byte[512];
+ while ((size = in.read(buffer)) >= 0) {
+ out.write(buffer, 0, size);
+ }
+ out.close();
+ }
+ else {
+
+ throw new IOException("Can't find resource named "+resourceName);
+ }
+ }
+
+ private void printError(String error) {
+ if (null != rootDoc) {
+ rootDoc.printError(error);
+ }
+ else {
+ System.err.println("ERROR: "+error);
+ }
+ }
+
+ private void printWarning(String warning) {
+ if (null != rootDoc) {
+ rootDoc.printWarning(warning);
+ }
+ else {
+ System.err.println("WARNING: "+warning);
+ }
+ }
+
+ private void printNotice(String notice) {
+ if (null != rootDoc) {
+ rootDoc.printNotice(notice);
+ }
+ else {
+ System.err.println(notice);
+ }
+ }
+
+ /**
+ * Copy the contents of the input directory to the output
+ * directory. The output directory must exist.
+ */
+ private void copyPackageDataDir(GjdocPackageDoc packageDoc) throws IOException {
+ File docFilesSourceDirectory
+ = new File(packageDoc.packageDirectory(), "doc-files");
+ File docFilesTargetDirectory
+ = new File(this.targetDirectory,
+ packageDoc.name().replace('.', File.separatorChar));
+ if (docFilesSourceDirectory.exists()) {
+ printNotice("Copying files from " + docFilesSourceDirectory);
+ copyDirectory(docFilesSourceDirectory, docFilesTargetDirectory,
+ docFilesSubdirsEnabled,
+ excludeDocFilesSubDirs);
+ }
+ }
+
+ /**
+ * Recursively copy the contents of the input directory to the
+ * output directory. The output directory must exist.
+ */
+ private static void copyDirectory(File sourceDir, File targetDir,
+ boolean recursive,
+ Set excludeDirs) throws IOException {
+ if (!targetDir.exists() && !targetDir.mkdirs()) {
+ throw new IOException("Cannot create directory " + targetDir);
+ }
+
+ File[] sourceFiles = sourceDir.listFiles();
+ for (int i=0; i<sourceFiles.length; ++i) {
+ if (sourceFiles[i].isDirectory()) {
+ if (recursive && (null == excludeDirs
+ || !excludeDirs.contains(sourceFiles[i].getName()))) {
+ File targetSubDir = new File(targetDir,
+ sourceFiles[i].getName());
+ if (targetSubDir.exists() || targetSubDir.mkdir()) {
+ copyDirectory(sourceFiles[i], targetSubDir, recursive, null);
+ }
+ else {
+ throw new IOException("Cannot create directory " + targetSubDir);
+ }
+ }
+ }
+ else {
+ copyFile(sourceFiles[i], new File(targetDir, sourceFiles[i].getName()));
+ }
+ }
+ }
+
+ /**
+ * Copy the contents of the input file to the output file. The
+ * output file's parent directory must exist.
+ */
+ private static void copyFile(File sourceFile, File targetFile) throws IOException {
+
+ InputStream in = new FileInputStream(sourceFile);
+ OutputStream out = new FileOutputStream(targetFile);
+ int nread;
+ byte[] buf = new byte[512];
+ while ((nread = in.read(buf)) >= 0) {
+ out.write(buf, 0, nread);
+ }
+ in.close();
+ out.close();
+ }
+
+ private void createIndexByName() throws IOException {
+ // Create index
+
+ // Collect index
+
+ Map indexMap = new TreeMap(new Comparator() {
+ public int compare(Object o1, Object o2) {
+ return o1.toString().toLowerCase().compareTo(o2.toString().toLowerCase());
+ }
+ });
+
+ // Add packages to index
+
+ PackageDoc[] packages = rootDoc.specifiedPackages();
+ for (int i=0, ilim=packages.length; i<ilim; ++i) {
+ PackageDoc c = packages[i];
+ indexMap.put(c.name(), c);
+ }
+
+ // Add classes, fields and methods to index
+
+ ClassDoc[] sumclasses = rootDoc.classes();
+ for (int i=0, ilim=sumclasses.length; i<ilim; ++i) {
+ ClassDoc c = sumclasses[i];
+ if (null == c.containingClass()) {
+ indexMap.put(c.name(), c);
+ }
+ else {
+ indexMap.put(c.name().substring(c.containingClass().name().length() + 1), c);
+ }
+ FieldDoc[] fields = c.fields();
+ for (int j=0, jlim=fields.length; j<jlim; ++j) {
+ indexMap.put(fields[j].name(), fields[j]);
+ }
+ MethodDoc[] methods = c.methods();
+ for (int j=0, jlim=methods.length; j<jlim; ++j) {
+ MethodDoc method = methods[j];
+ StringBuffer signature = new StringBuffer();
+ signature.append(method.name());
+ signature.append('(');
+ Parameter[] parameters = method.parameters();
+ for (int k=0, klim=parameters.length; k<klim; ++k) {
+ if (k > 0) {
+ signature.append(", ");
+ }
+ signature.append(parameters[k].typeName());
+ }
+ signature.append(')');
+ indexMap.put(signature.toString(), method);
+ }
+ }
+
+ // Assign output stream
+
+ setTargetFile("alphaindex.xml");
+
+ // Output XML document header
+
+ println(0, "<?xml version=\"1.0\"?>");
+ println("<!DOCTYPE gjdoc SYSTEM \"dtd/gjdoc-alphaindex.dtd\">");
+ println();
+ printOpenTag(0, "alphaindex xmlns=\"http://www.w3.org/TR/REC-html40\" xmlns:gjdoc=\"http://www.gnu.org/software/cp-tools/gjdocxml\"");
+
+ Iterator it = indexMap.keySet().iterator();
+
+ char previousCategoryLetter = '\0';
+ boolean categoryOpen = false;
+
+ while (it.hasNext()) {
+ String key = (String)it.next();
+ Doc entry = (Doc)indexMap.get(key);
+
+ char firstChar = Character.toUpperCase(key.charAt(0));
+ if (firstChar != previousCategoryLetter) {
+ if (categoryOpen) {
+ printCloseTag(1, "category");
+ }
+ printOpenTag(1, "category letter=\"" + firstChar + "\"");
+ categoryOpen = true;
+ previousCategoryLetter = firstChar;
+ }
+
+ printOpenTag(2, "entry name=\"" + key + "\"");
+ if (entry instanceof PackageDoc) {
+ printAtomTag(3, "isPackage");
+ }
+ else if (entry instanceof ClassDoc) {
+ printAtomTag(3, "isClass");
+ ClassDoc centry = (ClassDoc)entry;
+ currentClass = centry;
+ printAtomTag(3, "containingPackage name=\"" + centry.containingPackage().name() + "\"");
+ if (null != centry.containingClass()) {
+ printAtomTag(3, "containingClass name=\"" + centry.containingClass().name() + "\"");
+ }
+ if (centry.isInterface()) {
+ printAtomTag(3, "isInterface");
+ }
+ if (centry.isException()) {
+ printAtomTag(3, "isException");
+ }
+ if (centry.isError()) {
+ printAtomTag(3, "isError");
+ }
+ if (centry.isOrdinaryClass()) {
+ printAtomTag(3, "isOrdinaryClass");
+ }
+ }
+ else if (entry instanceof ProgramElementDoc) {
+ ProgramElementDoc pentry = (ProgramElementDoc)entry;
+ currentClass = pentry.containingClass();
+ printAtomTag(3, "containingPackage name=\"" + pentry.containingPackage().name() + "\"");
+ printAtomTag(3, "containingClass name=\"" + pentry.containingClass().name() + "\"");
+ if (pentry.isMethod()) {
+ printAtomTag(3, "isMethod");
+ ExecutableMemberDoc mentry = (ExecutableMemberDoc)pentry;
+ printAtomTag(3, "signature full=\""+mentry.signature()+"\" flat=\""+mentry.flatSignature()+"\"");
+ printAtomTag(3, "method name=\"" + mentry.name() + "\"");
+ }
+ if (pentry.isField()) {
+ printAtomTag(3, "isField");
+ }
+ }
+
+ Tag[] tags = entry.firstSentenceTags();
+ for (int i=0, ilim=tags.length; i<ilim; ++i) {
+ Tag tag = tags[i];
+ if (tag.firstSentenceTags().length>0) {
+ printOpenTag(3, "firstSentenceTags", false);
+ outputTags(4, tag.firstSentenceTags(), false, CONTEXT_TYPE);
+ printCloseTag(3, "firstSentenceTags");
+ }
+ }
+
+
+ printCloseTag(2, "entry");
+ }
+
+ if (categoryOpen) {
+ printCloseTag(1, "category");
+ }
+
+ printCloseTag(0, "alphaindex");
+
+ closeTargetFile();
+ }
+
+ private static class UsageType
+ {
+ public static final UsageType CLASS_DERIVED_FROM = new UsageType("class-derived-from");
+ public static final UsageType FIELD_OF_TYPE = new UsageType("field-of-type");
+ public static final UsageType METHOD_WITH_RETURN_TYPE = new UsageType("method-with-return-type");
+ public static final UsageType METHOD_WITH_PARAMETER_TYPE = new UsageType("method-with-parameter-type");
+ public static final UsageType METHOD_WITH_THROWN_TYPE = new UsageType("method-with-thrown-type");
+ public static final UsageType CONSTRUCTOR_WITH_PARAMETER_TYPE = new UsageType("constructor-with-parameter-type");
+ public static final UsageType CONSTRUCTOR_WITH_THROWN_TYPE = new UsageType("constructor-with-thrown-type");
+ private String id;
+
+ private UsageType(String id)
+ {
+ this.id = id;
+ }
+
+ public String toString() {
+ return "UsageType{id=" + id + "}";
+ }
+
+ public String getId() {
+ return id;
+ }
+ }
+
+ /**
+ * ClassDoc -> (PackageDoc -> (UsageType -> (Set of Doc)))
+ */
+ private Map usedClassToPackagesMap = new HashMap();
+
+ private void addUsedBy(ClassDoc usedClass, UsageType usageType, Doc user, PackageDoc userPackage)
+ {
+ Map packageToUsageTypeMap = (Map)usedClassToPackagesMap.get(usedClass);
+ if (null == packageToUsageTypeMap) {
+ packageToUsageTypeMap = new HashMap();
+ usedClassToPackagesMap.put(usedClass, packageToUsageTypeMap);
+ }
+
+ Map usageTypeToUsersMap = (Map)packageToUsageTypeMap.get(userPackage);
+ if (null == usageTypeToUsersMap) {
+ usageTypeToUsersMap = new HashMap();
+ packageToUsageTypeMap.put(userPackage, usageTypeToUsersMap);
+ }
+
+ Set userSet = (Set)usageTypeToUsersMap.get(usageType);
+ if (null == userSet) {
+ userSet = new TreeSet(); // FIXME: we need the collator from Main here
+ usageTypeToUsersMap.put(usageType, userSet);
+ }
+ userSet.add(user);
+ }
+
+ /**
+ * Create the cross reference database.
+ */
+ private void collectUsage() {
+
+ ClassDoc[] classes = rootDoc.classes();
+ for (int i = 0, ilim = classes.length; i < ilim; ++ i) {
+ ClassDoc clazz = classes[i];
+
+ // classes derived from
+ for (ClassDoc superclass = clazz.superclass(); superclass != null;
+ superclass = superclass.superclass()) {
+ addUsedBy(superclass, UsageType.CLASS_DERIVED_FROM, clazz, clazz.containingPackage());
+ }
+
+ FieldDoc[] fields = clazz.fields();
+ for (int j = 0, jlim = fields.length; j < jlim; ++ j) {
+ FieldDoc field = fields[j];
+
+ // fields of type
+ ClassDoc fieldType = field.type().asClassDoc();
+ if (null != fieldType) {
+ addUsedBy(fieldType, UsageType.FIELD_OF_TYPE,
+ field, clazz.containingPackage());
+ }
+ }
+
+ MethodDoc[] methods = clazz.methods();
+ for (int j = 0, jlim = methods.length; j < jlim; ++ j) {
+ MethodDoc method = methods[j];
+
+ // methods with return type
+
+ ClassDoc returnType = method.returnType().asClassDoc();
+ if (null != returnType) {
+ addUsedBy(returnType, UsageType.METHOD_WITH_RETURN_TYPE,
+ method, clazz.containingPackage());
+ }
+ Parameter[] parameters = method.parameters();
+ for (int k=0; k<parameters.length; ++k) {
+
+ // methods with parameter type
+
+ Parameter parameter = parameters[k];
+ ClassDoc parameterType = parameter.type().asClassDoc();
+ if (null != parameterType) {
+ addUsedBy(parameterType, UsageType.METHOD_WITH_PARAMETER_TYPE,
+ method, clazz.containingPackage());
+ }
+ }
+
+ // methods which throw
+
+ ClassDoc[] thrownExceptions = method.thrownExceptions();
+ for (int k = 0, klim = thrownExceptions.length; k < klim; ++ k) {
+ ClassDoc thrownException = thrownExceptions[k];
+ addUsedBy(thrownException, UsageType.METHOD_WITH_THROWN_TYPE,
+ method, clazz.containingPackage());
+ }
+ }
+
+ ConstructorDoc[] constructors = clazz.constructors();
+ for (int j = 0, jlim = constructors.length; j < jlim; ++ j) {
+
+ ConstructorDoc constructor = constructors[j];
+
+ Parameter[] parameters = constructor.parameters();
+ for (int k = 0, klim = parameters.length; k < klim; ++ k) {
+
+ // constructors with parameter type
+
+ Parameter parameter = parameters[k];
+ ClassDoc parameterType = parameter.type().asClassDoc();
+ if (null != parameterType) {
+ addUsedBy(parameterType, UsageType.CONSTRUCTOR_WITH_PARAMETER_TYPE,
+ constructor, clazz.containingPackage());
+ }
+ }
+
+ // constructors which throw
+
+ ClassDoc[] thrownExceptions = constructor.thrownExceptions();
+ for (int k = 0, klim = thrownExceptions.length; k < klim; ++ k) {
+ ClassDoc thrownException = thrownExceptions[k];
+ addUsedBy(thrownException, UsageType.CONSTRUCTOR_WITH_THROWN_TYPE,
+ constructor, clazz.containingPackage());
+ }
+ }
+ }
+ }
+
+ private void outputUsage(ClassDoc clazz, int level) {
+
+ Map packageToUsageTypeMap = (Map)usedClassToPackagesMap.get(clazz);
+ if (null != packageToUsageTypeMap) {
+ printOpenTag(level, "references");
+
+ Iterator packagesIterator = packageToUsageTypeMap.keySet().iterator();
+
+ while (packagesIterator.hasNext()) {
+ PackageDoc packageDoc = (PackageDoc)packagesIterator.next();
+ printOpenTag(level + 1, "referencing-package name=\"" + packageDoc.name() + "\"");
+ Map usageTypeToUsersMap = (Map)packageToUsageTypeMap.get(packageDoc);
+ Iterator usageTypeIterator = usageTypeToUsersMap.keySet().iterator();
+ while (usageTypeIterator.hasNext()) {
+ UsageType usageType = (UsageType)usageTypeIterator.next();
+ printOpenTag(level + 2, "usage-type id=\"" + usageType.getId() + "\"");
+ Set users = (Set)usageTypeToUsersMap.get(usageType);
+ Iterator userIterator = users.iterator();
+ while (userIterator.hasNext()) {
+ Doc user = (Doc)userIterator.next();
+ if (user instanceof ClassDoc) {
+ printAtomTag(level + 3, "user"
+ + " class=\"" + ((ClassDoc)user).name() + "\"");
+ }
+ else if (user instanceof FieldDoc) {
+ FieldDoc fieldDoc = (FieldDoc)user;
+ printAtomTag(level + 3, "user"
+ + " class=\"" + fieldDoc.containingClass().name() + "\""
+ + " field=\"" + fieldDoc.name() + "\"");
+ }
+ else if (user instanceof MethodDoc) {
+ MethodDoc methodDoc = (MethodDoc)user;
+ printAtomTag(level + 3, "user"
+ + " class=\"" + methodDoc.containingClass().name() + "\""
+ + " method=\"" + methodDoc.name() + "\""
+ + " signature=\"" + methodDoc.signature() + "\""
+ + " flatSignature=\"" + methodDoc.flatSignature() + "\"");
+ }
+ else if (user instanceof ConstructorDoc) {
+ ConstructorDoc constructorDoc = (ConstructorDoc)user;
+ printAtomTag(level + 3, "user"
+ + " class=\"" + constructorDoc.containingClass().name() + "\""
+ + " signature=\"" + constructorDoc.signature() + "\""
+ + " flatSignature=\"" + constructorDoc.flatSignature() + "\"");
+ }
+ }
+ printCloseTag(level +2, "usage-type");
+ }
+ printCloseTag(level + 1, "referencing-package");
+ }
+
+ printCloseTag(level, "references");
+ }
+ }
+
+ private boolean processGroupOption(String groupName, String colonSeparatedPackageList)
+ {
+ try {
+ PackageMatcher packageMatcher = new PackageMatcher();
+
+ StringTokenizer tokenizer = new StringTokenizer(colonSeparatedPackageList, ":");
+ while (tokenizer.hasMoreTokens()) {
+ String packageWildcard = tokenizer.nextToken();
+ packageMatcher.addWildcard(packageWildcard);
+ }
+
+ SortedSet groupPackages = packageMatcher.filter(rootDoc.specifiedPackages());
+
+ packageGroups.add(new PackageGroup(groupName, groupPackages));
+
+ return true;
+ }
+ catch (InvalidPackageWildcardException e) {
+ return false;
+ }
+ }
+
+ private void registerTaglet(Taglet taglet)
+ {
+ tagletMap.put(taglet.getName(), taglet);
+ }
+
+ private boolean isVerbose()
+ {
+ return false;
+ }
+}
diff --git a/tools/gnu/classpath/tools/doclets/xmldoclet/Driver1_4.java b/tools/gnu/classpath/tools/doclets/xmldoclet/Driver1_4.java
new file mode 100644
index 000000000..bbb57aca2
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/xmldoclet/Driver1_4.java
@@ -0,0 +1,67 @@
+/* gnu.classpath.tools.doclets.xmldoclet.Driver1_4
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.doclets.xmldoclet;
+
+import com.sun.javadoc.*;
+import java.io.IOException;
+
+/**
+ * A Doclet which retrieves all information presented by the Doclet
+ * API, dumping it to stdout in XML format.
+ *
+ * Supports Doclet API Version 1.4.
+ *
+ * @author Julian Scheid
+ */
+public class Driver1_4 extends Driver {
+
+ /**
+ * Official Doclet entry point.
+ */
+ public static boolean start(RootDoc root) {
+
+ // Create a new XmlDoclet instance and delegate control.
+ return new Driver1_4().instanceStart(root);
+ }
+
+ /* since 1.4
+ private void outputSourcePosition(int level, SourcePosition sourcePosition) {
+ println(level, "<sourceposition"
+ + " file=\""+sourcePosition.file().toString()+"\""
+ + " line=\""+sourcePosition.line()+"\""
+ + " column=\""+sourceposition.column()+"\""
+ + "/>");
+ }
+ */
+
+ protected void outputClassDoc(ClassDoc classDoc)
+ throws IOException
+ {
+ super.outputClassDoc(classDoc);
+ //outputSourcePosition(level, doc.position());
+ }
+
+ protected void outputFieldDocBody(int level, FieldDoc fieldDoc) {
+ super.outputFieldDocBody(level, fieldDoc);
+ //println(level, "<constantValueExpression>"+fieldDoc.constantValueExpression()+"</constantValueExpression>");
+ }
+
+}
diff --git a/tools/gnu/classpath/tools/doclets/xmldoclet/HtmlRepairer.java b/tools/gnu/classpath/tools/doclets/xmldoclet/HtmlRepairer.java
new file mode 100644
index 000000000..df9be0ae5
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/xmldoclet/HtmlRepairer.java
@@ -0,0 +1,674 @@
+/* gnu.classpath.tools.doclets.xmldoclet.HtmlRepairer.java
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.doclets.xmldoclet;
+
+import java.io.*;
+import java.util.*;
+import com.sun.javadoc.DocErrorReporter;
+import com.sun.javadoc.ClassDoc;
+import com.sun.javadoc.MemberDoc;
+
+/**
+ * Provides methods for tidying up HTML source.
+ *
+ * @author Julian Scheid
+ */
+public final class HtmlRepairer {
+
+ private static class TagInfo {
+
+ private Set parentTags = new HashSet();
+
+ public TagInfo(String parentTag) {
+ this.parentTags.add(parentTag);
+ }
+
+ public TagInfo(String[] parentTagArr) {
+ for (int i=0; i<parentTagArr.length; ++i) {
+ this.parentTags.add(parentTagArr[i]);
+ }
+ }
+
+ public boolean isLegalParentTag(String tag) {
+ return this.parentTags.contains(tag);
+ }
+ }
+
+ private DocErrorReporter warningReporter;
+ private boolean noWarn;
+ private boolean noEmailWarn;
+ private ClassDoc contextClass;
+ private MemberDoc contextMember;
+ private StringBuffer output = new StringBuffer();
+ private Stack tagStack = new Stack();
+ private boolean isLeadingTag = true;
+ private boolean throwAwayLeadingPara = false;
+
+ private static Map tagInfoMap;
+
+ private static Set noTextParentTags;
+
+ static {
+ tagInfoMap = new HashMap();
+ tagInfoMap.put("li", new TagInfo(new String[] { "ul", "ol", "nl", "menu", "dir" }));
+ tagInfoMap.put("td", new TagInfo(new String[] { "tr" }));
+ tagInfoMap.put("th", new TagInfo(new String[] { "tr" }));
+ tagInfoMap.put("tr", new TagInfo(new String[] { "table" }));
+ tagInfoMap.put("dt", new TagInfo(new String[] { "dl" }));
+ tagInfoMap.put("dd", new TagInfo(new String[] { "dl" }));
+ tagInfoMap.put("param", new TagInfo(new String[] { "applet" }));
+
+ String[] noTextParentTagArr = {
+ "area", "base", "body", "br", "dd", "dt", "head", "hr", "html",
+ "img", "input", "link", "map", "meta", "ol", "optgroup", "param",
+ "select", "table", "tbody", "tfoot", "thead", "tr", "ul",
+ };
+
+ noTextParentTags = new HashSet();
+ for (int i=0; i<noTextParentTagArr.length; ++i) {
+ noTextParentTags.add(noTextParentTagArr[i]);
+ }
+ }
+
+ public HtmlRepairer(DocErrorReporter warningReporter,
+ boolean noWarn, boolean noEmailWarn,
+ ClassDoc contextClass, MemberDoc contextMember,
+ boolean throwAwayLeadingPara) {
+ this.warningReporter = warningReporter;
+ this.noWarn = noWarn;
+ this.noEmailWarn = noEmailWarn;
+ this.contextClass = contextClass;
+ this.contextMember = contextMember;
+ this.throwAwayLeadingPara = throwAwayLeadingPara;
+ }
+
+ private static String replaceStr(String haystack, String needle, String replacement) {
+ int ndx=haystack.indexOf(needle);
+ if (ndx<0)
+ return haystack;
+ else
+ return haystack.substring(0, ndx)+replacement
+ + replaceStr(haystack.substring(ndx+needle.length()), needle, replacement);
+ }
+
+ private void haveText(String text) {
+
+ if (isLeadingTag && throwAwayLeadingPara) {
+ if (0 != text.trim().length()) {
+ isLeadingTag = false;
+ }
+ }
+
+ if (tagStack.isEmpty() || !noTextParentTags.contains(tagStack.peek())) {
+
+ text = replaceStr(text, "&lt1", "&lt;1");
+ text = replaceStr(text, "&&", "&amp;&amp;");
+ text = replaceStr(text, "& ", "&amp; ");
+ text = replaceStr(text, "&\t", "&amp;\t");
+ text = replaceStr(text, "&\r", "&amp;\r");
+ text = replaceStr(text, "&\n", "&amp;\n");
+ for (char c='0'; c<='9'; ++c)
+ text = replaceStr(text, "&"+c, "&amp;"+c);
+ text = replaceStr(text, "\u00a7", "&sect;");
+ output.append(text);
+ }
+ else {
+ printWarning("Discarded text in <" + tagStack.peek() + "> element");
+ }
+ }
+
+ private void haveStartOrEndTag(String tag) {
+
+ boolean _isLeadingTag = isLeadingTag;
+ isLeadingTag = false;
+
+ tag = tag.trim();
+
+ boolean isEndTag = tag.startsWith("/");
+ boolean isAtomTag = tag.endsWith("/");
+
+ if (isEndTag && isAtomTag) {
+ // got something like '</a/>' which is invalid.
+ // suppose a close tag was intended.
+ tag = tag.substring(0, tag.length()-1);
+ }
+
+ if (tag.length() < 1) {
+ printWarning("Deleting broken tag");
+ return;
+ }
+
+ String tagName = tag.substring(isEndTag?1:0, isAtomTag?tag.length()-1:tag.length());
+ String tagAttributes = "";
+
+ for (int i=0; i<tagName.length(); ++i) {
+ if (" \t\r\n".indexOf(tagName.charAt(i))>=0) {
+ tagAttributes = tagName.substring(i).trim();
+ tagName = tagName.substring(0, i);
+ break;
+ }
+ }
+
+ if (!isEndTag && tagName.indexOf('@')>0) {
+ if (!noEmailWarn) {
+ printWarning("Tag looks like email address: <"+tagName+">");
+ }
+ output.append("&lt;"+tag+"&gt;");
+ return;
+ }
+
+ tagName = tagName.toLowerCase();
+
+ if (_isLeadingTag && "p".equals(tagName) && !isEndTag && throwAwayLeadingPara) {
+ return;
+ }
+
+ if ("p".equals(tagName) || "br".equals(tagName) || "hr".equals(tagName)) {
+ // throw away </p> and </br>
+ if (isEndTag) {
+ return;
+ }
+ // make sure every <p> is a <p/> and every <br> is a <br/>
+ else if (!isAtomTag) {
+ tag += "/";
+ isAtomTag = true;
+ }
+ }
+
+ if (isEndTag) {
+
+ // check whether this close tag is on the stack
+ // if yes, close all tags up to this tag
+ if (tagStack.contains(tagName)) {
+ String popped;
+ do {
+ popped = (String)tagStack.pop();
+ if (!popped.equals(tagName))
+ printWarning("Inserting '</"+popped+">");
+ output.append("</"+popped+">");
+ }
+ while (!popped.equals(tagName));
+ }
+ // if not, just throw it away
+ else {
+ printWarning("Deleting <"+tag+">");
+ }
+ }
+ else {
+
+ final int STATE_INITIAL = 1;
+ final int STATE_EXPECT_ATTRIBUTENAME = 2;
+ final int STATE_UNQUOTED_ATTRIBUTEVALUE = 3;
+ final int STATE_SINGLEQUOTE_ATTRIBUTEVALUE = 4;
+ final int STATE_DOUBLEQUOTE_ATTRIBUTEVALUE = 5;
+ final int STATE_EXPECT_ATTRIBUTEVALUE = 6;
+ final int STATE_EXPECT_EQUALSIGN = 7;
+
+ int state = STATE_INITIAL;
+
+ String newAttributes = "";
+ String attributeName = null;
+ StringBuffer buf = new StringBuffer();
+
+ char[] attrsAsChars = tagAttributes.toCharArray();
+ for (int i=0, ilim=attrsAsChars.length+1; i<ilim; ++i) {
+ int c;
+ if (i<attrsAsChars.length)
+ c = (int)attrsAsChars[i];
+ else
+ c = -1;
+
+ switch (state) {
+
+ case STATE_INITIAL:
+ if (" \t\r\n".indexOf(c)>=0){
+ continue;
+ }
+ else if (-1==c) {
+ continue;
+ }
+ else {
+ state = STATE_EXPECT_ATTRIBUTENAME;
+ buf.append((char)c);
+ }
+ break;
+
+ case STATE_EXPECT_ATTRIBUTENAME:
+ if ('='==c) {
+ attributeName = buf.toString();
+ buf.setLength(0);
+ state = STATE_EXPECT_ATTRIBUTEVALUE;
+ }
+ else if (-1==c) {
+ attributeName = buf.toString();
+ buf.setLength(0);
+ printWarning("In Tag '"+tag+"':\nAttribute name without a value, inserting value =\""+attributeName+"\"");
+ }
+ else if (" \t\r\n".indexOf(c)>=0) {
+ state = STATE_EXPECT_EQUALSIGN;
+ }
+ else {
+ buf.append((char)c);
+ }
+ break;
+
+ case STATE_EXPECT_EQUALSIGN:
+ if (" \t\r\n".indexOf(c)>=0){
+ continue;
+ }
+ else if ('='==c) {
+ state = STATE_EXPECT_ATTRIBUTEVALUE;
+ attributeName = buf.toString();
+ buf.setLength(0);
+ }
+ else {
+ attributeName = buf.toString();
+ buf.setLength(0);
+ printWarning("In Tag '"+tag+"':\nAttribute name without a value, inserting value =\""+attributeName+"\"");
+ newAttributes += " "+attributeName+"=\""+attributeName+"\"";
+ buf.append((char)c);
+ state = STATE_EXPECT_ATTRIBUTENAME;
+ }
+ break;
+
+ case STATE_EXPECT_ATTRIBUTEVALUE:
+ if (" \t\r\n".indexOf(c)>=0){
+ continue;
+ }
+ else if ('\"'==c) {
+ state = STATE_DOUBLEQUOTE_ATTRIBUTEVALUE;
+ }
+ else if ('\''==c) {
+ state = STATE_SINGLEQUOTE_ATTRIBUTEVALUE;
+ }
+ else {
+ state = STATE_UNQUOTED_ATTRIBUTEVALUE;
+ buf.append((char)c);
+ }
+ break;
+
+ case STATE_UNQUOTED_ATTRIBUTEVALUE:
+ if (-1==c || " \t\r\n".indexOf(c)>=0){
+ state = STATE_INITIAL;
+ newAttributes += " "+attributeName + "=\"" + buf.toString() + "\"";
+ buf.setLength(0);
+ }
+ else {
+ buf.append((char)c);
+ }
+ break;
+
+ case STATE_SINGLEQUOTE_ATTRIBUTEVALUE:
+ if ('\''==c) {
+ state = STATE_INITIAL;
+ newAttributes += " "+attributeName + "=\"" + buf.toString() + "\"";
+ buf.setLength(0);
+ }
+ else {
+ buf.append((char)c);
+ }
+ break;
+
+ case STATE_DOUBLEQUOTE_ATTRIBUTEVALUE:
+ if ('\"'==c) {
+ state = STATE_INITIAL;
+ newAttributes += " "+attributeName + "=\"" + buf.toString() + "\"";
+ buf.setLength(0);
+ }
+ else {
+ buf.append((char)c);
+ }
+ break;
+ }
+ }
+
+
+ if (!isAtomTag) {
+
+ // check whether this open tag is equal to the topmost
+ // entry on the stack; if yes, emit a close tag first
+
+ // corrects stuff like '<tr><td>...<td>...');
+ if (!tagStack.isEmpty() && tagStack.peek().equals(tagName)) {
+ printWarning("Inserting </"+tagName+">");
+ output.append("</"+tagName+">");
+ tagStack.pop();
+ }
+ else {
+ processKnownChildTags(tagName, tagStack, output);
+ }
+
+ // otherwise, we assume there are no close tags required
+ // before this open tag.
+ tagStack.push(tagName);
+
+ output.append("<"+tagName+newAttributes+">");
+ }
+ else {
+ output.append("<"+tagName+newAttributes+"/>");
+ }
+ }
+ }
+
+ private boolean processKnownChildTags(String tagName, Stack tagStack, StringBuffer output) {
+
+ TagInfo tagInfo = (TagInfo)tagInfoMap.get(tagName);
+ if (null != tagInfo) {
+
+ String parentTag = null;
+ for (Enumeration en = tagStack.elements(); en.hasMoreElements(); ) {
+ String tag = (String)en.nextElement();
+ if (tagInfo.isLegalParentTag(tag)) {
+ parentTag = tag;
+ break;
+ }
+ }
+ if (parentTag != null) {
+ while (((String)tagStack.peek()) != parentTag) {
+ String poppedTagName = (String)tagStack.pop();
+ output.append("</"+poppedTagName+">");
+ printWarning("Inserting </"+poppedTagName+">");
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void flush() {
+
+ // close all pending tags
+ while (!tagStack.isEmpty()) {
+ String tagName = (String)tagStack.pop();
+ printWarning("Inserting </"+tagName+">");
+ output.append("</"+tagName+">");
+ }
+ }
+
+ /**
+ * Takes HTML fragment and returns a well-formed XHTML
+ * equivalent.
+ *
+ * In the returned String, all tags are properly closed and
+ * nested.
+ *
+ * Currently, the returned String is not guaranteed to be
+ * well-formed. In particular there are no checks on the tag
+ * names, attribute names and entity names.
+ */
+ public String getWellformedHTML(String text) {
+
+ final int STATE_INITIAL = 1;
+ final int STATE_TAG_START = 2;
+ final int STATE_TAG = 3;
+ final int STATE_TAG_DOUBLEQUOTE = 4;
+ final int STATE_TAG_SINGLEQUOTE = 5;
+ final int STATE_AMP = 6;
+
+ int state = STATE_INITIAL;
+ output.setLength(0);
+
+
+ StringBuffer buf = new StringBuffer();
+ char[] textAsChars = text.toCharArray();
+
+ outer_loop:
+ for (int i=0, ilim=textAsChars.length+1; i<ilim; ++i) {
+ int c;
+
+ if (i<textAsChars.length) {
+ c = textAsChars[i];
+ }
+ else {
+ c = -1;
+ }
+
+ switch (state) {
+
+ case STATE_INITIAL:
+ if ('<'==c) {
+ state = STATE_TAG_START;
+ if (buf.length()>0) {
+ haveText(buf.toString());
+ buf.setLength(0);
+ }
+ }
+ else if ('>'==c) {
+ // assume this is a greater-than sign
+ buf.append("&gt;");
+ }
+ else if ('&'==c) {
+ state = STATE_AMP;
+ }
+ else if (-1==c) {
+ if (buf.length()>0) {
+ haveText(buf.toString());
+ buf.setLength(0);
+ }
+ continue;
+ }
+ else {
+ buf.append((char)c);
+ }
+ break;
+
+ case STATE_AMP:
+ if ('<'==c) {
+ buf.append("&amp;");
+ state = STATE_TAG_START;
+ if (buf.length()>0) {
+ haveText(buf.toString());
+ buf.setLength(0);
+ }
+ }
+ else if ('>'==c) {
+ // assume this is a greater-than sign
+ buf.append("&amp;");
+ buf.append("&gt;");
+ state = STATE_INITIAL;
+ }
+ else if ('&'==c) {
+ buf.append("&amp;");
+ buf.append("&amp;");
+ state = STATE_INITIAL;
+ }
+ else if (-1==c) {
+ buf.append("&amp;");
+ haveText(buf.toString());
+ buf.setLength(0);
+ state = STATE_INITIAL;
+ continue;
+ }
+ else {
+ // peek forward and see whether this is a valid entity.
+ if ('#'==c) {
+ buf.append("&");
+ buf.append((char)c);
+ state = STATE_INITIAL;
+ continue outer_loop;
+ }
+ else if (Character.isLetter((char)c)) {
+ for (int i2=i+1; i2<ilim-1; i2++) {
+ if (';' == textAsChars[i2]) {
+ buf.append("&");
+ buf.append((char)c);
+ state = STATE_INITIAL;
+ continue outer_loop;
+ }
+ else if (!Character.isLetter((char)c)
+ && !Character.isDigit((char)c)
+ && ".-_:".indexOf((char)c) < 0
+ //&& !isCombiningChar(c) // FIXME
+ //&& !isExtender(c) // FIXME
+ ) {
+ break;
+ }
+ }
+ // not a valid entity declaration; assume &amp;
+ }
+ buf.append("&amp;");
+ buf.append((char)c);
+ state = STATE_INITIAL;
+ }
+
+ /*
+ else if ('#'==c || Character.isLetter((char)c)) {
+ buf.append("&");
+ buf.append((char)c);
+ state = STATE_INITIAL;
+ }
+ else {
+ buf.append("&amp;");
+ buf.append((char)c);
+ state = STATE_INITIAL;
+ }
+ */
+ break;
+
+ case STATE_TAG_START:
+ if (" \t\r\n".indexOf(c)>=0) {
+ //continue;
+
+ // new: assume this is a less-sign
+ haveText("&lt;"+c);
+ state = STATE_INITIAL;
+ }
+ else if ('/'==c) {
+ buf.append((char)c);
+ state = STATE_TAG;
+ }
+ else if ('<'==c) {
+ // assume this is a less-sign
+ haveText("&lt;&lt;");
+ state = STATE_INITIAL;
+ }
+ else if ('>'==c) {
+ // assume this is a less-sign
+ haveText("&lt;&gt;");
+ state = STATE_INITIAL;
+ }
+ //else if ('-'==c || '+'==c || '='==c || '\''==c || "0123456789".indexOf(c)>=0) {
+ else if (!Character.isLetter((char)c)) {
+ // assume this is a less-sign
+ haveText("&lt;"+(char)c);
+ state = STATE_INITIAL;
+ }
+ else {
+ buf.append((char)c);
+ state = STATE_TAG;
+ }
+ break;
+
+ case STATE_TAG:
+ if ('\"'==c) {
+ buf.append((char)c);
+ state = STATE_TAG_DOUBLEQUOTE;
+ }
+ else if ('\''==c) {
+ buf.append((char)c);
+ state = STATE_TAG_SINGLEQUOTE;
+ }
+ else if ('>'==c) {
+ state = STATE_INITIAL;
+ haveStartOrEndTag(buf.toString());
+ buf.setLength(0);
+ }
+ else if ('<'==c) {
+ // notify user, missing greater-than sign
+ haveStartOrEndTag(buf.toString());
+ buf.setLength(0);
+ }
+ else if (-1==c) {
+ printWarning("Unclosed tag at end-of-comment: <"+buf);
+ haveStartOrEndTag(buf.toString());
+ buf.setLength(0);
+ }
+ else {
+ buf.append((char)c);
+ }
+ break;
+
+ case STATE_TAG_DOUBLEQUOTE:
+ if ('\"'==c) {
+ buf.append((char)c);
+ state = STATE_TAG;
+ }
+ else if (-1==c) {
+ printWarning("Unclosed attribute value at end-of-comment.");
+ haveStartOrEndTag(buf.toString()+"\"");
+ }
+ else {
+ buf.append((char)c);
+ }
+ break;
+
+ case STATE_TAG_SINGLEQUOTE:
+ if ('\''==c) {
+ buf.append((char)c);
+ state = STATE_TAG;
+ }
+ else if (-1==c) {
+ printWarning("Unclosed attribute value at end-of-comment.");
+ haveStartOrEndTag(buf.toString()+"'");
+ }
+ else {
+ buf.append((char)c);
+ }
+ break;
+ }
+ }
+
+ return output.toString();
+ }
+
+ private String getContext() {
+ if (null != contextClass) {
+ StringBuffer rc = new StringBuffer();
+ rc.append(contextClass.qualifiedTypeName());
+ if (null != contextMember) {
+ rc.append("."+contextMember.toString());
+ }
+ return rc.toString();
+ }
+ else {
+ return null;
+ }
+ }
+
+ private void printWarning(String msg) {
+ if (null != warningReporter && !noWarn) {
+ String context = getContext();
+ if (null != context) {
+ warningReporter.printWarning("In "+getContext()+": "+msg);
+ }
+ else {
+ warningReporter.printWarning("In overview page: "+msg);
+ }
+ }
+ }
+
+ public String terminateText() {
+ output.setLength(0);
+ flush();
+ return output.toString();
+ }
+}
+
diff --git a/tools/gnu/classpath/tools/doclets/xmldoclet/TargetContext.java b/tools/gnu/classpath/tools/doclets/xmldoclet/TargetContext.java
new file mode 100644
index 000000000..72dd9f6a6
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/xmldoclet/TargetContext.java
@@ -0,0 +1,86 @@
+/* gnu.classpath.tools.doclets.xmldoclet.TargetContext
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.doclets.xmldoclet;
+
+import java.io.File;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+import java.net.URL;
+
+import java.util.List;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.HashMap;
+
+import gnu.classpath.tools.doclets.xmldoclet.doctranslet.DocTranslet;
+
+/**
+ * Stores any XSL transformation and postprocessing-specific
+ * information given by the user on the doclet command line.
+ *
+ * @author Julian Scheid
+ */
+public class TargetContext {
+
+ /**
+ * The DocTranslet to use for processing doclet output.
+ */
+ private DocTranslet docTranslet;
+
+ /**
+ * Directory to write final output to.
+ */
+ private File targetDirectory;
+
+ /**
+ * Directory where XSLT output will be written to. If an XSLT
+ * sheet was specified, but no postprocessing driver was given,
+ * this is the target directory specified by the user. Otherwise,
+ * this is a temporary directory.
+ */
+ private File xsltTargetDirectory;
+
+
+ public TargetContext(DocTranslet docTranslet, File targetDirectory) {
+ this.docTranslet = docTranslet;
+ this.targetDirectory = targetDirectory;
+ }
+
+ public File getTargetDirectory() {
+ return targetDirectory;
+ }
+
+ public void setTargetDirectory(File targetDirectory) {
+ this.targetDirectory = targetDirectory;
+ }
+
+ public DocTranslet getDocTranslet() {
+ return docTranslet;
+ }
+
+ public void setDocTranslet(DocTranslet docTranslet) {
+ this.docTranslet = docTranslet;
+ }
+}
diff --git a/tools/gnu/classpath/tools/doclets/xmldoclet/doctranslet/.cvsignore b/tools/gnu/classpath/tools/doclets/xmldoclet/doctranslet/.cvsignore
new file mode 100644
index 000000000..39a06683b
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/xmldoclet/doctranslet/.cvsignore
@@ -0,0 +1 @@
+.deps
diff --git a/tools/gnu/classpath/tools/doclets/xmldoclet/doctranslet/DocTranslet.java b/tools/gnu/classpath/tools/doclets/xmldoclet/doctranslet/DocTranslet.java
new file mode 100644
index 000000000..573ca368c
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/xmldoclet/doctranslet/DocTranslet.java
@@ -0,0 +1,443 @@
+/* gnu.classpath.tools.doclets.xmldoclet.doctranslet.DocTranslet
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.doclets.xmldoclet.doctranslet;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintStream;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.HashMap;
+import java.util.Map;
+
+import java.util.jar.JarFile;
+import java.util.jar.Manifest;
+import java.util.jar.Attributes;
+
+import javax.xml.transform.ErrorListener;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.TransformerFactoryConfigurationError;
+import javax.xml.transform.URIResolver;
+
+import javax.xml.transform.dom.DOMResult;
+
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import org.xml.sax.SAXException;
+
+import gnu.classpath.tools.IOToolkit;
+import gnu.classpath.tools.doclets.xmldoclet.Driver;
+
+import com.sun.javadoc.DocErrorReporter;
+
+public class DocTranslet implements ErrorListener {
+
+ private static class DocErrorReporterOutputStream
+ extends OutputStream
+ {
+ private ByteArrayOutputStream out = new ByteArrayOutputStream();
+ private DocErrorReporter reporter;
+
+ public DocErrorReporterOutputStream(DocErrorReporter reporter) {
+ this.reporter = reporter;
+ }
+
+ public void write(int ch) {
+ out.write(ch);
+ if (ch == 10) {
+ reporter.printNotice(out.toString());
+ out.reset();
+ }
+ }
+ }
+
+ private String mainResourceFilename;
+ private ClassLoader classLoader;
+ private Map transformerMap = new java.util.HashMap(); //WeakHashMap();
+ private DocTransletOptions options;
+
+ protected DocTranslet(String mainResourceFilename,
+ ClassLoader classLoader)
+ throws DocTransletConfigurationException {
+
+ if (mainResourceFilename.length() > 0 && mainResourceFilename.charAt(0) == '/') {
+ mainResourceFilename = mainResourceFilename.substring(1);
+ }
+ this.mainResourceFilename = mainResourceFilename;
+ this.classLoader = classLoader;
+ }
+
+ private static boolean equalsFile(File file1, File file2) {
+ return file1.getAbsolutePath().equals(file2.getAbsolutePath());
+ }
+
+ private static File getParentFile(File file) {
+ String filename = file.getAbsolutePath();
+ if (filename.endsWith(File.separator)) {
+ filename = filename.substring(0, filename.length() - 1);
+ }
+ int lastSlash = filename.lastIndexOf(File.separatorChar);
+ if (lastSlash > 0) {
+ filename = filename.substring(0, lastSlash);
+ }
+ else {
+ filename = File.separator;
+ }
+
+ return new File(filename);
+ }
+
+ private static boolean cacheXSLTSheets = true;
+
+ public void apply(File xmlSourceDirectory, File targetDirectory,
+ DocErrorReporter reporter)
+ throws DocTransletException {
+
+ PrintStream err = System.err;
+
+ try{
+ URL mainResourceURL = classLoader == null ?
+ ClassLoader.getSystemResource(mainResourceFilename):
+ classLoader.getResource(mainResourceFilename);
+
+ if (null == mainResourceURL) {
+ throw new DocTransletException("Cannot find resource '" + mainResourceFilename + "'");
+ }
+
+
+ Map parameters = new HashMap();
+ parameters.put("gjdoc.xmldoclet.version", Driver.XMLDOCLET_VERSION);
+
+ parameters.put("gjdoc.option.nonavbar", xsltBoolean(options.nonavbar));
+ parameters.put("gjdoc.option.noindex", xsltBoolean(options.noindex));
+ parameters.put("gjdoc.option.notree", xsltBoolean(options.notree));
+ parameters.put("gjdoc.option.nocomment", xsltBoolean(options.nocomment));
+ parameters.put("gjdoc.option.nohelp", xsltBoolean(options.nohelp));
+ parameters.put("gjdoc.option.splitindex", xsltBoolean(options.splitindex));
+ parameters.put("gjdoc.option.linksource", xsltBoolean(options.linksource));
+ parameters.put("gjdoc.option.nodeprecatedlist", xsltBoolean(options.nodeprecatedlist));
+ parameters.put("gjdoc.option.uses", xsltBoolean(options.uses));
+ parameters.put("gjdoc.option.windowtitle", options.windowtitle);
+ parameters.put("gjdoc.option.helpfile", options.helpfile);
+ parameters.put("gjdoc.option.stylesheetfile", options.stylesheetfile);
+ parameters.put("gjdoc.option.header", options.header);
+ parameters.put("gjdoc.option.footer", options.footer);
+ parameters.put("gjdoc.option.bottom", options.bottom);
+ parameters.put("gjdoc.option.doctitle", options.doctitle);
+
+ List outputFileList = getOutputFileList(mainResourceURL,
+ xmlSourceDirectory,
+ parameters);
+
+ reporter.printNotice("Running DocTranslet...");
+
+ TransformerFactory transformerFactory
+ = TransformerFactory.newInstance();
+
+ transformerFactory.setErrorListener(this);
+
+ boolean isLibxmlJ
+ = transformerFactory.getClass().getName().equals("gnu.xml.libxmlj.transform.TransformerFactoryImpl");
+
+ for (Iterator it = outputFileList.iterator(); it.hasNext(); ) {
+
+ if (isLibxmlJ) {
+ System.gc();
+ Runtime.getRuntime().runFinalization();
+ }
+
+ OutputFileInfo fileInfo = (OutputFileInfo)it.next();
+
+ File targetFile = new File(targetDirectory, fileInfo.getName());
+ File packageTargetDir = getParentFile(targetFile);
+
+ if (!packageTargetDir.exists() && !packageTargetDir.mkdirs()) {
+ throw new DocTransletException("Target directory " + packageTargetDir + " does not exist and cannot be created.");
+ }
+
+ if (options.linksource) {
+ File sourceTargetDirectory = new File(targetDirectory, "src-html");
+ File sourceTargetFile = new File(sourceTargetDirectory, fileInfo.getName());
+ File sourcePackageTargetDir = getParentFile(sourceTargetFile);
+
+ if (!sourcePackageTargetDir.exists() && !sourcePackageTargetDir.mkdirs()) {
+ throw new DocTransletException("Target directory " + packageTargetDir + " does not exist and cannot be created.");
+ }
+ }
+
+ if (options.uses) {
+ File usesTargetDirectory = new File(targetDirectory, "class-use");
+ File usesTargetFile = new File(usesTargetDirectory, fileInfo.getName());
+ File usesPackageTargetDir = getParentFile(usesTargetFile);
+
+ if (!usesPackageTargetDir.exists() && !usesPackageTargetDir.mkdirs()) {
+ throw new DocTransletException("Target directory " + packageTargetDir + " does not exist and cannot be created.");
+ }
+ }
+
+ if (null != fileInfo.getSource()) {
+
+ reporter.printNotice("Copying " + fileInfo.getComment() + "...");
+ InputStream in = new URL(mainResourceURL, fileInfo.getSource()).openStream();
+ FileOutputStream out = new FileOutputStream(targetFile.getAbsolutePath());
+ IOToolkit.copyStream(in, out);
+ in.close();
+ out.close();
+ }
+ else {
+
+ reporter.printNotice("Generating " + fileInfo.getComment() + "...");
+
+ String pathToRoot = "";
+ for (File file = getParentFile(targetFile); !equalsFile(file, targetDirectory); file = getParentFile(file)) {
+ pathToRoot += "../";
+ }
+
+ StreamResult out = new StreamResult(targetFile.getAbsolutePath());
+
+ StreamSource in = new StreamSource(new File(xmlSourceDirectory, "index.xml").getAbsolutePath());
+ URL resource = new URL(mainResourceURL, fileInfo.getSheet());
+
+
+ StreamSource xsltSource = new StreamSource(resource.toExternalForm());
+
+ if (null != fileInfo.getInfo()) {
+ parameters.put("gjdoc.outputfile.info", fileInfo.getInfo());
+ }
+ parameters.put("gjdoc.pathtoroot", pathToRoot);
+
+ Transformer transformer;
+ transformer = (Transformer)transformerMap.get(xsltSource.getSystemId());
+ if (null == transformer) {
+ transformer = transformerFactory.newTransformer(xsltSource);
+ if (cacheXSLTSheets) {
+ transformerMap.put(xsltSource.getSystemId(), transformer);
+ }
+ }
+
+ transformer.clearParameters();
+ for (Iterator pit = parameters.keySet().iterator(); pit.hasNext(); ) {
+ String key = (String)pit.next();
+ String value = (String)parameters.get(key);
+ transformer.setParameter(key, value);
+ }
+
+ transformer.setErrorListener(this);
+ DocErrorReporterOutputStream errorReporterOut
+ = new DocErrorReporterOutputStream(reporter);
+ System.setErr(new PrintStream(errorReporterOut));
+
+ transformer.transform(in, out);
+ errorReporterOut.flush();
+ }
+ }
+ }
+ catch (MalformedURLException e) {
+ throw new DocTransletException(e);
+ }
+ catch (TransformerFactoryConfigurationError e) {
+ throw new DocTransletException(e);
+ }
+ catch (TransformerException e) {
+ throw new DocTransletException(e.getMessageAndLocation(), e);
+ }
+ catch (IOException e) {
+ throw new DocTransletException(e);
+ }
+ finally {
+ System.setErr(err);
+ }
+ }
+
+ private List getOutputFileList(URL resource, File xmlSourceDirectory, Map parameters)
+ throws DocTransletException {
+
+ try {
+ List result;
+
+ OutputStream out = new ByteArrayOutputStream();
+
+ DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
+ Document document = documentBuilder.newDocument();
+ DOMResult domResult = new DOMResult(document);
+ {
+ StreamSource source = new StreamSource(resource.toExternalForm());
+
+ TransformerFactory transformerFactory = TransformerFactory.newInstance();
+ Transformer transformer = (Transformer)transformerFactory.newTransformer(source);
+
+ transformer.clearParameters();
+ for (Iterator pit = parameters.keySet().iterator(); pit.hasNext(); ) {
+ String key = (String)pit.next();
+ String value = (String)parameters.get(key);
+ transformer.setParameter(key, value);
+ }
+
+ transformer.transform(new StreamSource(new File(xmlSourceDirectory,
+ "index.xml").getAbsolutePath()),
+ domResult);
+ }
+
+ {
+ NodeList nodeList = document.getElementsByTagName("outputfile");
+ result = new ArrayList(nodeList.getLength());
+
+ for (int i=0; i<nodeList.getLength(); ++i) {
+ Element elem = (Element)nodeList.item(i);
+ String name = getTextContent(elem.getElementsByTagName("name").item(0));
+ String source
+ = (null != elem.getElementsByTagName("source").item(0))
+ ? getTextContent(elem.getElementsByTagName("source").item(0))
+ : null;
+ String sheet
+ = (null != elem.getElementsByTagName("sheet").item(0))
+ ? getTextContent(elem.getElementsByTagName("sheet").item(0))
+ : null;
+ String comment = getTextContent(elem.getElementsByTagName("comment").item(0));
+ String info = null;
+ if (elem.getElementsByTagName("info").getLength() > 0) {
+ if (null != elem.getElementsByTagName("info").item(0).getFirstChild()) {
+ info = getTextContent(elem.getElementsByTagName("info").item(0));
+ }
+ else {
+ info = "";
+ }
+ }
+ result.add(new OutputFileInfo(name, source, sheet, comment, info));
+ }
+ }
+ return result;
+ }
+ catch (TransformerFactoryConfigurationError e) {
+ throw new DocTransletException(e);
+ }
+ catch (TransformerException e) {
+ throw new DocTransletException(e.getMessageAndLocation(), e);
+ }
+ catch (ParserConfigurationException e) {
+ throw new DocTransletException(e);
+ }
+ }
+
+ private String getTextContent(Node elem)
+ {
+ StringBuffer result = new StringBuffer();
+ NodeList children = elem.getChildNodes();
+ for (int i=0; i<children.getLength(); ++i) {
+ Node item = children.item(i);
+ if (null != item) {
+ String value = item.getNodeValue();
+ if (null != value) {
+ result.append(value);
+ }
+ }
+ }
+ return result.toString();
+ }
+
+ public void setOptions(DocTransletOptions options) {
+ this.options = options;
+ }
+
+
+ public static DocTranslet fromClasspath(String resourceName)
+ throws DocTransletConfigurationException {
+
+ return new DocTranslet(resourceName,
+ DocTranslet.class.getClassLoader());
+ }
+
+ public static DocTranslet fromJarFile(File jarFile)
+ throws DocTransletConfigurationException {
+
+ try {
+ JarFile inputJarFile = new JarFile(jarFile, false, JarFile.OPEN_READ);
+
+ Manifest manifest = inputJarFile.getManifest();
+
+ if (null == manifest) {
+
+ throw new DocTransletConfigurationException("Jar file '" + jarFile + "' doesn't contain a manifest.");
+ }
+
+ Attributes mainAttributes = manifest.getMainAttributes();
+
+ String docTransletMainEntry = mainAttributes.getValue("doctranslet-main-entry");
+
+ if (null == docTransletMainEntry) {
+
+ throw new DocTransletConfigurationException("Manifest in Jar file '" + jarFile + "' doesn't contain a doctranslet-main-entry specification.");
+ }
+
+ return new DocTranslet(docTransletMainEntry,
+ new JarClassLoader(inputJarFile));
+ }
+ catch (IOException e) {
+ throw new DocTransletConfigurationException(e);
+ }
+ }
+
+ private static String xsltBoolean(boolean b) {
+ return b ? "1" : "";
+ }
+
+ public void error (TransformerException exception)
+ throws TransformerException {
+
+ throw exception;
+ }
+
+ public void fatalError (TransformerException exception)
+ throws TransformerException {
+
+ throw exception;
+ }
+
+ public void warning (TransformerException exception)
+ throws TransformerException {
+
+ System.err.println("WWW: " + exception.getMessage());
+ }
+}
diff --git a/tools/gnu/classpath/tools/doclets/xmldoclet/doctranslet/DocTransletConfigurationException.java b/tools/gnu/classpath/tools/doclets/xmldoclet/doctranslet/DocTransletConfigurationException.java
new file mode 100644
index 000000000..b25d77ef3
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/xmldoclet/doctranslet/DocTransletConfigurationException.java
@@ -0,0 +1,36 @@
+/* gnu.classpath.tools.doclets.xmldoclet.doctranslet.DocTransletConfigurationException
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.doclets.xmldoclet.doctranslet;
+
+public class DocTransletConfigurationException extends Exception {
+
+ public DocTransletConfigurationException(String msg) {
+ super(msg);
+ }
+
+ public DocTransletConfigurationException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+
+ public DocTransletConfigurationException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/tools/gnu/classpath/tools/doclets/xmldoclet/doctranslet/DocTransletException.java b/tools/gnu/classpath/tools/doclets/xmldoclet/doctranslet/DocTransletException.java
new file mode 100644
index 000000000..e672c628e
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/xmldoclet/doctranslet/DocTransletException.java
@@ -0,0 +1,46 @@
+/* gnu.classpath.tools.doclets.xmldoclet.doctranslet.DocTransletException
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.doclets.xmldoclet.doctranslet;
+
+public class DocTransletException extends Exception {
+
+ public DocTransletException(String msg) {
+ super(msg);
+ }
+
+ private void initCauseDynamic(Throwable cause)
+ {
+ try {
+ getClass().getMethod("initCause", new Class[]{Throwable.class}).invoke(this, new Object[] { cause });
+ }
+ catch (Exception ignore) {
+ }
+ }
+
+ public DocTransletException(String msg, Throwable cause) {
+ super(msg);
+ initCauseDynamic(cause);
+ }
+
+ public DocTransletException(Throwable cause) {
+ initCauseDynamic(cause);
+ }
+}
diff --git a/tools/gnu/classpath/tools/doclets/xmldoclet/doctranslet/DocTransletOptions.java b/tools/gnu/classpath/tools/doclets/xmldoclet/doctranslet/DocTransletOptions.java
new file mode 100644
index 000000000..0c6813082
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/xmldoclet/doctranslet/DocTransletOptions.java
@@ -0,0 +1,45 @@
+/* gnu.classpath.tools.doclets.xmldoclet.doctranslet.DocTransletOptions
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.doclets.xmldoclet.doctranslet;
+
+/**
+ * Value class for carrying command line options which need to be
+ * passed through to the stylesheets.
+ */
+public class DocTransletOptions
+{
+ public boolean nonavbar;
+ public boolean noindex;
+ public boolean notree;
+ public boolean nocomment;
+ public boolean nohelp;
+ public boolean splitindex;
+ public boolean linksource;
+ public boolean nodeprecatedlist;
+ public boolean uses;
+ public String windowtitle = "";
+ public String helpfile = "";
+ public String stylesheetfile = "";
+ public String header = "";
+ public String footer = "";
+ public String bottom = "";
+ public String doctitle = "";
+}
diff --git a/tools/gnu/classpath/tools/doclets/xmldoclet/doctranslet/JarClassLoader.java b/tools/gnu/classpath/tools/doclets/xmldoclet/doctranslet/JarClassLoader.java
new file mode 100644
index 000000000..50a9681e1
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/xmldoclet/doctranslet/JarClassLoader.java
@@ -0,0 +1,74 @@
+/* gnu.classpath.tools.doclets.xmldoclet.doctranslet.JarClassLoader
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.doclets.xmldoclet.doctranslet;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+import java.util.jar.JarFile;
+import java.util.jar.JarEntry;
+
+public class JarClassLoader extends ClassLoader {
+
+ private JarFile jarFile;
+
+ public JarClassLoader(JarFile jarFile) {
+ this.jarFile = jarFile;
+ }
+
+ public Class findClass(String name)
+ throws ClassNotFoundException {
+
+ byte[] b = loadClassData(name);
+ return defineClass(name, b, 0, b.length);
+ }
+
+ private byte[] loadClassData(String className)
+ throws ClassNotFoundException
+ {
+ String classFileName = className.replace('.', File.separatorChar) + ".class";
+
+ try {
+ JarEntry jarEntry = jarFile.getJarEntry(classFileName);
+ if (null != jarEntry) {
+ return readFromStream(jarFile.getInputStream(jarEntry),
+ jarEntry.getSize());
+ }
+ }
+ catch (IOException ignore_) {
+ }
+ throw new ClassNotFoundException(className);
+ }
+
+ private byte[] readFromStream(InputStream in, long size)
+ throws IOException
+ {
+ byte[] result = new byte[(int)size];
+ int nread = 0;
+ int offset = 0;
+ while (offset < size && (nread = in.read(result, offset, (int)(size - offset))) >= 0) {
+ offset += nread;
+ }
+ in.close();
+ return result;
+ }
+}
diff --git a/tools/gnu/classpath/tools/doclets/xmldoclet/doctranslet/OutputFileInfo.java b/tools/gnu/classpath/tools/doclets/xmldoclet/doctranslet/OutputFileInfo.java
new file mode 100644
index 000000000..92a1fba27
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/xmldoclet/doctranslet/OutputFileInfo.java
@@ -0,0 +1,49 @@
+/* gnu.classpath.tools.doclets.xmldoclet.doctranslet.OutputFileInfo
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.doclets.xmldoclet.doctranslet;
+
+/**
+ * Holds information about a file to be generated by the DocTranslet.
+ */
+public class OutputFileInfo {
+
+ private String name;
+ private String source;
+ private String sheet;
+ private String comment;
+ private String info;
+
+ public OutputFileInfo(String name, String source, String sheet, String comment, String info) {
+ this.name = name;
+ this.source = source;
+ this.sheet = sheet;
+ this.comment = comment;
+ this.info = info;
+ }
+
+ public String getName() { return name; }
+ public String getSource() { return source; }
+ public String getSheet() { return sheet; }
+ public String getComment() { return comment; }
+ public String getInfo() { return info; }
+
+ public String toString() { return "OutputFileInfo{name="+name+",source="+source+",sheet="+sheet+",comment="+comment+",info="+info+"}"; }
+}
diff --git a/tools/gnu/classpath/tools/doclets/xmldoclet/doctranslet/package.html b/tools/gnu/classpath/tools/doclets/xmldoclet/doctranslet/package.html
new file mode 100644
index 000000000..2ca6a1a2c
--- /dev/null
+++ b/tools/gnu/classpath/tools/doclets/xmldoclet/doctranslet/package.html
@@ -0,0 +1,21 @@
+<html>
+<body>
+
+A DocTranslet consists of a number of files, normally XSL sheets,
+which define how to postprocess the raw XML information output by
+xmldoclet. These files are normally bundled in a single Jar file.
+
+There is only one file in a DocTranslet that is required and whose
+format is defined, think of it as an index file. This file must be
+named <code>DocTranslet.xsl</code> and it must be a stylesheet that
+produces XML code which conforms to the structure defined by
+DocTranslet.rng.
+
+The resulting XML code tells xmldoclet what user-supplied XSL sheets
+it should apply and what user-supplied classes it should run on the
+resulting files, if any.
+
+See DocTranslet.rng for information on the structure of the XML data.
+
+</body>
+</html>
diff --git a/tools/gnu/classpath/tools/gjdoc/.cvsignore b/tools/gnu/classpath/tools/gjdoc/.cvsignore
new file mode 100644
index 000000000..74e8a83b2
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/.cvsignore
@@ -0,0 +1,4 @@
+.deps
+.dirstamp
+.libs
+*.lo
diff --git a/tools/gnu/classpath/tools/gjdoc/AbstractTagImpl.java b/tools/gnu/classpath/tools/gjdoc/AbstractTagImpl.java
new file mode 100644
index 000000000..4a638e254
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/AbstractTagImpl.java
@@ -0,0 +1,90 @@
+/* gnu.classpath.tools.gjdoc.AbstractTagImpl
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import com.sun.javadoc.*;
+import java.util.*;
+
+public abstract class AbstractTagImpl
+ implements Tag, TagContainer {
+
+ private static final Tag[] emptyTags = new Tag[0];
+
+ protected String text;
+ protected Map tagMap;
+
+ protected AbstractTagImpl(String text) {
+ this.text=text;
+ }
+
+ public void resolve() {
+ Tag[] allTags=inlineTags();
+ if (null != allTags) {
+ for (int i=0; i<allTags.length; ++i) {
+ if (allTags[i]!=this) ((AbstractTagImpl)allTags[i]).resolve();
+ }
+ }
+ else {
+ System.err.println("Null tags for " + this);
+ }
+ }
+
+ protected void setBody(String body, ClassDocImpl contextClass, MemberDocImpl contextMember) {
+ this.tagMap=DocImpl.parseCommentTags(body.toCharArray(),
+ 0,
+ body.length(),
+ contextClass,
+ contextMember,
+ this,
+ null);
+ }
+
+ public Tag[] firstSentenceTags() {
+ return (tagMap!=null)? (Tag[])tagMap.get("first") : emptyTags;
+ }
+ public Tag[] inlineTags() {
+ return (tagMap!=null)? (Tag[])tagMap.get("inline") : emptyTags;
+ }
+
+ public String name() {
+ return kind();
+ }
+
+ public String text() {
+ return text;
+ }
+
+ public Map getTagMap() {
+ return tagMap;
+ }
+
+ /**
+ * Debug string containing class, name, text and tagMap.
+ */
+ public String toString()
+ {
+ return (this.getClass().getName()
+ + "[name=" + name()
+ + ", text=" + text()
+ + ", tagMap=" + getTagMap()
+ + "]");
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/ArrayCharacterIterator.java b/tools/gnu/classpath/tools/gjdoc/ArrayCharacterIterator.java
new file mode 100644
index 000000000..8c23e989a
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/ArrayCharacterIterator.java
@@ -0,0 +1,104 @@
+/* gnu.classpath.tools.gjdoc.ArrayCharacterIterator
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import java.text.CharacterIterator;
+
+public final class ArrayCharacterIterator implements CharacterIterator {
+
+ private char[] data;
+ private int beginIndex;
+ private int endIndex;
+ private int currentIndex;
+
+ public ArrayCharacterIterator(char[] data,
+ int beginIndex) {
+ this(data,beginIndex,data.length,beginIndex);
+ }
+
+ public ArrayCharacterIterator(char[] data,
+ int beginIndex,
+ int endIndex) {
+ this(data,beginIndex,endIndex,beginIndex);
+ }
+
+ public ArrayCharacterIterator(char[] data,
+ int beginIndex,
+ int endIndex,
+ int currentIndex) {
+ this.data=data;
+ this.beginIndex=beginIndex;
+ this.endIndex=endIndex;
+ this.currentIndex=currentIndex;
+ }
+
+ // Create a copy of this iterator
+ public Object clone() {
+ return new ArrayCharacterIterator(data,beginIndex,endIndex,currentIndex);
+ }
+
+ // Gets the character at the current position (as returned by getIndex()).
+ public char current() {
+ return (currentIndex>=beginIndex && currentIndex<endIndex) ? data[currentIndex] : DONE;
+ }
+
+ // Sets the position to getBeginIndex() and returns the character at that position.
+ public char first() {
+ return data[currentIndex=beginIndex];
+ }
+
+ // Returns the start index of the text.
+ public int getBeginIndex() {
+ return beginIndex;
+ }
+
+ // Returns the end index of the text.
+ public int getEndIndex() {
+ return endIndex;
+ }
+
+ // Returns the current index.
+ public int getIndex() {
+ return currentIndex;
+ }
+
+ // Sets the position to getEndIndex()-1 (getEndIndex() if the text is empty) and returns the character at that position.
+ public char last() {
+ return data[currentIndex=((endIndex>beginIndex)?endIndex-1:endIndex)];
+ }
+
+ // Increments the iterator's index by one and returns the character at the new index.
+ public char next() {
+ return (++currentIndex<endIndex)?data[currentIndex]:DONE;
+ }
+
+ // Decrements the iterator's index by one and returns the character at the new index.
+ public char previous() {
+ return (--currentIndex>=beginIndex)?data[currentIndex]:DONE;
+ }
+
+ // Sets the position to the specified position in the text and returns that character.
+ public char setIndex(int position) {
+ this.currentIndex=position;
+ return current();
+ }
+
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/ClassDocImpl.java b/tools/gnu/classpath/tools/gjdoc/ClassDocImpl.java
new file mode 100644
index 000000000..fee68006f
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/ClassDocImpl.java
@@ -0,0 +1,1244 @@
+/* gnu.classpath.tools.gjdoc.ClassDocImpl
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import com.sun.javadoc.*;
+import java.util.*;
+import java.io.*;
+import gnu.classpath.tools.gjdoc.expr.EvaluatorEnvironment;
+import gnu.classpath.tools.gjdoc.expr.CircularExpressionException;
+import gnu.classpath.tools.gjdoc.expr.IllegalExpressionException;
+import gnu.classpath.tools.gjdoc.expr.UnknownIdentifierException;
+
+public class ClassDocImpl
+ extends ProgramElementDocImpl
+ implements ClassDoc, WritableType, EvaluatorEnvironment {
+
+ private ClassDoc baseClassDoc;
+ private ClassDoc[] importedClasses;
+ private PackageDoc[] importedPackages;
+ private boolean definesSerializableFields;
+ private FieldDoc[] serialPersistentField;
+ private MethodDoc[] serializationMethods;
+ private String dimension = "";
+
+ public ClassDocImpl(ClassDoc containingClass,
+ PackageDoc containingPackage,
+ int accessLevel,
+ boolean isFinal,
+ boolean isStatic,
+ SourcePosition position) {
+ super(containingClass, containingPackage, accessLevel, isFinal, isStatic,
+ position);
+ this.baseClassDoc = this;
+ }
+
+ public ClassDocImpl(ClassDoc containingClass,
+ PackageDoc containingPackage,
+ ClassDoc[] importedClasses,
+ PackageDoc[] importedPackages,
+ SourcePosition position) {
+ super(containingClass, containingPackage,
+ position);
+ this.importedClasses=importedClasses;
+ this.importedPackages=importedPackages;
+ this.baseClassDoc = this;
+ }
+
+ // Return constructors in class.
+ public ConstructorDoc[] constructors() {
+ return constructors(true);
+ }
+
+ public ConstructorDoc[] constructors(boolean filter) {
+ return filter ? filteredConstructors : unfilteredConstructors;
+ }
+
+ // Return true if Serializable fields are explicitly defined with the special class member serialPersistentFields.
+ public boolean definesSerializableFields() {
+ return definesSerializableFields;
+ }
+
+ // Return fields in class.
+ public FieldDoc[] fields() {
+ return fields(true);
+ }
+
+ public FieldDoc[] fields(boolean filter) {
+ return filter ? filteredFields : unfilteredFields;
+ }
+
+ private static Set primitiveNames;
+ static {
+ primitiveNames = new HashSet();
+ primitiveNames.add("int");
+ primitiveNames.add("long");
+ primitiveNames.add("char");
+ primitiveNames.add("short");
+ primitiveNames.add("byte");
+ primitiveNames.add("float");
+ primitiveNames.add("double");
+ primitiveNames.add("boolean");
+ }
+
+ private Map findClassCache = new HashMap();
+
+ public ClassDoc findClass(String className, String dimension)
+ {
+ ClassDoc cached = (ClassDoc)findClassCache.get(className + dimension);
+ if (null != cached) {
+ return cached;
+ }
+ else {
+ ClassDoc classDoc = findClass(className);
+
+ if (null!=classDoc) {
+ try {
+ if (classDoc.dimension().equals(dimension)) {
+ return classDoc;
+ }
+ else {
+ ClassDoc rc = (ClassDoc) ((WritableType)classDoc).clone();
+ ((WritableType)rc).setDimension(dimension);
+ findClassCache.put(className + dimension, rc);
+ return rc;
+ }
+ }
+ catch (CloneNotSupportedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ else {
+ return null;
+ }
+ }
+ }
+
+ public ClassDoc findClass(String className)
+ {
+ String qualifiedName = Main.getRootDoc().resolveClassName(className, this);
+ ClassDoc rc=Main.getRootDoc().classNamed(qualifiedName);
+
+ if (null == rc) {
+ for (ClassDoc cdi=this; cdi!=null; cdi=cdi.containingClass()) {
+ for (ClassDoc sdi=cdi; sdi!=null; sdi=sdi.superclass()) {
+ if (sdi instanceof ClassDocProxy) {
+ ClassDoc realClass = Main.getRootDoc().classNamed(sdi.qualifiedName());
+ if (null != realClass) {
+ sdi = realClass;
+ }
+ }
+ rc=Main.getRootDoc().classNamed(sdi.qualifiedName()+"."+className);
+ if (rc!=null) return rc;
+ }
+ }
+ }
+
+ return rc;
+ }
+
+ // Get the list of classes declared as imported.
+ public ClassDoc[] importedClasses() {
+ return importedClasses;
+ }
+
+ // Get the list of packages declared as imported.
+ public PackageDoc[] importedPackages() {
+ return importedPackages;
+ }
+
+ // Return inner classes within this class.
+ public ClassDoc[] innerClasses() {
+ return innerClasses(true);
+ }
+
+ public ClassDoc[] innerClasses(boolean filtered) {
+ return filtered ? filteredInnerClasses : unfilteredInnerClasses;
+ }
+
+ void setFilteredInnerClasses(ClassDoc[] filteredInnerClasses) {
+ this.filteredInnerClasses=filteredInnerClasses;
+ }
+
+ void setInnerClasses(ClassDoc[] unfilteredInnerClasses) {
+ this.unfilteredInnerClasses=unfilteredInnerClasses;
+ }
+
+ // Return interfaces implemented by this class or interfaces extended by this interface.
+ public ClassDoc[] interfaces() {
+ return interfaces;
+ }
+
+ public void setInterfaces(ClassDoc[] interfaces) {
+ this.interfaces=interfaces;
+ }
+
+ // Return true if this class is abstract
+ public boolean isAbstract() {
+ return isAbstract || isInterface();
+ }
+
+ public boolean isInterface() {
+ return isInterface;
+ }
+
+ public boolean isAnnotation() {
+ return isAnnotation;
+ }
+
+ public boolean isEnum()
+ {
+ return isEnum;
+ }
+
+ // Return true if this class is abstract
+ public void setIsAbstract(boolean b) {
+ this.isAbstract=b;
+ }
+
+ // Return true if this class implements java.io.Externalizable.
+ public boolean isExternalizable() {
+ return implementsInterface("java.io.Externalizable");
+ }
+
+ // Return true if this class implements java.io.Serializable.
+ public boolean isSerializable() {
+ return implementsInterface("java.io.Serializable");
+ }
+
+ public boolean implementsInterface(String name) {
+ for (ClassDoc cdi=this; cdi!=null; cdi=(ClassDoc)cdi.superclass()) {
+ if (cdi instanceof ClassDocImpl) {
+ ClassDoc[] cdiInterfaces=(ClassDoc[])cdi.interfaces();
+ if (null != cdiInterfaces) {
+ for (int i=0; i<cdiInterfaces.length; ++i) {
+ if (cdiInterfaces[i].qualifiedName().equals(name))
+ return true;
+ }
+ }
+ }
+ else {
+ //throw new RuntimeException("implementsInterface(\""+name+"\") failed: Not a ClassDocImpl:"+cdi);
+ }
+ }
+ return false;
+ }
+
+ // Return methods in class.
+ public MethodDoc[] methods() {
+ return methods(true);
+ }
+
+ // Return methods in class.
+ public MethodDoc[] methods(boolean filter) {
+ return filter ? filteredMethods : unfilteredMethods;
+ }
+
+ // Return the Serializable fields of class. Return either a list of default fields documented by serial tag or return a single FieldDoc for serialPersistentField member.
+ public FieldDoc[] serializableFields() {
+ if (serialPersistentField!=null) {
+ return serialPersistentField;
+ }
+ else{
+ return serializableFields;
+ }
+ }
+
+ // Return the serialization methods for this class.
+ public MethodDoc[] serializationMethods() {
+ return serializationMethods;
+ }
+
+ // Test whether this class is a subclass of the specified class.
+ public boolean subclassOf(ClassDoc cd) {
+ for (ClassDocImpl cdi=(ClassDocImpl)superclass(); cdi!=null; cdi=(ClassDocImpl)cdi.superclass()) {
+ if (cdi.equals(cd))
+ return true;
+ }
+ return false;
+ }
+
+ // Return the superclass of this class
+ public ClassDoc superclass() {
+ return superclass;
+ }
+
+ // Implementation of Interface Type
+
+ public ClassDoc asClassDoc() {
+
+ return (ClassDoc)this;
+ }
+
+ public String typeName() { return name(); }
+
+ public String qualifiedTypeName() {
+ return (containingPackage()!=null && !containingPackage().equals(PackageDocImpl.DEFAULT_PACKAGE))?(containingPackage().name()+"."+name()):(name());
+ }
+
+ public String qualifiedName() { return qualifiedTypeName(); }
+
+ public String dimension() { return dimension; }
+
+ public String toString() { return "ClassDoc{"+qualifiedTypeName()+"}"; }
+
+ public TypeVariable asTypeVariable() { return null; }
+
+ public static ClassDocImpl createInstance(ClassDoc containingClass,
+ PackageDoc containingPackage,
+ ClassDoc[] importedClasses,
+ PackageDoc[] importedPackages,
+ char[] source, int startIndex, int endIndex,
+ List importStatementList) throws ParseException, IOException {
+
+ String superclassName = "java.lang.Object";
+
+ ClassDocImpl rc=new ClassDocImpl(containingClass,
+ containingPackage,
+ importedClasses,
+ importedPackages,
+ null);
+ rc.setImportStatementList(importStatementList);
+ List implementedInterfaces = new ArrayList();
+
+ String word="";
+ int item=0;
+
+ final int STATE_NORMAL = 1;
+ final int STATE_SLASHC = 2;
+ final int STATE_STARC = 3;
+ final int STATE_ANNO = 4;
+
+ int state=STATE_NORMAL;
+ int varLevel=0;
+ int parLevel=0;
+ char prev=0;
+ for (int ndx=startIndex; ndx<=endIndex; ++ndx) {
+ char c=(ndx==endIndex)?10:source[ndx];
+ boolean processWord=false;
+ if (state==STATE_SLASHC) {
+ if (c=='\n') {
+ state=STATE_NORMAL;
+ c=0;
+ }
+ }
+ else if (state==STATE_STARC) {
+ if (c=='/' && prev=='*') {
+ state=STATE_NORMAL;
+ c=0;
+ }
+ }
+ else {
+ if (c=='/' && prev=='/') {
+ state=STATE_SLASHC;
+ c=0;
+ word=word.substring(0,word.length()-1);
+ processWord=true;
+ }
+ else if (c=='*' && prev=='/') {
+ state=STATE_STARC;
+ c=0;
+ word=word.substring(0,word.length()-1);
+ processWord=true;
+ }
+ else if (c=='@') {
+ state=STATE_ANNO;
+ word += c;
+ }
+ else if (c=='(' && state==STATE_ANNO) {
+ ++parLevel;
+ word += c;
+ }
+ else if (c==')' && state==STATE_ANNO) {
+ --parLevel;
+ word += c;
+ if (parLevel == 0)
+ state=STATE_NORMAL;
+ }
+ else if (c=='<')
+ {
+ ++varLevel;
+ word += c;
+ }
+ else if (c=='>')
+ {
+ --varLevel;
+ word += c;
+ }
+ else if (c=='{' && parLevel == 0 ||
+ c==',' && varLevel == 0 && parLevel == 0 ||
+ Parser.WHITESPACE.indexOf(c)>=0 && parLevel == 0 && varLevel == 0) {
+ processWord=true;
+ state=STATE_NORMAL;
+ }
+ else {
+ word+=c;
+ }
+
+ if (processWord && word.length()>0) {
+ if (item==0) {
+ if (rc.processModifier(word)) {
+ }
+ else if (word.equals("abstract")) {
+ rc.setIsAbstract(true);
+ }
+ else if (word.equals("class")) {
+ rc.setIsInterface(false);
+ item=1;
+ }
+ else if (word.equals("enum"))
+ {
+ rc.setIsEnum(true);
+ item = 1;
+ }
+ else if (word.equals("interface")) {
+ rc.setIsInterface(true);
+ item=1;
+ }
+ else if (word.equals("@interface")) {
+ rc.setIsInterface(true);
+ rc.setIsAnnotation(true);
+ item=1;
+ }
+ else if (word.equals("strictfp")) {
+ }
+ else {
+ Main.getRootDoc().printWarning("unknown modifier '"+word+"'");
+ }
+ }
+ else if (word.equals("extends") && !rc.isAnnotation()) {
+ if (rc.isInterface()) {
+ item=3;
+ }
+ else {
+ item=2;
+ }
+ }
+ else if (word.equals("implements") && !rc.isAnnotation()) {
+ item=3;
+ }
+ else if (item==1) {
+ int parameterIndex = word.indexOf("<");
+ if (parameterIndex == -1)
+ rc.setClass(word);
+ else
+ {
+ rc.setClass(word.substring(0, parameterIndex));
+ parseTypeVariables(rc,word.substring(parameterIndex,
+ word.length()));
+ }
+ }
+ else if (item==2) {
+ //Debug.log(9,"setting baseclass of "+rc+" to "+word);
+ int parameterIndex = word.indexOf("<");
+ if (parameterIndex == -1)
+ superclassName=word;
+ else
+ {
+ /* FIXME: Parse type parameters */
+ superclassName=word.substring(0,parameterIndex);
+ }
+ }
+ else if (item==3) {
+ int parameterIndex = word.indexOf("<");
+ if (parameterIndex == -1)
+ implementedInterfaces.add(word);
+ else
+ {
+ /* FIXME: Parse type parameters */
+ implementedInterfaces.add(word.substring(0,parameterIndex));
+ }
+ }
+ word="";
+ }
+
+ if (c=='{' && state==STATE_NORMAL) break;
+ }
+ prev=c;
+ }
+
+ if (null != containingClass
+ && containingClass.isInterface()) {
+ rc.accessLevel = ACCESS_PUBLIC;
+ }
+
+ if (rc.name()==null) {
+ throw new ParseException("No classdef found in expression \""+new String(source,startIndex,endIndex-startIndex)+"\"");
+ }
+
+ rc.setPosition(ClassDocImpl.getPosition(rc, source, startIndex));
+
+ ClassDoc superclassProxy=new ClassDocProxy(superclassName, rc);
+
+ if (!rc.qualifiedName().equals("java.lang.Object")) {
+ rc.setSuperclass(superclassProxy);
+ }
+
+ ClassDoc[] interfaces=new ClassDoc[implementedInterfaces.size()];
+ for (int i=0; i<interfaces.length; ++i) {
+ interfaces[i]=new ClassDocProxy((String)implementedInterfaces.get(i), rc);
+ }
+ rc.setInterfaces(interfaces);
+
+ if (rc.isInterface() && rc.containingClass()!=null) {
+ rc.setIsStatic(true);
+ }
+ return rc;
+ }
+
+ public void setFields(FieldDoc[] fields) {
+ this.unfilteredFields=fields;
+ }
+
+ public void setFilteredFields(FieldDoc[] fields) {
+ this.filteredFields=fields;
+ }
+
+ public void setSerializableFields(FieldDoc[] sfields) {
+ this.serializableFields=sfields;
+ }
+
+ public void setMethods(MethodDoc[] methods) {
+ this.unfilteredMethods=methods;
+ }
+
+ public void setFilteredMethods(MethodDoc[] methods) {
+ this.filteredMethods=methods;
+ }
+
+ public void setConstructors(ConstructorDoc[] constructors) {
+ this.unfilteredConstructors=constructors;
+ }
+
+ public void setFilteredConstructors(ConstructorDoc[] constructors) {
+ this.filteredConstructors=constructors;
+ }
+
+ // Returns the name of this Doc item.
+ public String name() {
+ if (containingClass==null) {
+ return className;
+ }
+ else {
+ return containingClass.name()+"."+className;
+ }
+ }
+
+ public String getClassName() {
+ return className;
+ }
+
+ public void setClass(String className) {
+ this.className=className;
+ }
+
+ void setSuperclass(ClassDoc superclass) {
+ this.superclass=superclass;
+ }
+
+ public void resolve() throws ParseException {
+ if (!resolved) {
+ resolved=true;
+
+ if (containingClass!=null)
+ ((ClassDocImpl)containingClass).resolve();
+
+ //Debug.log(9,"resolving class '"+qualifiedName()+"'");
+ /*
+ for (int i=0; i<importedPackages.length; ++i) {
+ Debug.log(9,"class "+qualifiedName()+" imports "+importedPackages[i].name());
+ }
+ */
+
+ if (superclass instanceof ClassDocProxy) {
+
+ ClassDoc realClassDoc=findClass(superclass.qualifiedName());
+
+ if (realClassDoc==null) {
+ /*
+ if (true) { // Main.recursiveClasses) {
+ throw new ParseException("In class '"+qualifiedName()+"': class '"+className+"' not found.");
+ }
+ */
+ }
+ else {
+ superclass=realClassDoc;
+ }
+ }
+
+ if (null != interfaces) {
+ for (int i=0; i<interfaces.length; ++i) {
+ if (interfaces[i] instanceof ClassDocProxy) {
+ //Debug.log(9,"class "+qualifiedName()+" implements "+interfaces[i].qualifiedName());
+ ClassDoc realClassDoc=findClass(interfaces[i].qualifiedName());
+ if (realClassDoc==null) {
+ /*
+ if (Main.recursiveClasses) {
+ throw new ParseException("In class '"+qualifiedName()+"': class '"+className+"' not found.");
+ }
+ */
+ }
+ else {
+ //Debug.log(9,"found class '"+className+"': "+interfaces[i]);
+ interfaces[i]=realClassDoc;
+ }
+ }
+ }
+ }
+
+ if (unfilteredFields!=null) {
+ for (int i=0; i<unfilteredFields.length; ++i) {
+ ((FieldDocImpl)unfilteredFields[i]).resolve();
+ if (unfilteredFields[i].name().equals("serialPersistentField")) {
+ serialPersistentField=new FieldDoc[]{unfilteredFields[i]};
+ definesSerializableFields=true;
+ }
+ }
+ }
+
+ if (unfilteredMethods!=null) {
+ for (int i=0; i<unfilteredMethods.length; ++i) {
+ ((MethodDocImpl)unfilteredMethods[i]).resolve();
+ }
+ }
+
+ if (unfilteredConstructors!=null) {
+ for (int i=0; i<unfilteredConstructors.length; ++i) {
+ ((ConstructorDocImpl)unfilteredConstructors[i]).resolve();
+ }
+ }
+
+ List isSerMethodList=new ArrayList();
+
+ if (null != maybeSerMethodList) {
+ for (Iterator it=maybeSerMethodList.iterator(); it.hasNext(); ) {
+ MethodDocImpl method=(MethodDocImpl)it.next();
+ method.resolve();
+
+ if (((method.name().equals("readObject")
+ && method.signature().equals("(java.io.ObjectInputStream)"))
+ || (method.name().equals("writeObject")
+ && method.signature().equals("(java.io.ObjectOutputStream)"))
+ || (method.name().equals("readExternal")
+ && method.signature().equals("(java.io.ObjectInput)"))
+ || (method.name().equals("writeExternal")
+ && method.signature().equals("(java.io.ObjectOutput)"))
+ || (method.name().equals("readResolve")
+ && method.signature().equals("()")))) {
+
+ isSerMethodList.add(method);
+ }
+ }
+ this.serializationMethods=(MethodDoc[])isSerMethodList.toArray(new MethodDoc[0]);
+ maybeSerMethodList=null;
+ }
+ }
+ }
+
+ public FieldDoc findFieldRec(String name) {
+ return findFieldRec(this, name);
+ }
+
+ private static FieldDoc findFieldRec(ClassDoc classDoc, String name)
+ {
+ FieldDoc field = findField(classDoc, name);
+ if (null!=field) {
+ return field;
+ }
+ else {
+ ClassDoc[] interfaces = classDoc.interfaces();
+ for (int i=0; i<interfaces.length; ++i) {
+ field = findFieldRec(interfaces[i], name);
+ if (null != field) {
+ return field;
+ }
+ }
+ if (null != classDoc.superclass()) {
+ return findFieldRec(classDoc.superclass(), name);
+ }
+ else {
+ return null;
+ }
+ }
+ }
+
+ private static FieldDoc findField(ClassDoc classDoc, String name)
+ {
+ FieldDoc[] fields = classDoc.fields(false);
+ for (int i=0; i<fields.length; ++i) {
+ if (fields[i].name().equals(name)) {
+ return fields[i];
+ }
+ }
+ return null;
+ }
+
+ public FieldDoc findField(String fieldName) {
+ for (int i=0; i<filteredFields.length; ++i) {
+ if (filteredFields[i].name().equals(fieldName)) {
+ return filteredFields[i];
+ }
+ }
+ return null;
+ }
+
+ public void resolveComments() {
+
+ super.resolveComments();
+
+ if (null != unfilteredFields) {
+ for (int i=0; i<unfilteredFields.length; ++i) {
+ ((FieldDocImpl)unfilteredFields[i]).resolveComments();
+ }
+ }
+
+ if (null != serializableFields) {
+ for (int i=0; i<serializableFields.length; ++i) {
+ ((FieldDocImpl)serializableFields[i]).resolveComments();
+ }
+ }
+ if (null != unfilteredMethods) {
+ for (int i=0; i<unfilteredMethods.length; ++i) {
+ ((MethodDocImpl)unfilteredMethods[i]).resolveComments();
+ }
+ }
+ if (null != unfilteredConstructors) {
+ for (int i=0; i<unfilteredConstructors.length; ++i) {
+ ((ConstructorDocImpl)unfilteredConstructors[i]).resolveComments();
+ }
+ }
+
+ resolveTags();
+ }
+
+
+ private String className=null;
+
+ private boolean isAbstract;
+ private boolean isInterface;
+ private boolean isAnnotation;
+ private boolean isEnum;
+ private ClassDoc[] interfaces;
+ private ClassDoc[] filteredInnerClasses;
+ private ClassDoc[] unfilteredInnerClasses;
+ private FieldDoc[] filteredFields;
+ private FieldDoc[] unfilteredFields;
+ private FieldDoc[] serializableFields;
+ private MethodDoc[] filteredMethods;
+ private MethodDoc[] unfilteredMethods;
+ private ConstructorDoc[] filteredConstructors;
+ private ConstructorDoc[] unfilteredConstructors;
+ private TypeVariable[] typeParameters;
+
+ private boolean resolved=false;
+
+ private ClassDoc superclass;
+
+ // Is this Doc item a class.
+ public boolean isClass() {
+ return !isInterface;
+ }
+
+ // return true if this Doc is include in the active set.
+ public boolean isIncluded() {
+ if (this == baseClassDoc) {
+ return isIncluded
+ || (null != containingClass && Main.getInstance().includeAccessLevel(accessLevel));
+ }
+ else {
+ return baseClassDoc.isIncluded();
+ }
+ }
+
+ void setIsIncluded(boolean b) {
+ this.isIncluded=b;
+ }
+
+ private boolean isIncluded=false;
+
+ void setImportedClasses(ClassDoc[] importedClasses) {
+ this.importedClasses=importedClasses;
+ }
+
+ private static Map typeMap = new HashMap();
+
+ Type typeForString(String typeName) throws ParseException {
+ String orgTypename=typeName;
+ int ndx=typeName.indexOf('[');
+ String dim="";
+ if (ndx>=0) {
+ for (int i=ndx; i<typeName.length(); ++i) {
+ if ("[]".indexOf(typeName.charAt(i))>=0) {
+ dim+=typeName.charAt(i);
+ }
+ }
+ typeName=typeName.substring(0,ndx).trim();
+ }
+
+ ClassDoc classDoc = findClass(typeName, dim);
+ if (null != classDoc) {
+ return classDoc;
+ }
+
+ Type type = (Type)typeMap.get(typeName+dim);
+ if (null!=type) {
+ try {
+ if (type.dimension().equals(dim)) {
+ return type;
+ }
+ else {
+ Type rc = (Type) ((WritableType)type).clone();
+ ((WritableType)rc).setDimension(dim);
+ return rc;
+ }
+ }
+ catch (CloneNotSupportedException e) {
+ throw new ParseException(e.toString());
+ }
+ }
+
+ if ("boolean".equals(typeName)
+ || "char".equals(typeName)
+ || "byte".equals(typeName)
+ || "short".equals(typeName)
+ || "int".equals(typeName)
+ || "long".equals(typeName)
+ || "void".equals(typeName)
+ || "float".equals(typeName)
+ || "double".equals(typeName)) {
+ Type rc=new TypeImpl(null, typeName, dim);
+ typeMap.put(typeName+dim, rc);
+ return rc;
+ }
+
+ if (Main.getInstance().isDocletRunning()) {
+ //System.err.println(findClass("java.lang.String"));
+ //throw new ParseException("Doclet running, class not found: "+typeName+" ("+orgTypename+")");
+ }
+ Type rc=new ClassDocProxy(typeName, this);
+ ((WritableType)rc).setDimension(dim);
+ return rc;
+ }
+
+ public boolean isException() {
+ for (ClassDoc cdi=this;
+ cdi!=null;
+ cdi=cdi.superclass()) {
+
+ if ("java.lang.Exception".equals(cdi.qualifiedName()))
+ return true;
+ }
+ return false;
+ }
+
+ public boolean isError() {
+ for (ClassDoc cdi=this; cdi!=null; cdi=cdi.superclass()) {
+ if ("java.lang.Error".equals(cdi.qualifiedName()))
+ return true;
+ }
+ return false;
+ }
+
+ public boolean isOrdinaryClass() {
+ return !isException() && !isError() && !isInterface();
+ }
+
+ public void setIsInterface(boolean b) {
+ this.isInterface=b;
+ }
+
+ public void setIsAnnotation(boolean b) {
+ this.isAnnotation=b;
+ }
+
+ public void setIsEnum(boolean b)
+ {
+ isEnum = b;
+ }
+
+ public ExecutableMemberDoc findExecutableRec(String nameAndSignature) {
+
+ ExecutableMemberDoc rc;
+ for (ClassDoc cdi=this; cdi!=null; ) {
+ rc=findMethod(cdi, nameAndSignature);
+ if (rc!=null) return rc;
+ rc=findConstructor(cdi, nameAndSignature);
+ if (rc!=null) return rc;
+
+ ClassDoc _superclass = cdi.superclass();
+ if (null == _superclass) {
+ break;
+ }
+ else {
+ cdi = _superclass;
+ }
+ }
+ return null;
+ }
+
+ public static ConstructorDoc findConstructor(ClassDoc classDoc, String nameAndSignature) {
+ int ndx=nameAndSignature.indexOf('(');
+ if (ndx<=0)
+ return null;
+ else {
+ String fullSignature = resolveSignature(classDoc, nameAndSignature.substring(ndx));
+ return findConstructor(classDoc,
+ nameAndSignature.substring(0,ndx),
+ fullSignature);
+ }
+ }
+
+ public static ConstructorDoc findConstructor(ClassDoc classDoc, String name, String signature) {
+ ConstructorDoc[] filteredConstructors = classDoc.constructors(true);
+ if (null != filteredConstructors) {
+ for (int i=0; i<filteredConstructors.length; ++i) {
+ ConstructorDoc constructor = filteredConstructors[i];
+ if (constructor.name().equals(name) && constructor.signature().equals(signature))
+ return constructor;
+ }
+ }
+ return null;
+ }
+
+ public static MethodDoc findMethod(ClassDoc classDoc, String nameAndSignature) {
+ int ndx=nameAndSignature.indexOf('(');
+ if (ndx<=0) {
+ return null;
+ }
+ else {
+ String name = nameAndSignature.substring(0,ndx);
+ String fullSignature = resolveSignature(classDoc, nameAndSignature.substring(ndx));
+ return findMethod(classDoc, name, fullSignature);
+ }
+ }
+
+ private static String resolveSignature(ClassDoc classDoc, String signature)
+ {
+ signature = signature.substring(1, signature.length() - 1).trim();
+ if (0 == signature.length()) {
+ return "()";
+ }
+ StringTokenizer st = new StringTokenizer(signature, ",");
+ StringBuffer fullSignature = new StringBuffer("(");
+ while (st.hasMoreTokens()) {
+ String type = st.nextToken().trim();
+ int ndx = type.length();
+ while (ndx > 0 && type.charAt(ndx - 1) == '[' || type.charAt(ndx - 1) == ']') {
+ -- ndx;
+ }
+ String dim = type.substring(ndx);
+ type = type.substring(0, ndx);
+ ClassDoc typeClass = classDoc.findClass(type);
+ if (fullSignature.length() > 1) {
+ fullSignature.append(",");
+ }
+ if (null != typeClass) {
+ fullSignature.append(typeClass.qualifiedName());
+ }
+ else {
+ fullSignature.append(type);
+ }
+ fullSignature.append(dim);
+ }
+ fullSignature.append(')');
+ return fullSignature.toString();
+ }
+
+ public static MethodDoc findMethod(ClassDoc classDoc, String name, String signature) {
+ MethodDoc[] filteredMethods = classDoc.methods(true);
+ if (null != filteredMethods) {
+ for (int i=0; i<filteredMethods.length; ++i) {
+ MethodDoc method = filteredMethods[i];
+ if (method.name().equals(name) && method.signature().equals(signature))
+ return method;
+ }
+ }
+ return null;
+ }
+
+ public boolean equals(Object o) {
+ return (o!=null) && (o instanceof ClassDoc) && ((ClassDoc)o).qualifiedName().equals(qualifiedName());
+ }
+
+ private List maybeSerMethodList;
+
+ void setMaybeSerMethodList(List maybeSerMethodList) {
+ this.maybeSerMethodList=maybeSerMethodList;
+ }
+
+ public void setDimension(String dimension) {
+ this.dimension = dimension;
+ }
+
+ public Object clone() throws CloneNotSupportedException {
+ ClassDocImpl result = (ClassDocImpl)super.clone();
+ result.baseClassDoc = baseClassDoc;
+ return result;
+ }
+
+ public int superHashCode()
+ {
+ return super.hashCode();
+ }
+
+ public int hashCode()
+ {
+ return qualifiedTypeName().hashCode();
+ }
+
+ public ClassDoc getBaseClassDoc()
+ {
+ return baseClassDoc;
+ }
+
+ public FieldDoc getFieldDoc(String name)
+ {
+ for (int i=0; i<unfilteredFields.length; ++i) {
+ if (name.equals(unfilteredFields[i].name())) {
+ return unfilteredFields[i];
+ }
+ }
+ return null;
+ }
+
+ public MethodDoc getMethodDoc(String name, String signature)
+ {
+ for (int i=0; i<unfilteredMethods.length; ++i) {
+ if (name.equals(unfilteredMethods[i].name())
+ && signature.equals(unfilteredMethods[i].signature())) {
+ return unfilteredMethods[i];
+ }
+ }
+ return null;
+ }
+
+
+ public ConstructorDoc getConstructorDoc(String signature)
+ {
+ for (int i=0; i<unfilteredConstructors.length; ++i) {
+ if (signature.equals(unfilteredConstructors[i].signature())) {
+ return unfilteredConstructors[i];
+ }
+ }
+ return null;
+ }
+
+ private Object findFieldValue(String identifier,
+ ClassDoc classDoc,
+ String fieldName,
+ Set visitedFields)
+ throws UnknownIdentifierException, IllegalExpressionException
+ {
+ while (classDoc != null) {
+ if (classDoc instanceof ClassDocImpl) {
+ FieldDocImpl fieldDoc
+ = (FieldDocImpl)((ClassDocImpl)classDoc).getFieldDoc(fieldName);
+ if (visitedFields.contains(fieldDoc)) {
+ throw new CircularExpressionException("Circular reference detected");
+ }
+ else if (null != fieldDoc) {
+ return fieldDoc.constantValue(visitedFields);
+ }
+ }
+ else {
+ ClassDoc[] _interfaces = classDoc.interfaces();
+ if (null != _interfaces) {
+ for (int i=0; i<_interfaces.length; ++i) {
+ if (_interfaces[i] instanceof ClassDocImpl) {
+ FieldDocImpl fieldDoc
+ = (FieldDocImpl)((ClassDocImpl)_interfaces[i]).getFieldDoc(fieldName);
+ if (visitedFields.contains(fieldDoc)) {
+ throw new CircularExpressionException("Circular reference detected");
+ }
+ else if (null != fieldDoc) {
+ return fieldDoc.constantValue(visitedFields);
+ }
+ }
+ }
+ }
+ }
+ classDoc = classDoc.superclass();
+ }
+ throw new UnknownIdentifierException(identifier);
+ }
+
+ public Object getValue(String identifier, Set visitedFields)
+ throws UnknownIdentifierException, IllegalExpressionException
+ {
+ int ndx = identifier.lastIndexOf('.');
+ if (ndx >= 0) {
+ String _className = identifier.substring(0, ndx);
+ String _fieldName = identifier.substring(ndx + 1);
+
+ ClassDoc _classDoc = findClass(_className);
+ if (null != _classDoc) {
+ return findFieldValue(identifier, _classDoc, _fieldName, visitedFields);
+ }
+ else {
+ throw new UnknownIdentifierException(identifier);
+ }
+ }
+ else {
+ return findFieldValue(identifier, this, identifier, visitedFields);
+ }
+ }
+
+ public boolean isPrimitive()
+ {
+ return false;
+ }
+
+ // Compares this Object with the specified Object for order.
+ public int compareTo(java.lang.Object o) {
+ int rc;
+
+ if (o instanceof ClassDocImpl) {
+
+ ClassDocImpl c1 = this;
+ ClassDocImpl c2 = (ClassDocImpl)o;
+
+ if (null != c1.containingClass() && null == c2.containingClass()) {
+ rc = c1.containingClass().compareTo(c2);
+ if (0 == rc) {
+ rc = 1;
+ }
+ return rc;
+ }
+ else if (null == c1.containingClass() && null != c2.containingClass()) {
+ rc = c1.compareTo(c2.containingClass());
+ if (0 == rc) {
+ rc = -1;
+ }
+ return rc;
+ }
+ else if (null != c1.containingClass() && null != c2.containingClass()) {
+ rc = c1.containingClass().compareTo(c2.containingClass());
+ if (0 != rc) {
+ return rc;
+ }
+ }
+
+ rc = super.compareTo(o);
+ if (0 == rc) {
+ return Main.getInstance().getCollator().compare(containingPackage().name(),
+ ((ClassDocImpl)o).containingPackage().name());
+ }
+ else {
+ return rc;
+ }
+ }
+ else {
+ return 1;
+ }
+ }
+
+ private List importStatementList;
+
+ public void setImportStatementList(List importStatementList)
+ {
+ this.importStatementList = new LinkedList();
+ this.importStatementList.addAll(importStatementList);
+ }
+
+ public List getImportSpecifierList()
+ {
+ return importStatementList;
+ }
+
+ public TypeVariable[] typeParameters()
+ {
+ return typeParameters;
+ }
+
+ /**
+ * <p>
+ * Parses the type variables declared in the class definition.
+ * The syntax is:
+ * </p>
+ * <p>
+ * <dl>
+ * <dt>TypeParameters:</dt>
+ * <dd><code>&lt; <em>TypeParameter</em> { <em>, TypeParameter }</code></dd>
+ * <dt>TypeParameter:</dt>
+ * <dd><code><em>Identifier</em> { <strong>extends</strong> <em>Bound</em>
+ * }</dd>
+ * <dt>Bound:</dt>
+ * <dd><code><em>Type</em>{<strong>&</strong> <em>Type</em> } </dd>
+ * </dl>
+ *
+ * @param rc the owning class.
+ * @param typeVariables the string to be parsed.
+ * @throws ParseException if parsing fails.
+ */
+ public static void parseTypeVariables(ClassDocImpl rc,
+ String typeVariables)
+ throws ParseException
+ {
+ List parsedBounds = null;
+ StringTokenizer parameters = new StringTokenizer(typeVariables,
+ Parser.WHITESPACE +
+ "<>,");
+ List variables = new ArrayList();
+ while (parameters.hasMoreTokens())
+ {
+ String parameter = parameters.nextToken();
+ StringTokenizer parts = new StringTokenizer(parameter,
+ Parser.WHITESPACE);
+ TypeVariableImpl variable = new TypeVariableImpl(rc.qualifiedName(),
+ parts.nextToken(),"",
+ rc);
+ if (parts.hasMoreTokens())
+ {
+ if (!parts.nextToken().equals("extends"))
+ throw new ParseException("Invalid type parameter: " + parameter);
+ StringTokenizer bounds = new StringTokenizer(parts.nextToken(),
+ Parser.WHITESPACE
+ + "&");
+ parsedBounds = new ArrayList();
+ while (bounds.hasMoreTokens())
+ {
+ String bound = bounds.nextToken();
+ int nameSep = bound.lastIndexOf(".");
+ String packageName = bound.substring(0, nameSep);
+ String boundName = bound.substring(nameSep, bound.length());
+ parsedBounds.add(new TypeImpl(packageName,boundName,""));
+ }
+ }
+ if (parsedBounds != null)
+ variable.setBounds(parsedBounds);
+ variables.add(variable);
+ }
+ rc.setTypeParameters(variables);
+ }
+
+ /**
+ * Set the type parameters to the contents of the supplied list.
+ *
+ * @param variables a list of type parameters.
+ */
+ void setTypeParameters(List variables)
+ {
+ typeParameters =
+ (TypeVariable[]) variables.toArray(new TypeVariable[variables.size()]);
+ }
+
+}
+
diff --git a/tools/gnu/classpath/tools/gjdoc/ClassDocProxy.java b/tools/gnu/classpath/tools/gjdoc/ClassDocProxy.java
new file mode 100644
index 000000000..79abf3dc6
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/ClassDocProxy.java
@@ -0,0 +1,152 @@
+/* gnu.classpath.tools.gjdoc.ClassDocProxy
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import com.sun.javadoc.*;
+
+import java.io.*;
+
+public class ClassDocProxy implements ClassDoc, WritableType {
+
+ private String name;
+ private String qualifiedName;
+ private ClassDoc classContext;
+ private String dimension = "";
+
+ public ClassDocProxy(String qualifiedName, ClassDoc classContext)
+ {
+ this.qualifiedName
+ = Main.getRootDoc().resolveClassName(qualifiedName,
+ (ClassDocImpl)classContext);
+ this.classContext=classContext;
+ int pndx=qualifiedName.lastIndexOf('.');
+ if (pndx>=0) {
+ this.name=qualifiedName.substring(pndx+1);
+ }
+ else {
+ this.name=qualifiedName;
+ }
+ }
+
+ private final String errorText()
+ {
+ return "CLASS "+qualifiedName+" NOT LOADED.";
+ }
+
+ public ConstructorDoc[] constructors() { return new ConstructorDoc[0]; }
+ public ConstructorDoc[] constructors(boolean filtered) { return new ConstructorDoc[0]; }
+ public boolean definesSerializableFields() { return false; }
+ public FieldDoc[] fields() { return new FieldDoc[0]; }
+ public FieldDoc[] fields(boolean filtered) { return new FieldDoc[0]; }
+ public ClassDoc findClass(java.lang.String className) { return null; }
+ public ClassDoc[] importedClasses() { return new ClassDoc[0]; }
+ public PackageDoc[] importedPackages() { return new PackageDoc[0]; }
+ public ClassDoc[] innerClasses() { return new ClassDoc[0]; }
+ public ClassDoc[] innerClasses(boolean filtered) { return new ClassDoc[0]; }
+ public ClassDoc[] interfaces() { return new ClassDoc[0]; }
+ public boolean isAbstract() { return false; }
+ public boolean isExternalizable() { return false; }
+ public boolean isSerializable() { return false; }
+ public MethodDoc[] methods() { return new MethodDoc[0]; }
+ public MethodDoc[] methods(boolean filtered) { return new MethodDoc[0]; }
+ public FieldDoc[] serializableFields() { return new FieldDoc[0]; }
+ public MethodDoc[] serializationMethods() { return new MethodDoc[0]; }
+ public boolean subclassOf(ClassDoc cd) { return false; }
+ public ClassDoc superclass() { return null; }
+ public ClassDoc containingClass() { return null; }
+ public PackageDoc containingPackage() {
+ /*
+ try {
+ File file=Main.getRootDoc().findScheduledClass(qualifiedName, classContext);
+ if (file!=null) {
+ //String clsName=file.getCanonicalFile().getAbsolutePath().substring(new File(Main.getRootDoc().getSourcePath()).getCanonicalFile().getAbsolutePath().length()+1);
+ String clsName=file.getAbsolutePath().substring(new File(Main.getRootDoc().getSourcePath()).getAbsolutePath().length()+1);
+ clsName=clsName.substring(0,clsName.length()-5).replace(File.separatorChar,'.');
+ Debug.log(9,"ClassDocProxy '"+qualifiedName+"': found class "+clsName);
+ qualifiedName=clsName;
+ }
+ return new PackageDocImpl("test.");
+ }
+ catch (Exception e) {
+ return PackageDocImpl.DEFAULT_PACKAGE;
+ }
+ */
+ return PackageDocImpl.DEFAULT_PACKAGE;
+ }
+
+ public boolean isFinal() { return false; }
+ public boolean isPackagePrivate() { return false; }
+ public boolean isPrivate() { return false; }
+ public boolean isProtected() { return false; }
+ public boolean isPublic() { return false; }
+ public boolean isStatic() { return false; }
+ public String modifiers() { return ""; }
+ public int modifierSpecifier() { return 0; }
+ public String qualifiedName() { return qualifiedName; }
+ public String commentText() { return null; }
+ public Tag[] firstSentenceTags() { return new Tag[0]; }
+ public String getRawCommentText() { return null; }
+ public Tag[] inlineTags() { return new Tag[0]; }
+ public boolean isClass() { return false; }
+ public boolean isConstructor() { return false; }
+ public boolean isError() { return false; }
+ public boolean isException() { return false; }
+ public boolean isField() { return false; }
+ public boolean isIncluded() { return false; }
+ public boolean isInterface() { return false; }
+ public boolean isMethod() { return false; }
+ public boolean isOrdinaryClass() { return false; }
+ public String name() { return name; }
+ public SourcePosition position() { return null; }
+ public SeeTag[] seeTags() { return new SeeTag[0]; }
+ public void setRawCommentText(java.lang.String rawDocumentation) {}
+ public Tag[] tags() { return new Tag[0]; }
+ public Tag[] tags(java.lang.String tagname) { return new Tag[0]; }
+ public String typeName() { return name; }
+ public String qualifiedTypeName() { return qualifiedName; }
+ public String dimension() { return dimension; }
+ public ClassDoc asClassDoc() { return this; }
+ public TypeVariable asTypeVariable() { return null; }
+ public boolean isPrimitive() { return false; }
+
+ public String toString() { return "ClassDocProxy{"+qualifiedName+", context="+classContext+"}"; }
+
+ public void setDimension(String dimension) {
+ this.dimension = dimension;
+ }
+
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ // Compares this Object with the specified Object for order.
+ public int compareTo(java.lang.Object o) {
+ if (o instanceof Doc) {
+ return Main.getInstance().getCollator().compare(name(), ((Doc)o).name());
+ }
+ else {
+ return 0;
+ }
+ }
+
+ public TypeVariable[] typeParameters() { return new TypeVariable[0]; }
+
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/ClassDocReflectedImpl.java b/tools/gnu/classpath/tools/gjdoc/ClassDocReflectedImpl.java
new file mode 100644
index 000000000..2920e89f2
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/ClassDocReflectedImpl.java
@@ -0,0 +1,202 @@
+/* gnu.classpath.tools.gjdoc.ClassDocReflectedImpl
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import com.sun.javadoc.*;
+import java.util.Map;
+import java.util.HashMap;
+
+public class ClassDocReflectedImpl
+ implements ClassDoc, WritableType
+{
+ private Class clazz;
+ private String name;
+ private ClassDoc superclassDoc;
+ private ClassDoc[] unfilteredInnerClasses;
+ private String dimension = "";
+
+ private static Map reflectionCache = new HashMap();
+
+ public static ClassDocReflectedImpl newInstance(Class clazz)
+ {
+ ClassDocReflectedImpl result
+ = (ClassDocReflectedImpl)reflectionCache.get(clazz);
+ if (null != result) {
+ return result;
+ }
+ else {
+ return new ClassDocReflectedImpl(clazz);
+ }
+ }
+
+ public ClassDocReflectedImpl(Class clazz)
+ {
+ reflectionCache.put(clazz, this);
+
+ //System.err.println("ClassDocReflectedImpl: " + clazz);
+
+ this.clazz = clazz;
+ String className = clazz.getName();
+ int ndx = className.lastIndexOf('.');
+ if (ndx >= 0) {
+ this.name = className.substring(ndx + 1);
+ }
+ else {
+ this.name = className;
+ }
+
+ Class superclass = clazz.getSuperclass();
+ if (null != superclass && !clazz.getName().equals("java.lang.Object")) {
+ this.superclassDoc = (ClassDocReflectedImpl)reflectionCache.get(superclass);
+ if (null == this.superclassDoc) {
+ this.superclassDoc = new ClassDocReflectedImpl(superclass);
+ }
+ }
+
+ Class[] innerclasses = clazz.getDeclaredClasses();
+ this.unfilteredInnerClasses = new ClassDoc[innerclasses.length];
+ for (int i=0; i<innerclasses.length; ++i) {
+ this.unfilteredInnerClasses[i] = (ClassDocReflectedImpl)reflectionCache.get(innerclasses[i]);
+ if (null == this.unfilteredInnerClasses[i]) {
+ this.unfilteredInnerClasses[i] = new ClassDocReflectedImpl(innerclasses[i]);
+ //System.err.println("adding " + this.unfilteredInnerClasses[i] + " [" + innerclasses[i] + "] as inner class of " + this + " [" + clazz + "]");
+ }
+ }
+ }
+
+ public ConstructorDoc[] constructors() { return new ConstructorDoc[0]; }
+ public ConstructorDoc[] constructors(boolean filtered) { return new ConstructorDoc[0]; }
+ public boolean definesSerializableFields() { return false; }
+ public FieldDoc[] fields() { return new FieldDoc[0]; }
+ public FieldDoc[] fields(boolean filtered) { return new FieldDoc[0]; }
+ public ClassDoc findClass(java.lang.String className) { return null; }
+ public ClassDoc[] importedClasses() { return new ClassDoc[0]; }
+ public PackageDoc[] importedPackages() { return new PackageDoc[0]; }
+ public ClassDoc[] innerClasses() { return new ClassDoc[0]; }
+ public ClassDoc[] innerClasses(boolean filtered)
+ {
+ if (filtered) {
+ return new ClassDoc[0];
+ }
+ else {
+ return unfilteredInnerClasses;
+ }
+ }
+
+ public ClassDoc[] interfaces() { return new ClassDoc[0]; }
+ public boolean isAbstract() { return false; }
+ public boolean isExternalizable() { return false; }
+ public boolean isSerializable() { return false; }
+ public MethodDoc[] methods() { return new MethodDoc[0]; }
+ public MethodDoc[] methods(boolean filtered) { return new MethodDoc[0]; }
+ public FieldDoc[] serializableFields() { return new FieldDoc[0]; }
+ public MethodDoc[] serializationMethods() { return new MethodDoc[0]; }
+ public boolean subclassOf(ClassDoc cd) { return false; }
+ public ClassDoc superclass() {
+ return superclassDoc;
+ }
+ public ClassDoc containingClass()
+ {
+ Class declaringClass = clazz.getDeclaringClass();
+ if (null != declaringClass) {
+ return new ClassDocReflectedImpl(declaringClass);
+ }
+ else {
+ return null;
+ }
+ }
+ public PackageDoc containingPackage()
+ {
+ Class outerClass = clazz;
+ while (null != outerClass.getDeclaringClass()) {
+ outerClass = outerClass.getDeclaringClass();
+ }
+
+ String packageName = outerClass.getName();
+ int ndx = packageName.lastIndexOf('.');
+ if (ndx > 0) {
+ packageName = packageName.substring(0, ndx);
+ }
+ else {
+ packageName = "";
+ }
+ PackageDoc result = Main.getRootDoc().findOrCreatePackageDoc(packageName);
+ return result;
+ }
+
+ public boolean isFinal() { return false; }
+ public boolean isPackagePrivate() { return false; }
+ public boolean isPrivate() { return false; }
+ public boolean isProtected() { return false; }
+ public boolean isPublic() { return false; }
+ public boolean isStatic() { return false; }
+ public String modifiers() { return ""; }
+ public int modifierSpecifier() { return 0; }
+ public String qualifiedName() { return clazz.getName().replace('$', '.'); }
+ public String commentText() { return null; }
+ public Tag[] firstSentenceTags() { return new Tag[0]; }
+ public String getRawCommentText() { return null; }
+ public Tag[] inlineTags() { return new Tag[0]; }
+ public boolean isClass() { return false; }
+ public boolean isConstructor() { return false; }
+ public boolean isError() { return false; }
+ public boolean isException() { return false; }
+ public boolean isField() { return false; }
+ public boolean isIncluded() { return false; }
+ public boolean isInterface() { return false; }
+ public boolean isMethod() { return false; }
+ public boolean isOrdinaryClass() { return false; }
+ public String name() { return name; }
+ public SourcePosition position() { return null; }
+ public SeeTag[] seeTags() { return new SeeTag[0]; }
+ public void setRawCommentText(java.lang.String rawDocumentation) {}
+ public Tag[] tags() { return new Tag[0]; }
+ public Tag[] tags(java.lang.String tagname) { return new Tag[0]; }
+ public String typeName() { return name; }
+ public String qualifiedTypeName() { return qualifiedName(); }
+ public ClassDoc asClassDoc() { return this; }
+ public TypeVariable asTypeVariable() { return null; }
+ public boolean isPrimitive() { return false; }
+
+ public String toString() { return "ClassDocReflectedImpl{"+qualifiedName()+"}"; }
+
+ public int compareTo(java.lang.Object o) {
+ if (o instanceof Doc) {
+ return Main.getInstance().getCollator().compare(name(), ((Doc)o).name());
+ }
+ else {
+ return 0;
+ }
+ }
+
+ public String dimension() { return dimension; }
+
+ public void setDimension(String dimension) {
+ this.dimension = dimension;
+ }
+
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public TypeVariable[] typeParameters() { return new TypeVariable[0]; }
+
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/ConstructorDocImpl.java b/tools/gnu/classpath/tools/gjdoc/ConstructorDocImpl.java
new file mode 100644
index 000000000..f114485c1
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/ConstructorDocImpl.java
@@ -0,0 +1,42 @@
+/* gnu.classpath.tools.gjdoc.ConstructorDocImpl
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import java.util.*;
+import com.sun.javadoc.*;
+
+public class ConstructorDocImpl extends ExecutableMemberDocImpl implements ConstructorDoc {
+
+ public ConstructorDocImpl(ClassDoc containingClass,
+ PackageDoc containingPackage,
+ SourcePosition position) {
+
+ super(containingClass,
+ containingPackage,
+ position);
+ }
+
+ // Is this Doc item a constructor.
+ public boolean isConstructor() {
+ return true;
+ }
+
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/Debug.java b/tools/gnu/classpath/tools/gjdoc/Debug.java
new file mode 100644
index 000000000..06f39a4fa
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/Debug.java
@@ -0,0 +1,50 @@
+/* gnu.classpath.tools.gjdoc.Debug
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+public final class Debug {
+
+ //private static int logLevel = 7;
+ private static int logLevel = 0;
+
+ static {
+ String llProp = System.getProperty("gnu.classpath.tools.gjdoc.LogLevel");
+ if (null!=llProp) logLevel = Integer.parseInt(llProp);
+ }
+
+ public static final void log(String msg) {
+ System.err.println(msg);
+ }
+
+ public static final void log(int level, String msg) {
+ if (level<=logLevel) {
+ System.err.println(msg);
+ }
+ }
+
+ public static final void dumpArray(int level, Object[] array) {
+ if (level<=logLevel) {
+ for (int i=0; i<array.length; ++i) {
+ System.err.println(" #"+i+": "+array[i]);
+ }
+ }
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/DirectoryTree.java b/tools/gnu/classpath/tools/gjdoc/DirectoryTree.java
new file mode 100644
index 000000000..7d8e4bc5c
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/DirectoryTree.java
@@ -0,0 +1,57 @@
+/* gnu.classpath.tools.gjdoc.DirectoryTree
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import java.io.*;
+
+public class DirectoryTree {
+
+ class FileNode {
+ File file;
+ FileNode[] subNodes;
+
+ FileNode(File file) {
+ this.file=file;
+ if (file.isDirectory()) {
+ File[] subFiles=file.listFiles();
+ subNodes=new FileNode[subFiles.length];
+ for (int i=0; i<subFiles.length; ++i) {
+ subNodes[i]=new FileNode(subFiles[i]);
+ }
+ }
+ }
+ }
+
+ FileNode root;
+
+ DirectoryTree(File path) {
+
+ System.err.print("Scanning "+path.getAbsolutePath()+"... ");
+
+ long now1=System.currentTimeMillis();
+
+ root=new FileNode(path);
+
+ long now2=System.currentTimeMillis();
+
+ System.err.println("took "+(now2-now1)+" ms");
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/DocImpl.java b/tools/gnu/classpath/tools/gjdoc/DocImpl.java
new file mode 100644
index 000000000..163051380
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/DocImpl.java
@@ -0,0 +1,1074 @@
+/* gnu.classpath.tools.gjdoc.DocImpl
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import com.sun.javadoc.*;
+import java.util.*;
+import java.text.*;
+import java.io.File;
+import javax.swing.text.Segment;
+
+/**
+ * Represents the least common denominator of all Javadoc
+ * comment classes.
+ */
+public abstract class DocImpl implements Doc, TagContainer {
+
+ protected static Tag[] seeTagEmptyArr = new SeeTagImpl[0];
+ protected static Tag[] linkTagEmptyArr = new LinkTagImpl[0];
+ protected static Tag[] paramTagEmptyArr = new ParamTagImpl[0];
+ protected static Tag[] throwsTagEmptyArr = new ThrowsTagImpl[0];
+ protected SourcePosition position;
+ private String boilerplateComment;
+
+ // Return the text of the comment for this doc item.
+ public String commentText() {
+
+ StringBuffer rc=new StringBuffer();
+
+ Tag[] textTags=(Tag[])tagMap.get("text");
+ if (textTags!=null) {
+ for (int i=0; i<textTags.length; ++i) {
+ rc.append(textTags[i].text());
+ }
+ }
+ return rc.toString();
+ }
+
+ // Compares this Object with the specified Object for order.
+ public int compareTo(java.lang.Object o) {
+ return Main.getInstance().getCollator().compare(name(), ((Doc)o).name());
+ }
+
+ // Return the first sentence of the comment as tags.
+ public Tag[] firstSentenceTags() {
+
+ Tag[] rc=(Tag[])tagMap.get("first");
+ if (rc==null) rc=new Tag[0];
+ return rc;
+ }
+
+ // Return the full unprocessed text of the comment.
+ public String getRawCommentText() {
+ if (rawDocumentation!=null)
+ return rawDocumentation;
+ else if (rawDocOffset>=0)
+ return Main.getRootDoc().readRawComment(rawDocOffset);
+ else
+ return null;
+ }
+
+ // Return comment as tags.
+ public Tag[] inlineTags() {
+
+ Tag[] rc=(Tag[])tagMap.get("inline");
+ if (rc==null) rc=new Tag[0];
+ return rc;
+ }
+
+ // Is this Doc item a class.
+ public boolean isClass() {
+ return false;
+ }
+
+ // Is this Doc item a constructor? False until overridden.
+ public boolean isConstructor() {
+ return false;
+ }
+
+ // Is this Doc item a error class? False until overridden.
+ public boolean isError() {
+ return false;
+ }
+
+ // Is this Doc item a exception class? False until overridden.
+ public boolean isException() {
+ return false;
+ }
+
+ // Is this Doc item a field? False until overridden.
+ public boolean isField() {
+ return false;
+ }
+
+ // return true if this Doc is include in the active set.
+ public boolean isIncluded() {
+ return false;
+ }
+
+ // Is this Doc item a interface? False until overridden.
+ public boolean isInterface() {
+ return false;
+ }
+
+ // Is this Doc item a simple method (i.e.
+ public boolean isMethod() {
+ return false;
+ }
+
+ public boolean isPackage() {
+ return false;
+ }
+
+ // Is this Doc item a ordinary class (i.e.
+ public boolean isOrdinaryClass() {
+ return false;
+ }
+
+ // Return the see also tags in this Doc item.
+ public SeeTag[] seeTags() {
+ return (SeeTag[])getTagArr("see", seeTagEmptyArr);
+ }
+
+ protected Tag[] getTagArr(String kindOfTag, Tag[] defaultRc) {
+ Tag[] rc=(Tag[])tagMap.get(kindOfTag);
+ if (rc==null) rc=defaultRc;
+ return rc;
+ }
+
+ // Set the full unprocessed text of the comment.
+ public void setRawCommentText(String rawDocumentation) {
+ this.rawDocumentation=rawDocumentation;
+ }
+
+ public void resolveComments() {
+
+ if (rawDocumentation!=null && tagMap.isEmpty()) {
+ char[] charArray = rawDocumentation.toCharArray();
+ int length = rawDocumentation.length();
+ int startOffset = 0;
+ int endOffset = 0;
+ if (charArray[0] == '/'
+ && charArray[1] == '*'
+ && charArray[2] == '*'
+ && charArray[length - 2] == '*'
+ && charArray[length - 1] == '/') {
+
+ startOffset = 3;
+ endOffset = 2;
+ }
+
+ this.tagMap=parseCommentTags(charArray,
+ startOffset,
+ length - endOffset,
+ getContextClass(),
+ getContextMember(),
+ null,
+ boilerplateComment);
+
+ if (Main.getInstance().isCacheRawComments()) {
+ rawDocOffset=Main.getRootDoc().writeRawComment(rawDocumentation);
+ rawDocumentation=null;
+ }
+
+ resolveTags();
+ }
+ else if (tagMap.isEmpty() && null != boilerplateComment) {
+ tagMap.put("all", new Tag[] { new TagImpl("@boilerplate", boilerplateComment,getContextClass(),null) });
+ tagMap.put("@boilerplate", new Tag[] { new TagImpl("@boilerplate", boilerplateComment,getContextClass(),null) });
+ }
+ }
+
+ public static int skipHtmlWhitespace(char[] buffer, int startIndex) {
+ while (startIndex < buffer.length) {
+ char c=buffer[startIndex];
+ if (!Parser.isWhitespace(c)) {
+ break;
+ }
+ else {
+ ++ startIndex;
+ }
+ }
+ return startIndex;
+ }
+
+ /**
+ * Looks for an end-of-sentence marker in <code>text</code>,
+ * starting at <code>startIndex</code> and stopping at
+ * <code>endIndex</code>.
+ *
+ * @param text the text to be searched
+ * @param startIndex index in <code>text</code> at which to start
+ * @param endIndex index in <code>text</code> at which to stop
+ *
+ * @return the index of the character following the end-of-sentence
+ * marker, <code>endIndex</code> if no end-of-sentence
+ * marker could be found, or -1 if not implemented.
+ */
+ private static int findEndOfSentence(char[] text, int startIndex,
+ int endIndex)
+ {
+ if (Main.getInstance().isUseBreakIterator()) {
+ Segment segment = new Segment(text, startIndex, endIndex - startIndex);
+ BreakIterator breakIterator = BreakIterator.getSentenceInstance(Main.getInstance().getLocale());
+ breakIterator.setText(segment);
+ int result = breakIterator.next();
+ if (BreakIterator.DONE == result) {
+ return endIndex;
+ }
+ else {
+ return result;
+ }
+ }
+ else {
+ while (startIndex < endIndex) {
+ if (text[startIndex] == '.'
+ && (startIndex+1 == endIndex
+ || Character.isWhitespace(text[startIndex+1])
+ || isHTMLBreakTag(text, startIndex+1, endIndex)
+ )) {
+ return startIndex;
+ }
+
+ startIndex++;
+ }
+ return endIndex;
+ }
+ }
+
+ /**
+ * Returns true is the text from start to end begins with a 'p' or 'br' tag.
+ */
+ private static boolean isHTMLBreakTag(char[] text, int start, int end)
+ {
+ String[] breakTags = {
+ "p>", "/p>", "h1>", "h2>", "h3>", "h4>", "h5>", "h6>", "hr>",
+ "pre>", "/pre>"
+ };
+
+ if (text[start] == '<') {
+
+ outer:
+ for (int i=0; i<breakTags.length; ++i) {
+ String tag = breakTags[i];
+ int len = tag.length();
+ if (start + len < end) {
+ for (int j=0; j<len; ++j) {
+ char c = tag.charAt(j);
+ if (Character.toLowerCase(text[start + 1 + j]) != c) {
+ continue outer;
+ }
+ }
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ //private static final StringBuffer buf=new StringBuffer(32768);
+ private static final StringBuffer whitespaceBuf=new StringBuffer();
+ private static char[] charBuf = new char[60000];
+ private static int bufPos = 0;
+
+ private static void appendToBuf(char c)
+ {
+ if (bufPos < charBuf.length) {
+ charBuf[bufPos++] = c;
+ }
+ else {
+ //
+ }
+ }
+
+ private static void appendToBuf(StringBuffer s)
+ {
+ if (bufPos + s.length() <= charBuf.length) {
+ s.getChars(0, s.length(), charBuf, bufPos);
+ bufPos += s.length();
+ }
+ else {
+ //
+ }
+ }
+
+ private static void setBufLength(int length)
+ {
+ bufPos = 0;
+ }
+
+ private static String bufToString()
+ {
+ return new String(charBuf, 0, bufPos);
+ }
+
+ private static int bufLength()
+ {
+ return bufPos;
+ }
+
+ public static Map parseCommentTags(char[] comment, int startIndex, int endIndex,
+ ClassDocImpl contextClass, MemberDocImpl contextMember,
+ AbstractTagImpl contextTag, String boilerplateComment) {
+
+ int rawDocStart=skipHtmlWhitespace(comment, startIndex);
+
+ int firstSentenceEnd = 0;
+
+ if (comment.length>rawDocStart) {
+
+ firstSentenceEnd = findEndOfSentence(comment, rawDocStart, comment.length);
+
+ if (firstSentenceEnd < 0) {
+ BreakIterator boundary = BreakIterator.getSentenceInstance(Locale.ENGLISH);
+ boundary.setText(new ArrayCharacterIterator(comment, rawDocStart));
+ boundary.first();
+ boundary.next();
+ firstSentenceEnd = boundary.current();
+ }
+
+ // Always include period at end of sentence if there is one.
+ if (firstSentenceEnd < comment.length
+ && '.' == comment[firstSentenceEnd]) {
+ ++ firstSentenceEnd;
+ }
+ }
+
+ final int STATE_BEGOFLINE = 1;
+ final int STATE_TEXT = 2;
+ final int STATE_PARAM = 3;
+ final int STATE_PARAMVALUE = 4;
+ final int STATE_PARAMWRAP = 5;
+ final int STATE_INLINEPARAM = 6;
+ final int STATE_INLINEPARAMVALUE = 7;
+ final int STATE_WHITESPACE = 8;
+ final int STATE_INLINEPARAMVALUE_BOL = 9;
+ final int STATE_IPV_WHITESPACE = 10;
+
+ int state=STATE_BEGOFLINE;
+ int prevState=STATE_TEXT;
+
+ setBufLength(0);
+ whitespaceBuf.setLength(0);
+
+ String paramName="", paramValue="";
+
+ Map tags=new HashMap();
+ tags.put("inline", new LinkedList());
+ tags.put("first", new LinkedList());
+ tags.put("all", new LinkedList());
+
+ final char EOL=(char)-1;
+
+ for (int i=rawDocStart; i<=endIndex; ++i) {
+ char c=(i<endIndex)?comment[i]:EOL;
+ char peek=(i<endIndex-1)?comment[i+1]:EOL;
+
+ switch (state){
+
+ case STATE_BEGOFLINE:
+ if (i==firstSentenceEnd) {
+ AbstractTagImpl newTag = addTag(tags, "text", bufToString(), true, contextClass, contextMember, contextTag, false);
+ if (null != newTag) {
+ contextTag = newTag;
+ }
+ setBufLength(0);
+ }
+
+ if (Parser.isWhitespace(c)) {
+ // ignore
+ }
+ else if (c=='*') {
+ // ignore, but go to STATE_TEXT
+ if (peek!='*' && peek!='@' && peek!=EOL) {
+ state=STATE_WHITESPACE;
+ }
+ }
+ else if (c=='@' || (c=='{' && peek=='@') || c==EOL) {
+ if (bufLength()>0) {
+ addTag(tags, "text", bufToString(), i<firstSentenceEnd, contextClass, contextMember, contextTag, false);
+ setBufLength(0);
+ }
+ if (c=='{') {
+ ++i;
+ state=STATE_INLINEPARAM;
+ }
+ else {
+ state=STATE_PARAM;
+ }
+ }
+ else {
+ state=STATE_TEXT;
+ appendToBuf(whitespaceBuf);
+ whitespaceBuf.setLength(0);
+ appendToBuf(c);
+ }
+ break;
+
+ case STATE_WHITESPACE:
+ if (i==firstSentenceEnd) {
+ AbstractTagImpl newTag = addTag(tags, "text", bufToString(), true, contextClass, contextMember, contextTag, false);
+ if (null != newTag) {
+ contextTag = newTag;
+ }
+ setBufLength(0);
+ }
+
+ if (c=='\n') {
+ whitespaceBuf.append(c);
+ state=STATE_BEGOFLINE;
+ }
+ else if (Parser.isWhitespace(c)) {
+ whitespaceBuf.append(c);
+ }
+ else if (c=='@' || (c=='{' && peek=='@') || c==EOL) {
+ if (bufLength()>0) {
+ AbstractTagImpl newTag = addTag(tags, "text", bufToString(), i<firstSentenceEnd, contextClass, contextMember, contextTag, false);
+ if (null != newTag) {
+ contextTag = newTag;
+ }
+ setBufLength(0);
+ }
+ if (c=='{') {
+ ++i;
+ state=STATE_INLINEPARAM;
+ }
+ else {
+ state=STATE_PARAM;
+ }
+ }
+ else {
+ appendToBuf(whitespaceBuf);
+ whitespaceBuf.setLength(0);
+ appendToBuf(c);
+ state=STATE_TEXT;
+ }
+ break;
+
+ case STATE_PARAMWRAP:
+ if (c=='\n') {
+ appendToBuf(c);
+ }
+ else if (Parser.isWhitespace(c)) {
+ // ignore
+ }
+ else if (c=='*') {
+ // ignore, but go to STATE_TEXT
+ /*
+ if (i<endIndex && comment[i+1]!='*' && comment[i+1]!='@') {
+ state=STATE_PARAMVALUE;
+ }
+ */
+ }
+ else if (c=='@' || c==EOL) {
+ paramValue=bufToString();
+ AbstractTagImpl newTag = addTag(tags, paramName, paramValue, i<firstSentenceEnd, contextClass, contextMember, contextTag, false);
+ if (null != newTag) {
+ contextTag = newTag;
+ }
+ setBufLength(0);
+ if (c=='{') {
+ ++i;
+ state=STATE_INLINEPARAM;
+ }
+ else {
+ state=STATE_PARAM;
+ }
+ }
+ else {
+ state=STATE_PARAMVALUE;
+ appendToBuf(c);
+ }
+ break;
+
+ case STATE_PARAM:
+ if (!(c==EOL || Parser.isWhitespace(c))) {
+ appendToBuf(c);
+ }
+ else if (c=='\n') {
+ paramName=bufToString();
+ setBufLength(0);
+ state=STATE_PARAMWRAP;
+ }
+ else {
+ paramName=bufToString();
+ setBufLength(0);
+ state=STATE_PARAMVALUE;
+ }
+ break;
+
+ case STATE_INLINEPARAM:
+ if (c=='}') {
+ // tag without value
+ paramName=bufToString();
+ AbstractTagImpl newTag = addTag(tags, paramName, "", i<firstSentenceEnd, contextClass, contextMember, contextTag, true);
+ if (null != newTag) {
+ contextTag = newTag;
+ }
+ state=prevState;
+ setBufLength(0);
+ }
+ else if (!(c==EOL || Parser.isWhitespace(c))) {
+ appendToBuf(c);
+ }
+ else if (c=='\n') {
+ paramName=bufToString();
+ setBufLength(0);
+ state=STATE_INLINEPARAMVALUE_BOL;
+ }
+ else {
+ paramName=bufToString();
+ setBufLength(0);
+ state=STATE_INLINEPARAMVALUE;
+ }
+ break;
+
+ case STATE_PARAMVALUE:
+ if (c==EOL) {
+ paramValue=bufToString();
+ AbstractTagImpl newTag = addTag(tags, paramName, paramValue, i<firstSentenceEnd, contextClass, contextMember, contextTag, false);
+ if (null != newTag) {
+ contextTag = newTag;
+ }
+ }
+ else if (c=='\n') {
+ appendToBuf(c);
+ state=STATE_PARAMWRAP;
+ }
+ else {
+ appendToBuf(c);
+ }
+ break;
+
+ case STATE_INLINEPARAMVALUE:
+ if (c=='\n') {
+ appendToBuf(c);
+ state=STATE_INLINEPARAMVALUE_BOL;
+ }
+ else if (c==EOL || c=='}') {
+ paramValue=bufToString();
+ AbstractTagImpl newTag = addTag(tags, paramName, paramValue, i<firstSentenceEnd, contextClass, contextMember, contextTag, true);
+ if (null != newTag) {
+ contextTag = newTag;
+ }
+ state=prevState;
+ setBufLength(0);
+ }
+ else {
+ appendToBuf(c);
+ }
+ break;
+
+ case STATE_INLINEPARAMVALUE_BOL:
+ if (Parser.isWhitespace(c)) {
+ // ignore
+ }
+ else if (c=='*') {
+ // ignore, but go to STATE_TEXT
+ if (i<endIndex && peek!='*') {
+ state=STATE_IPV_WHITESPACE;
+ }
+ }
+ else if (c==EOL) {
+ if (bufLength()>0) {
+ AbstractTagImpl newTag = addTag(tags, "text", bufToString(), i<firstSentenceEnd, contextClass, contextMember, contextTag, false);
+ if (null != newTag) {
+ contextTag = newTag;
+ }
+ }
+ }
+ else {
+ state=STATE_INLINEPARAMVALUE;
+ appendToBuf(whitespaceBuf);
+ whitespaceBuf.setLength(0);
+ appendToBuf(c);
+ }
+ break;
+
+ case STATE_IPV_WHITESPACE:
+ if (c=='\n') {
+ whitespaceBuf.append(c);
+ state=STATE_INLINEPARAMVALUE_BOL;
+ }
+ else if (Parser.isWhitespace(c)) {
+ whitespaceBuf.append(c);
+ }
+ else if (c==EOL) {
+ if (bufLength()>0) {
+ AbstractTagImpl newTag = addTag(tags, "text", bufToString(), i<firstSentenceEnd, contextClass, contextMember, contextTag, false);
+ if (null != newTag) {
+ contextTag = newTag;
+ }
+ setBufLength(0);
+ }
+ }
+ else {
+ appendToBuf(whitespaceBuf);
+ whitespaceBuf.setLength(0);
+ appendToBuf(c);
+ state=STATE_INLINEPARAMVALUE;
+ }
+ break;
+
+ case STATE_TEXT:
+ if (i==firstSentenceEnd) {
+ AbstractTagImpl newTag = addTag(tags, "text", bufToString(), true, contextClass, contextMember, contextTag, false);
+ if (null != newTag) {
+ contextTag = newTag;
+ }
+ setBufLength(0);
+ }
+
+ if (c==EOL) {
+ paramValue=bufToString();
+ AbstractTagImpl newTag = addTag(tags, "text", paramValue, i<firstSentenceEnd, contextClass, contextMember, contextTag, false);
+ if (null != newTag) {
+ contextTag = newTag;
+ }
+ }
+ else if (c=='\n') {
+ appendToBuf(c);
+ state=STATE_BEGOFLINE;
+ }
+ else if (c=='{' && peek=='@') {
+ paramValue=bufToString();
+ AbstractTagImpl newTag = addTag(tags, "text", paramValue, i<firstSentenceEnd, contextClass, contextMember, contextTag, false);
+ if (null != newTag) {
+ contextTag = newTag;
+ }
+ ++i;
+ setBufLength(0);
+ state=STATE_INLINEPARAM;
+ }
+ else {
+ appendToBuf(c);
+ }
+ break;
+
+ default:
+ throw new Error("illegal state "+state);
+ }
+ }
+
+
+ if (null == contextMember && null != boilerplateComment && Main.getInstance().isCopyLicenseText()) {
+ addTag(tags, "@boilerplate", boilerplateComment, false, contextClass, null, null, false);
+ }
+
+ Map rc=new HashMap();
+
+ for (Iterator it=tags.keySet().iterator(); it.hasNext(); ) {
+ String key=(String)it.next();
+ Tag[] templateArr;
+ List list=(List)tags.get(key);
+
+ if ("see".equals(key))
+ templateArr=new SeeTag[list.size()];
+ else if ("param".equals(key))
+ templateArr=new ParamTag[list.size()];
+ else if ("serialField".equals(key))
+ templateArr=new SerialFieldTag[list.size()];
+ else if ("throws".equals(key) || "exception".equals(key))
+ templateArr=new ThrowsTag[list.size()];
+ else {
+ templateArr=new Tag[list.size()];
+ }
+
+ rc.put(key, list.toArray(templateArr));
+ }
+
+ return rc;
+ }
+
+ private ClassDocImpl getContextClass() {
+ if (isClass() || isInterface()) {
+ return (ClassDocImpl)this;
+ }
+ else if (isField() || isMethod() || isConstructor()) {
+ return (ClassDocImpl)((MemberDocImpl)this).containingClass();
+ }
+ else {
+ return null;
+ }
+ }
+
+ private MemberDocImpl getContextMember() {
+ if (isField() || isMethod() || isConstructor()) {
+ return (MemberDocImpl)this;
+ }
+ else {
+ return null;
+ }
+ }
+
+ protected static AbstractTagImpl addTag(Map tags, String name,
+ String value, boolean isFirstSentence,
+ ClassDocImpl contextClass,
+ MemberDocImpl contextMember,
+ AbstractTagImpl contextTag,
+ boolean isInline) {
+
+ AbstractTagImpl tag = null;
+
+ boolean haveValue = (0 != value.trim().length());
+
+ String emptyWarning = "Empty @" + name + " tag.";
+
+ if (name.equals("param")) {
+ if (haveValue) {
+ tag=new ParamTagImpl(value, contextClass, contextMember);
+ }
+ else {
+ //printWarning(emptyWarning);
+ }
+ }
+ else if (name.equals("see")) {
+ if (haveValue) {
+ tag=new SeeTagImpl(value, contextClass);
+ }
+ else {
+ //printWarning(emptyWarning);
+ }
+ }
+ else if (name.equals("link") || name.equals("linkplain")) {
+ if (haveValue) {
+ tag=new LinkTagImpl("@" + name, value, contextClass);
+ isInline = true;
+ }
+ else {
+ //printWarning(emptyWarning);
+ }
+ }
+ else if (name.equals("value")) {
+ if (haveValue) {
+ tag=new ValueTagImpl(value, contextClass);
+ isInline = true;
+ }
+ else {
+ //printWarning(emptyWarning);
+ }
+ }
+ else if (name.equals("inheritDoc")) {
+ if (haveValue) {
+ //printWarning("@inheritDoc tags are not supposed to have any content.");
+ }
+ tag=new InheritDocTagImpl(contextClass, contextMember, contextTag);
+ isInline = true;
+ }
+ else if (name.equals("serialField")) {
+ if (haveValue) {
+ tag=new SerialFieldTagImpl(value, contextClass, contextMember);
+ }
+ else {
+ //printWarning(emptyWarning);
+ }
+ }
+ else if (name.equals("throws") || name.equals("exception")) {
+ if (haveValue) {
+ tag=new ThrowsTagImpl(value, contextClass, contextMember);
+ }
+ else {
+ //printWarning(emptyWarning);
+ }
+ name="throws";
+ }
+ else if (name.equals("text")) {
+ tag=new TextTagImpl(value);
+ isInline = true;
+ }
+ else {
+ tag=new TagImpl("@"+name, value.trim(), contextClass, contextMember);
+ // FIXME: consider taglets
+ }
+
+ if (tag != null) {
+ if (isInline) {
+ ((List)tags.get("inline")).add(tag);
+ if (isFirstSentence) {
+ if (name.equals("text")) {
+ String txt = ((TextTagImpl)tag).getText();
+ Tag newTag;
+ if (txt.startsWith("<p>")) {
+ newTag = new TextTagImpl(txt.substring(3));
+ }
+ else if (txt.endsWith("</p>")) {
+ newTag = new TextTagImpl(txt.substring(0, txt.length() - 4));
+ }
+ else {
+ newTag = tag;
+ }
+ ((List)tags.get("first")).add(newTag);
+
+ }
+ else {
+ ((List)tags.get("first")).add(tag);
+ }
+ }
+ }
+ else {
+ ((List)tags.get("all")).add(tag);
+ }
+
+ List l=((List)tags.get(name));
+ if (l==null) {
+ l=new LinkedList();
+ tags.put(name,l);
+ }
+ l.add(tag);
+
+ return isInline ? tag : contextTag;
+ }
+ else {
+ return null;
+ }
+ }
+
+ // Return all tags in this Doc item.
+ public Tag[] tags() {
+ Tag[] rc=(Tag[])tagMap.get("all");
+ if (rc==null) rc=new Tag[0];
+ return rc;
+ }
+
+ // Return tags of the specified kind in this Doc item.
+ public Tag[] tags(java.lang.String tagname) {
+ Tag[] rc=(Tag[])tagMap.get(tagname);
+ if (rc==null) rc=new Tag[0];
+ return rc;
+ }
+
+ protected String rawDocumentation;
+ protected long rawDocOffset=-1;
+
+ protected Map tagMap = new HashMap();
+
+ public Map getTagMap() { return tagMap; }
+
+ protected void resolveTags() {
+
+ Tag[] tags=tags();
+ for (int i=0; i<tags.length; ++i) {
+ ((AbstractTagImpl)tags[i]).resolve();
+ }
+
+ Tag[] inlineTags=inlineTags();
+ for (int i=0; i<inlineTags.length; ++i) {
+ ((AbstractTagImpl)inlineTags[i]).resolve();
+ }
+ }
+
+ private static Map classDocToFileMap = new HashMap();
+
+ private static File getFile(ClassDoc classDoc) {
+ File result = (File)classDocToFileMap.get(classDoc);
+ if (null == result) {
+ result = new File(((GjdocPackageDoc)classDoc.containingPackage()).packageDirectory(),
+ classDoc.name() + ".java");
+ classDocToFileMap.put(classDoc, result);
+ }
+ return result;
+ }
+
+ public static SourcePosition getPosition(ClassDoc classDoc)
+ {
+ return new SourcePositionImpl(getFile(classDoc), 0, 0);
+ }
+
+ public static SourcePosition getPosition(ClassDoc classDoc, char[] source, int startIndex)
+ {
+ int column = 0;
+ int line = 0;
+ for (int i=0; i<startIndex; ++i) {
+ if (10 == source[i]) {
+ ++ line;
+ column = 0;
+ }
+ else if (13 != source[i]) {
+ ++ column;
+ }
+ }
+ while (true) {
+ ClassDoc containingClassDoc = classDoc.containingClass();
+ if (null != containingClassDoc) {
+ classDoc = containingClassDoc;
+ }
+ else {
+ break;
+ }
+ }
+
+ File file = getFile(classDoc);
+
+ return new SourcePositionImpl(file, line + 1, column + 1);
+ }
+
+ public SourcePosition position()
+ {
+ return this.position;
+ }
+
+ public DocImpl(SourcePosition position)
+ {
+ this.position = position;
+ }
+
+ public void setPosition(SourcePosition position)
+ {
+ this.position = position;
+ }
+
+ private static TagContainer checkForInheritedDoc(ClassDoc classDoc,
+ MemberDocImpl memberDoc,
+ AbstractTagImpl tag)
+ {
+ DocImpl result;
+
+ if (!(classDoc instanceof ClassDocImpl)) {
+ result = null;
+ }
+ else if (null == memberDoc) {
+ result = (DocImpl)classDoc;
+ }
+ else if (memberDoc.isField()) {
+ result = (DocImpl)((ClassDocImpl)classDoc).getFieldDoc(memberDoc.name());
+ }
+ else if (memberDoc.isMethod()) {
+ result = (DocImpl)((ClassDocImpl)classDoc).getMethodDoc(memberDoc.name(),
+ ((MethodDoc)memberDoc).signature());
+ }
+ else if (memberDoc.isConstructor()) {
+ result = (DocImpl)((ClassDocImpl)classDoc).getConstructorDoc(((ConstructorDoc)memberDoc).signature());
+ }
+ else {
+ //assert(false);
+ throw new RuntimeException("memberDoc is supposed to be field, method or constructor");
+ }
+
+ if (null != result
+ && null != memberDoc
+ && null != tag) {
+
+ TagContainer tagDoc = null;
+
+ Tag[] tags = result.tags();
+ for (int i=0; i<tags.length; ++i) {
+ if (tags[i].kind().equals(tag.kind())) {
+ if ("@param".equals(tag.kind())) {
+ if (((ParamTagImpl)tags[i]).parameterName().equals(((ParamTagImpl)tag).parameterName())) {
+ tagDoc = (TagContainer)tags[i];
+ break;
+ }
+ }
+ else if ("@throws".equals(tag.kind())) {
+ if (((ThrowsTagImpl)tags[i]).exceptionName().equals(((ThrowsTagImpl)tag).exceptionName())) {
+ tagDoc = (TagContainer)tags[i];
+ break;
+ }
+ }
+ else if ("@return".equals(tag.kind())) {
+ tagDoc = (TagContainer)tags[i];
+ }
+ }
+ }
+
+ return tagDoc;
+ }
+
+ if (null == result || result.isEmptyDoc()) {
+ return null;
+ }
+ else {
+ return result;
+ }
+ }
+
+ public static TagContainer findInheritedDoc(ClassDoc classDoc,
+ MemberDocImpl memberDoc,
+ AbstractTagImpl tag)
+ {
+ TagContainer result;
+
+ // (Taken from Javadoc Solaris Tool documentation 1.5,
+ // section "Automatic Copying of Method Comments")
+
+ // Algorithm for Inheriting Method Comments - If a method does
+ // not have a doc comment, or has an {@inheritDoc} tag, the
+ // Javadoc tool searches for an applicable comment using the
+ // following algorithm, which is designed to find the most
+ // specific applicable doc comment, giving preference to
+ // interfaces over superclasses:
+
+ // 1. Look in each directly implemented (or extended) interface
+ // in the order they appear following the word implements (or
+ // extends) in the method declaration. Use the first doc comment
+ // found for this method.
+
+ ClassDoc[] interfaces = classDoc.interfaces();
+ if (null != interfaces) {
+ for (int i=0; i<interfaces.length; ++i) {
+ result = checkForInheritedDoc(interfaces[i], memberDoc, tag);
+ if (null != result) {
+ return result;
+ }
+ }
+ }
+
+ // 2. If step 1 failed to find a doc comment, recursively apply
+ // this entire algorithm to each directly implemented (or
+ // extended) interface, in the same order they were examined
+ // in step 1.
+
+ if (null != interfaces) {
+ for (int i=0; i<interfaces.length; ++i) {
+ result = findInheritedDoc(interfaces[i], memberDoc, tag);
+ if (null != result) {
+ return result;
+ }
+ }
+ }
+
+ ClassDoc superclassDoc = classDoc.superclass();
+
+ // 3. If step 2 failed to find a doc comment and this is a class
+ // other than Object (not an interface):
+ if (!classDoc.isInterface()
+ && null != superclassDoc
+ && !"java.lang.Object".equals(classDoc.qualifiedTypeName())) {
+
+ // 3a. If the superclass has a doc comment for this method, use it.
+
+ result = checkForInheritedDoc(superclassDoc, memberDoc, tag);
+ if (null != result) {
+ return result;
+ }
+
+ // 3b. If step 3a failed to find a doc comment, recursively
+ // apply this entire algorithm to the superclass.
+
+ return findInheritedDoc(superclassDoc,
+ memberDoc, tag);
+ }
+ else {
+ return null;
+ }
+ }
+
+ public boolean isEmptyDoc()
+ {
+ return tagMap.isEmpty();
+ }
+
+ void setBoilerplateComment(String boilerplateComment)
+ {
+ this.boilerplateComment = boilerplateComment;
+ }
+}
+
diff --git a/tools/gnu/classpath/tools/gjdoc/ErrorReporter.java b/tools/gnu/classpath/tools/gjdoc/ErrorReporter.java
new file mode 100644
index 000000000..a72c53e43
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/ErrorReporter.java
@@ -0,0 +1,104 @@
+/* gnu.classpath.tools.gjdoc.ErrorReporter
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import com.sun.javadoc.*;
+import java.io.*;
+import java.util.*;
+import java.lang.reflect.*;
+
+/**
+ * Simple implementation of a <code>DocErrorReporter</code>: writes
+ * to <code>System.err</code>.
+ */
+public class ErrorReporter implements DocErrorReporter {
+
+ private PrintStream out;
+
+ /**
+ * Keeps track of the number of errors occured
+ * during generation.
+ */
+ private int errorCount=0;
+
+ /**
+ * Keeps track of the number of warnings occured
+ * during generation.
+ */
+ private int warningCount=0;
+
+ /*
+ * When <code>true</code>, no notices will be emitted.
+ */
+ private boolean quiet = false;
+
+ /*
+ * When <code>true</code>, no warnings will be emitted.
+ */
+ private boolean noWarn = false;
+
+ public ErrorReporter()
+ {
+ this.out = System.err;
+ }
+
+ // Print error message, increment error count.
+ public void printError(java.lang.String msg) {
+ out.println("ERROR: "+msg);
+ ++errorCount;
+ }
+
+ // Print error message, increment error count.
+ public void printFatal(java.lang.String msg) {
+ out.println("FATAL: "+msg);
+ System.exit(10);
+ }
+
+ // Print a message.
+ public void printNotice(java.lang.String msg) {
+ if (!quiet) {
+ out.println(msg);
+ }
+ }
+
+ // Print warning message, increment warning count.
+ public void printWarning(java.lang.String msg) {
+ if (!noWarn) {
+ out.println("WARNING: "+msg);
+ ++warningCount;;
+ }
+ }
+
+ public int getErrorCount() {
+ return errorCount;
+ }
+
+ public int getWarningCount() {
+ return warningCount;
+ }
+
+ /**
+ * Specify whether notices should be printed.
+ */
+ public void setQuiet(boolean quiet) {
+ this.quiet = quiet;
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/ExecutableMemberDocImpl.java b/tools/gnu/classpath/tools/gjdoc/ExecutableMemberDocImpl.java
new file mode 100644
index 000000000..7dcdd25d2
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/ExecutableMemberDocImpl.java
@@ -0,0 +1,411 @@
+/* gnu.classpath.tools.gjdoc.ExecutableMemberDocImpl
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import java.util.*;
+import java.io.*;
+import com.sun.javadoc.*;
+
+public class ExecutableMemberDocImpl extends MemberDocImpl implements ExecutableMemberDoc {
+
+ protected ExecutableMemberDocImpl(ClassDoc containingClass,
+ PackageDoc containingPackage,
+ SourcePosition position) {
+
+ super(containingClass,
+ containingPackage,
+ position);
+ }
+
+ protected boolean processModifier(String word) {
+ if (super.processModifier(word)) {
+ return true;
+ }
+ else if (word.equals("synchronized")) {
+ isSynchronized=true;
+ return true;
+ }
+ else if (word.equals("native")) {
+ isNative=true;
+ return true;
+ }
+ else if (word.equals("abstract")) {
+ isAbstract=true;
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ private boolean isAbstract=false;
+ private boolean isNative=false;
+ private boolean isSynchronized=false;
+
+ public boolean isAbstract() { return isAbstract; }
+
+ public boolean isNative() { return isNative; }
+
+ public boolean isSynchronized() { return isSynchronized; }
+
+ public ClassDoc[] thrownExceptions() { return thrownExceptions; }
+
+ public Parameter[] parameters() { return parameters; }
+
+ public ThrowsTag[] throwsTags() {
+ return (ThrowsTag[])getTagArr("throws", throwsTagEmptyArr);
+ }
+
+ public ParamTag[] paramTags() {
+ return (ParamTag[])getTagArr("param", paramTagEmptyArr);
+ }
+
+ public String signature() { return signature; }
+ public String flatSignature() { return flatSignature; }
+
+ public ClassDoc overriddenClass() {
+ for (ClassDoc cdi=(ClassDoc)containingClass().superclass(); cdi!=null; cdi=(ClassDoc)cdi.superclass()) {
+ if (null!=ClassDocImpl.findMethod(cdi, name(), signature()))
+ return cdi;
+ }
+ return null;
+ }
+
+ public static ExecutableMemberDocImpl createFromSource(ClassDoc containingClass,
+ PackageDoc containingPackage,
+ char[] source, int startIndex, int endIndex) throws IOException, ParseException {
+
+ int lastchar=32;
+ StringBuffer methodName=new StringBuffer();
+ for (int i=startIndex; i<endIndex && source[i]!='('; ++i) {
+ if ((Parser.WHITESPACE.indexOf(lastchar)>=0 && Parser.WHITESPACE.indexOf(source[i])<0)
+ || (lastchar == ']' && Parser.WHITESPACE.indexOf(source[i])<0 && '[' != source[i])) {
+ methodName.setLength(0);
+ methodName.append(source[i]);
+ }
+ else if (Parser.WHITESPACE.indexOf(source[i])<0) {
+ methodName.append(source[i]);
+ }
+ lastchar=source[i];
+ }
+
+ ExecutableMemberDocImpl rc;
+
+ SourcePosition position = DocImpl.getPosition(containingClass, source, startIndex);
+
+ if (methodName.toString().equals(((ClassDocImpl)containingClass).getClassName())) {
+
+ // Constructor
+
+ rc=new ConstructorDocImpl(containingClass,
+ containingPackage,
+ position);
+ }
+ else {
+
+ // Normal method
+
+ rc=new MethodDocImpl(containingClass,
+ containingPackage,
+ position);
+ }
+
+ if (containingClass.isInterface())
+ rc.accessLevel=ACCESS_PUBLIC;
+
+ int ndx=rc.parseModifiers(source, startIndex, endIndex);
+ StringBuffer name = new StringBuffer();
+
+ final int STATE_NORMAL=1;
+ final int STATE_STARC=2;
+ final int STATE_SLASHC=3;
+
+ int state=STATE_NORMAL;
+
+ while (source[ndx]!='(' && ndx<endIndex) {
+ if (state==STATE_NORMAL) {
+ if (ndx<endIndex-1 && source[ndx]=='/' && source[ndx+1]=='/') {
+ ++ndx;
+ state=STATE_SLASHC;
+ }
+ else if (ndx<endIndex-1 && source[ndx]=='/' && source[ndx+1]=='*') {
+ ++ndx;
+ state=STATE_STARC;
+ }
+ else {
+ name.append(source[ndx]);
+ }
+ }
+ else if (state==STATE_SLASHC) {
+ if (source[ndx]=='\n')
+ state=STATE_NORMAL;
+ }
+ else if (state==STATE_STARC) {
+ if (ndx<endIndex-1 && source[ndx]=='*' && source[ndx+1]=='/') {
+ ++ndx;
+ state=STATE_NORMAL;
+ }
+ }
+ ++ndx;
+ }
+ rc.setName(name.toString().trim());
+
+ state=STATE_NORMAL;
+
+ ++ndx;
+ int endx;
+ String param="";
+ List parameterList=new ArrayList();
+ for (endx=ndx; endx<endIndex; ++endx) {
+ if (state==STATE_SLASHC) {
+ if (source[endx]=='\n') {
+ state=STATE_NORMAL;
+ }
+ }
+ else if (state==STATE_STARC) {
+ if (source[endx]=='*' && source[endx+1]=='/') {
+ state=STATE_NORMAL;
+ ++endx;
+ }
+ }
+ else if (source[endx]=='/' && source[endx+1]=='*') {
+ state=STATE_STARC;
+ ++endx;
+ }
+ else if (source[endx]=='/' && source[endx+1]=='/') {
+ state=STATE_SLASHC;
+ ++endx;
+ }
+ else if (source[endx]==',' || source[endx]==')') {
+ param=param.trim();
+ if (param.length()>0) {
+ int n = param.length()-1;
+ int paramNameStart = 0;
+ while (n >= 0) {
+ char c = param.charAt(n);
+ if ('[' == c || ']' == c || Parser.WHITESPACE.indexOf(c)>=0) {
+ paramNameStart = n + 1;
+ break;
+ }
+ else {
+ -- n;
+ }
+ }
+ while (n >= 0 && ('[' == param.charAt(n)
+ || ']' == param.charAt(n)
+ || Parser.WHITESPACE.indexOf(param.charAt(n))>=0)) {
+ -- n;
+ }
+ int paramTypeEnd = n + 1;
+ int paramTypeStart = 0;
+ while (n >= 0) {
+ char c = param.charAt(n);
+ if ('[' == c || ']' == c || Parser.WHITESPACE.indexOf(c)>=0) {
+ paramTypeStart = n + 1;
+ break;
+ }
+ else {
+ -- n;
+ }
+ }
+
+ String paramType;
+ String paramName;
+ if (0 != paramNameStart) {
+ paramType=param.substring(paramTypeStart, paramTypeEnd);
+ paramName=param.substring(paramNameStart);
+ }
+ else {
+ paramName = "";
+ StringBuffer paramTypeBuffer = new StringBuffer();
+ for (int i=0; i<param.length(); ++i) {
+ char c = param.charAt(i);
+ if ('[' != c && ']' != c && Parser.WHITESPACE.indexOf(c)<0) {
+ paramTypeBuffer.append(c);
+ }
+ }
+ paramType = paramTypeBuffer.toString();
+ }
+ String dimSuffix="";
+
+ for (int i=0; i<param.length(); ++i) {
+ if ('[' == param.charAt(i)) {
+ dimSuffix += "[]";
+ }
+ }
+ paramType+=dimSuffix;
+
+ if (paramType.startsWith("[")) {
+ System.err.println("broken param type in " + rc + " in " +containingClass);
+ }
+
+ parameterList.add(new ParameterImpl(paramName, paramType,
+ ((ClassDocImpl)containingClass).typeForString(paramType)));
+
+ param="";
+ }
+ }
+ else
+ param+=source[endx];
+
+ if (source[endx]==')' && state==STATE_NORMAL)
+ break;
+ }
+
+ rc.setParameters((Parameter[])parameterList.toArray(new Parameter[0]));
+
+ ++endx;
+ String word="";
+ String dimSuffix="";
+ boolean haveThrowsKeyword=false;
+ List thrownExceptionsList=new ArrayList();
+
+ state=STATE_NORMAL;
+ for (; endx<endIndex; ++endx) {
+ if (state==STATE_SLASHC) {
+ if (source[endx]=='\n') state=STATE_NORMAL;
+ }
+ else if (state==STATE_STARC) {
+ if (source[endx]=='*' && source[endx+1]=='/') {
+ state=STATE_NORMAL;
+ ++endx;
+ }
+ }
+ else if (source[endx]=='/' && source[endx+1]=='*') {
+ state=STATE_STARC;
+ ++endx;
+ }
+ else if (source[endx]=='/' && source[endx+1]=='/') {
+ state=STATE_SLASHC;
+ ++endx;
+ }
+ else if (Parser.WHITESPACE.indexOf(source[endx])>=0) {
+ word=word.trim();
+ if (!haveThrowsKeyword && word.length()>0) {
+ if (word.equals("throws")) haveThrowsKeyword=true;
+ else System.err.println("ARGH! "+word);
+ word="";
+ }
+ }
+ else if (source[endx]=='[' || source[endx]==']') {
+ dimSuffix += source[endx];
+ }
+ else if (source[endx]==',' || source[endx]=='{' || source[endx]==';') {
+ word=word.trim();
+ if (word.length()>0) {
+ ClassDoc exceptionType=rc.containingClass().findClass(word);
+ if (exceptionType==null) {
+ exceptionType=new ClassDocProxy(word,
+ rc.containingClass());
+ }
+ thrownExceptionsList.add(exceptionType);
+ }
+ if (source[endx]=='{') {
+ break;
+ }
+ else {
+ word="";
+ }
+ }
+ else {
+ word+=source[endx];
+ }
+ }
+
+ if (dimSuffix.length()>0) {
+ rc.setTypeName(rc.getTypeName()+dimSuffix);
+ }
+
+ rc.setThrownExceptions((ClassDoc[])thrownExceptionsList.toArray(new ClassDoc[0]));
+
+ return rc;
+ }
+
+ private ClassDoc[] thrownExceptions;
+ private Parameter[] parameters;
+ private String signature;
+ private String flatSignature;
+
+ void setParameters(Parameter[] parameters) {
+ this.parameters=parameters;
+ }
+
+ void setThrownExceptions(ClassDoc[] thrownExceptions) {
+ this.thrownExceptions=thrownExceptions;
+ }
+
+ void resolve() {
+
+ for (int i=0; i<thrownExceptions.length; ++i) {
+ if (thrownExceptions[i] instanceof ClassDocProxy) {
+ String className=thrownExceptions[i].qualifiedName();
+ ClassDoc realClassDoc=containingClass().findClass(className);
+ if (realClassDoc!=null)
+ thrownExceptions[i]=realClassDoc;
+ }
+ }
+
+ StringBuffer signatureBuf=new StringBuffer();
+ StringBuffer flatSignatureBuf=new StringBuffer();
+
+ for (int i=0; i<parameters.length; ++i) {
+ ((ParameterImpl)parameters[i]).resolve(containingClass());
+
+ if (signatureBuf.length()>0) {
+ signatureBuf.append(",");
+ flatSignatureBuf.append(",");
+ }
+ signatureBuf.append(parameters[i].type().qualifiedTypeName());
+ flatSignatureBuf.append(parameters[i].type().typeName());
+ signatureBuf.append(parameters[i].type().dimension());
+ flatSignatureBuf.append(parameters[i].type().dimension());
+ }
+ this.signature="("+signatureBuf.toString()+")";
+ this.flatSignature="("+flatSignatureBuf.toString()+")";
+
+ super.resolve();
+
+ }
+
+ public int compareTo(Object other) {
+ int rc;
+ if (other instanceof MemberDocImpl) {
+ MemberDocImpl otherMember = (MemberDocImpl)other;
+ rc = name().compareTo(otherMember.name());
+ if (0 == rc) {
+ if (other instanceof ExecutableMemberDocImpl) {
+ rc = signature().compareTo(((ExecutableMemberDocImpl)other).signature());
+ if (0 == rc) {
+ return containingClass().compareTo(otherMember.containingClass());
+ }
+ }
+ else {
+ rc = 1;
+ }
+ }
+ }
+ else {
+ rc = 1;
+ }
+ return rc;
+ }
+}
+
diff --git a/tools/gnu/classpath/tools/gjdoc/FieldDocImpl.java b/tools/gnu/classpath/tools/gjdoc/FieldDocImpl.java
new file mode 100644
index 000000000..8d5b66f81
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/FieldDocImpl.java
@@ -0,0 +1,392 @@
+/* gnu.classpath.tools.gjdoc.FieldDocImpl
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import java.util.*;
+import com.sun.javadoc.*;
+import java.lang.reflect.Modifier;
+
+import gnu.classpath.tools.gjdoc.expr.Evaluator;
+import gnu.classpath.tools.gjdoc.expr.CircularExpressionException;
+import gnu.classpath.tools.gjdoc.expr.IllegalExpressionException;
+
+public class FieldDocImpl
+ extends MemberDocImpl
+ implements FieldDoc, Cloneable
+{
+
+ private boolean isTransient;
+ private boolean isVolatile;
+ private String valueLiteral;
+ private Object constantValue;
+ private boolean constantValueEvaluated;
+
+ private FieldDocImpl(ClassDoc containingClass,
+ PackageDoc containingPackage,
+ SourcePosition position) {
+
+ super(containingClass,
+ containingPackage,
+ position);
+ }
+
+ private static FieldDocImpl createFieldDoc(FieldDocImpl prototype,
+ String fieldDef,
+ String fieldValueLiteral)
+ {
+ if (null != fieldValueLiteral && fieldValueLiteral.length() == 0) {
+ fieldValueLiteral = null;
+ }
+
+ try {
+ FieldDocImpl fieldDoc=(FieldDocImpl)prototype.clone();
+ String dimSuffix="";
+ while (fieldDef.trim().endsWith("[")
+ || fieldDef.trim().endsWith("]")) {
+ fieldDef=fieldDef.trim();
+ dimSuffix=fieldDef.charAt(fieldDef.length()-1)+dimSuffix;
+ fieldDef=fieldDef.substring(0,fieldDef.length()-1);
+ }
+
+ fieldDoc.setTypeName(fieldDoc.getTypeName()+dimSuffix);
+ fieldDoc.setName(fieldDef.trim());
+ fieldDoc.setValueLiteral(fieldValueLiteral);
+ return fieldDoc;
+ }
+ catch (CloneNotSupportedException e) {
+ // should not happen
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ public static Collection createFromSource(ClassDoc containingClass,
+ PackageDoc containingPackage,
+ char[] source, int startIndex, int endIndex) {
+
+ List rcList=new ArrayList();
+
+ FieldDocImpl fd=new FieldDocImpl(containingClass,
+ containingPackage,
+ DocImpl.getPosition(containingClass, source, startIndex));
+
+ int ndx=fd.parseModifiers(source, startIndex, endIndex);
+
+ if (containingClass.isInterface()) {
+ fd.accessLevel = ACCESS_PUBLIC;
+ }
+
+ final int STATE_FIELDNAME = 1;
+ final int STATE_FIELDVALUE = 2;
+ final int STATE_QUOTE = 3;
+ final int STATE_QUOTEBS = 4;
+ final int STATE_SQUOTE = 5;
+ final int STATE_SQUOTEBS = 6;
+ final int STATE_COMMENT = 7;
+ final int STATE_LINECOMMENT = 8;
+
+ int lastFieldDefStart = ndx;
+ int state = STATE_FIELDNAME;
+ int prevState = state;
+
+ int bracketCount = 0;
+
+ StringBuffer fieldNameBuf = new StringBuffer();
+ StringBuffer fieldValueLiteralBuf = new StringBuffer();
+
+ for (int i=ndx; i<endIndex; ++i) {
+
+ char c = source[i];
+ char nextChar = '\0';
+ if (i + 1 < endIndex) {
+ nextChar = source[i + 1];
+ }
+ switch (state) {
+ case STATE_FIELDNAME:
+ if ('/' == c && '/' == nextChar) {
+ prevState = state;
+ state = STATE_LINECOMMENT;
+ }
+ else if ('/' == c && '*' == nextChar) {
+ prevState = state;
+ state = STATE_COMMENT;
+ }
+ else if (',' == c || ';' == c) {
+ rcList.add(createFieldDoc(fd, fieldNameBuf.toString(), null));
+ fieldNameBuf.setLength(0);
+ }
+ else if ('=' == c) {
+ state = STATE_FIELDVALUE;
+ }
+ else if (!(' ' == c || '\n' == c || '\r' == c || '\t' == c)) {
+ fieldNameBuf.append(c);
+ }
+ break;
+
+ case STATE_FIELDVALUE:
+ if ('/' == c && '/' == nextChar) {
+ prevState = state;
+ state = STATE_LINECOMMENT;
+ }
+ else if ('/' == c && '*' == nextChar) {
+ prevState = state;
+ state = STATE_COMMENT;
+ }
+ else if ('\"' == c) {
+ prevState = state;
+ state = STATE_QUOTE;
+ fieldValueLiteralBuf.append(c);
+ }
+ else if ('\'' == c) {
+ prevState = state;
+ state = STATE_SQUOTE;
+ fieldValueLiteralBuf.append(c);
+ }
+ else if ('{' == c || '(' == c) {
+ ++ bracketCount;
+ fieldValueLiteralBuf.append(c);
+ }
+ else if ('}' == c || ')' == c) {
+ -- bracketCount;
+ fieldValueLiteralBuf.append(c);
+ }
+ else if (0 == bracketCount && (',' == c || ';' == c)) {
+ rcList.add(createFieldDoc(fd, fieldNameBuf.toString(),
+ fieldValueLiteralBuf.toString()));
+ fieldNameBuf.setLength(0);
+ fieldValueLiteralBuf.setLength(0);
+ state = STATE_FIELDNAME;
+ }
+ else {
+ fieldValueLiteralBuf.append(c);
+ }
+ break;
+
+ case STATE_QUOTE:
+ fieldValueLiteralBuf.append(c);
+ if ('\\' == c) {
+ state = STATE_QUOTEBS;
+ }
+ else if ('\"' == c) {
+ state = prevState;
+ }
+ break;
+
+ case STATE_SQUOTE:
+ fieldValueLiteralBuf.append(c);
+ if ('\\' == c) {
+ state = STATE_SQUOTEBS;
+ }
+ else if ('\'' == c) {
+ state = prevState;
+ }
+ break;
+
+ case STATE_QUOTEBS:
+ fieldValueLiteralBuf.append(c);
+ state = STATE_QUOTE;
+ break;
+
+ case STATE_SQUOTEBS:
+ fieldValueLiteralBuf.append(c);
+ state = STATE_SQUOTE;
+ break;
+
+ case STATE_LINECOMMENT:
+ if ('\n' == c) {
+ state = prevState;
+ }
+ break;
+
+ case STATE_COMMENT:
+ if ('*' == c && '/' == nextChar) {
+ ++ i;
+ state = prevState;
+ }
+ break;
+ }
+ }
+
+ if (fieldNameBuf.length() > 0) {
+ rcList.add(createFieldDoc(fd, fieldNameBuf.toString(),
+ fieldValueLiteralBuf.toString()));
+ }
+
+ return rcList;
+ }
+
+ public boolean isField() {
+ return true;
+ }
+
+ public boolean isTransient() { return isTransient; }
+
+ public boolean isVolatile() { return isVolatile; }
+
+ public SerialFieldTag[] serialFieldTags() { return new SerialFieldTag[0]; }
+
+ public int modifierSpecifier() {
+ return super.modifierSpecifier()
+ | (isVolatile()?Modifier.VOLATILE:0)
+ | (isTransient()?Modifier.TRANSIENT:0)
+ ;
+ }
+
+ protected boolean processModifier(String word) {
+ if (super.processModifier(word)) {
+ return true;
+ }
+ else if (word.equals("transient")) {
+ isTransient=true;
+ return true;
+ }
+ else if (word.equals("volatile")) {
+ isVolatile=true;
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ void resolve() {
+ resolveTags();
+ }
+
+ public boolean hasSerialTag() {
+ return true; //tagMap.get("serial")!=null;
+ }
+
+ public String toString() { return name(); }
+
+ public Object constantValue() {
+ return constantValue(new HashSet());
+ }
+
+ public Object constantValue(Set visitedFields) {
+ if (!isStatic()
+ || !isFinal()
+ || (!type().isPrimitive() && !"java.lang.String".equals(type().qualifiedTypeName()))
+ || type.dimension().length()>0
+ || null == valueLiteral) {
+
+ return null;
+
+ }
+ else {
+ if (!constantValueEvaluated) {
+
+ visitedFields.add(this);
+
+ String expression = "(" + type().typeName() + ")(" + valueLiteral + ")";
+ try {
+ this.constantValue = Evaluator.evaluate(expression,
+ visitedFields,
+ (ClassDocImpl)containingClass());
+ }
+ catch (CircularExpressionException e) {
+ // FIXME: This should use the error reporter
+ System.err.println("WARNING: Cannot resolve expression for field " + containingClass.qualifiedTypeName() + "." + name() + ": " + e.getMessage());
+ }
+ catch (IllegalExpressionException ignore) {
+ }
+ constantValueEvaluated = true;
+ }
+ return this.constantValue;
+ }
+ }
+
+ private static void appendCharString(StringBuffer result, char c, boolean inSingleCuotes)
+ {
+ switch (c) {
+ case '\b': result.append("\\b"); break;
+ case '\t': result.append("\\t"); break;
+ case '\n': result.append("\\n"); break;
+ case '\f': result.append("\\f"); break;
+ case '\r': result.append("\\r"); break;
+ case '\"': result.append("\\\""); break;
+ case '\'': result.append(inSingleCuotes ? "\\'" : "'"); break;
+ default:
+ if (c >= 32 && c <= 127) {
+ result.append(c);
+ }
+ else {
+ result.append("\\u");
+ String hexValue = Integer.toString((int)c, 16);
+ int zeroCount = 4 - hexValue.length();
+ for (int i=0; i<zeroCount; ++i) {
+ result.append('0');
+ }
+ result.append(hexValue);
+ }
+ }
+ }
+
+ public String constantValueExpression() {
+ Object value = constantValue();
+
+ if (null == value) {
+ return "null";
+ }
+ else if (value instanceof String) {
+ StringBuffer result = new StringBuffer("\"");
+ char[] chars = ((String)value).toCharArray();
+ for (int i=0; i<chars.length; ++i) {
+ appendCharString(result, chars[i], false);
+ }
+ result.append("\"");
+ return result.toString();
+ }
+ else if (value instanceof Float) {
+ return value.toString() + "f";
+ }
+ else if (value instanceof Long) {
+ return value.toString() + "L";
+ }
+ else if (value instanceof Character) {
+ StringBuffer result = new StringBuffer("'");
+ appendCharString(result, ((Character)value).charValue(), false);
+ result.append("'");
+ return result.toString();
+ }
+ else /* if (value instanceof Double
+ || value instanceof Integer
+ || value instanceof Short
+ || value instanceof Byte) */ {
+ return value.toString();
+ }
+ }
+
+ void setValueLiteral(String valueLiteral)
+ {
+ this.valueLiteral = valueLiteral;
+ }
+
+ public boolean isStatic()
+ {
+ return super.isStatic() || containingClass().isInterface();
+ }
+
+ public boolean isFinal()
+ {
+ return super.isFinal() || containingClass().isInterface();
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/GjdocPackageDoc.java b/tools/gnu/classpath/tools/gjdoc/GjdocPackageDoc.java
new file mode 100644
index 000000000..3a3e38f20
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/GjdocPackageDoc.java
@@ -0,0 +1,39 @@
+/* gnu.classpath.tools.gjdoc.GjdocPackageDoc
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import java.io.File;
+import com.sun.javadoc.PackageDoc;
+
+/**
+ * Extension of the PackageDoc interface which additionally provides
+ * the directory the package's source files are located in.
+ *
+ * @author Julian Scheid
+ */
+public interface GjdocPackageDoc extends PackageDoc
+{
+ /**
+ * Returns the directory this package's source files are located
+ * in.
+ */
+ public File packageDirectory();
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/GjdocRootDoc.java b/tools/gnu/classpath/tools/gjdoc/GjdocRootDoc.java
new file mode 100644
index 000000000..65020d7b7
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/GjdocRootDoc.java
@@ -0,0 +1,39 @@
+/* gnu.classpath.tools.gjdoc.GjdocRootDoc
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import java.io.File;
+import com.sun.javadoc.RootDoc;
+
+/**
+ * Extension of the RootDoc interface which additionally provides
+ * a method for flushing all state.
+ *
+ * @author Julian Scheid
+ */
+public interface GjdocRootDoc extends RootDoc
+{
+ /**
+ * Invalidate this RootDoc by flushing all associated data, but
+ * keep its error reporting functionality intact.
+ */
+ public void flush();
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/InheritDocTagImpl.java b/tools/gnu/classpath/tools/gjdoc/InheritDocTagImpl.java
new file mode 100644
index 000000000..773c5fd3b
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/InheritDocTagImpl.java
@@ -0,0 +1,86 @@
+/* gnu.classpath.tools.gjdoc.InheritDocTagImpl
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import com.sun.javadoc.*;
+import java.util.*;
+import java.text.*;
+
+/**
+ * Represents the <code>inheritDoc</code> tag.
+ */
+public class InheritDocTagImpl
+ extends AbstractTagImpl
+{
+ private ClassDocImpl contextClass;
+ private MemberDocImpl contextMember;
+ private AbstractTagImpl contextTag;
+
+ public InheritDocTagImpl(ClassDocImpl contextClass,
+ MemberDocImpl contextMember,
+ AbstractTagImpl contextTag)
+ {
+ super("");
+ this.contextClass = contextClass;
+ this.contextMember = contextMember;
+ this.contextTag = contextTag;
+ }
+
+ public String kind() {
+ return "@inheritDoc";
+ }
+
+ public String name() {
+ return "@inheritDoc";
+ }
+
+ private TagContainer inheritedDoc;
+ private boolean inheritedDocInitialized = false;
+
+ private TagContainer getInheritedDoc()
+ {
+ if (!inheritedDocInitialized) {
+ inheritedDoc = DocImpl.findInheritedDoc(contextClass, contextMember, contextTag);
+ inheritedDocInitialized = true;
+ }
+ return inheritedDoc;
+ }
+
+ public Tag[] firstSentenceTags() {
+ TagContainer _inheritedDoc = getInheritedDoc();
+ if (_inheritedDoc != null) {
+ return _inheritedDoc.firstSentenceTags();
+ }
+ else {
+ return null;
+ }
+ }
+
+ public Tag[] inlineTags() {
+ TagContainer _inheritedDoc = getInheritedDoc();
+ if (_inheritedDoc != null) {
+ return _inheritedDoc.inlineTags();
+ }
+ else {
+ return null;
+ }
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/JavadocWrapper.java b/tools/gnu/classpath/tools/gjdoc/JavadocWrapper.java
new file mode 100644
index 000000000..3728630bc
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/JavadocWrapper.java
@@ -0,0 +1,36 @@
+/* gnu.classpath.tools.gjdoc.JavadocWrapper
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import java.util.*;
+import java.io.*;
+import com.sun.javadoc.*;
+
+public class JavadocWrapper {
+
+ public static void main(String[] args) throws Exception {
+
+ Timer.setStartTime();
+ Class sunJavadocMain=Class.forName("com.sun.tools.javadoc.Main");
+ sunJavadocMain.getMethod("main", new Class[]{String[].class}).invoke(null, new Object[]{args});
+ }
+
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/LinkTagImpl.java b/tools/gnu/classpath/tools/gjdoc/LinkTagImpl.java
new file mode 100644
index 000000000..167c5154c
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/LinkTagImpl.java
@@ -0,0 +1,46 @@
+/* gnu.classpath.tools.gjdoc.LinkTagImpl
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import com.sun.javadoc.*;
+import java.util.*;
+import java.text.*;
+
+public class LinkTagImpl extends SeeTagImpl {
+
+ private String name;
+
+ public LinkTagImpl(String name, String _text, ClassDocImpl contextClass) {
+ super(_text, contextClass);
+ this.name = name;
+ }
+
+ public String name() { return name; }
+
+ public Tag[] firstSentenceTags() {
+ return new Tag[0]; //inlineTags();
+ }
+
+ public Tag[] inlineTags() {
+ return new Tag[0]; //new Tag[]{new TextTagImpl(referencedClassName)};
+ }
+
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/Main.java b/tools/gnu/classpath/tools/gjdoc/Main.java
new file mode 100644
index 000000000..6c2c77e5b
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/Main.java
@@ -0,0 +1,1846 @@
+/* gnu.classpath.tools.gjdoc.Main
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import com.sun.javadoc.*;
+import java.io.*;
+import java.util.*;
+import java.lang.reflect.*;
+import java.text.Collator;
+
+import gnu.classpath.tools.FileSystemClassLoader;
+
+/**
+ * Class that will launch the gjdoc tool.
+ */
+public final class Main
+{
+
+ /**
+ * Do we load classes that are referenced as base class?
+ */
+ static final boolean DESCEND_SUPERCLASS = true;
+
+ /**
+ * Do we load classes that are referenced as interface?
+ */
+ static final boolean DESCEND_INTERFACES = false;
+
+ /**
+ * Do we load classes that are imported in a source file?
+ */
+ static final boolean DESCEND_IMPORTED = true;
+
+ /**
+ * Document only public members.
+ */
+ static final int COVERAGE_PUBLIC = 0;
+
+ /**
+ * Document only public and protected members.
+ */
+ static final int COVERAGE_PROTECTED = 1;
+
+ /**
+ * Document public, protected and package private members.
+ */
+ static final int COVERAGE_PACKAGE = 2;
+
+ /**
+ * Document all members.
+ */
+ static final int COVERAGE_PRIVATE = 3;
+
+ /*
+ * FIXME: This should come from a ResourceBundle
+ */
+ private static final String STRING_TRY_GJDOC_HELP =
+ "Try `gjdoc --help' for more information.";
+
+ /**
+ * Grid for looking up whether a particular access level is included in the
+ * documentation.
+ */
+ static final boolean[][] coverageTemplates = new boolean[][]
+ { new boolean[]
+ { true, false, false, false }, // public
+ new boolean[]
+ { true, true, false, false }, // protected
+ new boolean[]
+ { true, true, true, false }, // package
+ new boolean[]
+ { true, true, true, true }, // private
+ };
+
+ /**
+ * Holds the Singleton instance of this class.
+ */
+ private static Main instance = new Main();
+
+ /**
+ * Avoid re-instantiation of this class.
+ */
+ private Main()
+ {
+ }
+
+ private static RootDocImpl rootDoc;
+
+ private ErrorReporter reporter;
+
+ /**
+ * Cache for version string from resource /version.properties
+ */
+ private String gjdocVersion;
+
+ /**
+ * <code>false</code> during Phase I: preparation of the documentation data.
+ * <code>true</code> during Phase II: documentation output by doclet.
+ */
+ boolean docletRunning = false;
+
+ //---- Command line options
+
+ /**
+ * Option "-doclet": name of the Doclet class to use.
+ */
+ private String option_doclet = "gnu.classpath.tools.doclets.htmldoclet.HtmlDoclet";
+
+ /**
+ * Option "-overview": path to the special overview file.
+ */
+ private String option_overview;
+
+ /**
+ * Option "-coverage": which members to include in generated documentation.
+ */
+ private int option_coverage = COVERAGE_PROTECTED;
+
+ /**
+ * Option "-help": display command line usage.
+ */
+ private boolean option_help;
+
+ /**
+ * Option "-docletpath": path to doclet classes.
+ */
+ private String option_docletpath;
+
+ /**
+ * Option "-classpath": path to additional classes.
+ */
+ private String option_classpath;
+
+ /**
+ * Option "-sourcepath": path to the Java source files to be documented.
+ * FIXME: this should be a list of paths
+ */
+ private List option_sourcepath = new ArrayList();
+
+ /**
+ * Option "-extdirs": path to Java extension files.
+ */
+ private String option_extdirs;
+
+ /**
+ * Option "-verbose": Be verbose when generating documentation.
+ */
+ private boolean option_verbose;
+
+ /**
+ * Option "-nowarn": Do not print warnings.
+ */
+ private boolean option_nowarn;
+
+ /**
+ * Option "-locale:" Specify the locale charset of Java source files.
+ */
+ private Locale option_locale = new Locale("en", "us");
+
+ /**
+ * Option "-encoding": Specify character encoding of Java source files.
+ */
+ private String option_encoding;
+
+ /**
+ * Option "-J": Specify flags to be passed to Java runtime.
+ */
+ private List option_java_flags = new LinkedList(); //ArrayList();
+
+ /**
+ * Option "-source:" should be 1.4 to handle assertions, 1.1 is no
+ * longer supported.
+ */
+ private String option_source = "1.2";
+
+ /**
+ * Option "-subpackages": list of subpackages to be recursively
+ * added.
+ */
+ private List option_subpackages = new ArrayList();
+
+ /**
+ * Option "-exclude": list of subpackages to exclude.
+ */
+ private List option_exclude = new ArrayList();
+
+ /**
+ * Option "-breakiterator" - whether to use BreakIterator for
+ * detecting the end of the first sentence.
+ */
+ private boolean option_breakiterator;
+
+ /**
+ * Option "-licensetext" - whether to copy license text.
+ */
+ private boolean option_licensetext;
+
+ /**
+ * The locale-dependent collator used for sorting.
+ */
+ private Collator collator;
+
+ /**
+ * true when --version has been specified on the command line.
+ */
+ private boolean option_showVersion;
+
+ /**
+ * true when -bootclasspath has been specified on the command line.
+ */
+ private boolean option_bootclasspath_specified;
+
+ /**
+ * true when -all has been specified on the command line.
+ */
+ private boolean option_all;
+
+ /**
+ * true when -reflection has been specified on the command line.
+ */
+ private boolean option_reflection;
+
+ // TODO: add the rest of the options as instance variables
+
+ /**
+ * Parse all source files/packages and subsequentially start the Doclet given
+ * on the command line.
+ *
+ * @param allOptions List of all command line tokens
+ */
+ private boolean startDoclet(List allOptions)
+ {
+
+ try
+ {
+
+ //--- Fetch the Class object for the Doclet.
+
+ Debug.log(1, "loading doclet class...");
+
+ Class docletClass;
+
+ if (null != option_docletpath) {
+ try {
+ FileSystemClassLoader docletPathClassLoader
+ = new FileSystemClassLoader(option_docletpath);
+ System.err.println("trying to load class " + option_doclet + " from path " + option_docletpath);
+ docletClass = docletPathClassLoader.findClass(option_doclet);
+ }
+ catch (Exception e) {
+ docletClass = Class.forName(option_doclet);
+ }
+ }
+ else {
+ docletClass = Class.forName(option_doclet);
+ }
+ //Object docletInstance = docletClass.newInstance();
+
+ Debug.log(1, "doclet class loaded...");
+
+ Method startTempMethod = null;
+ Method startMethod = null;
+ Method optionLenMethod = null;
+ Method validOptionsMethod = null;
+
+ //--- Try to find the optionLength method in the Doclet class.
+
+ try
+ {
+ optionLenMethod = docletClass.getMethod("optionLength", new Class[]
+ { String.class });
+ }
+ catch (NoSuchMethodException e)
+ {
+ // Ignore if not found; it's OK it the Doclet class doesn't define
+ // this method.
+ }
+
+ //--- Try to find the validOptions method in the Doclet class.
+
+ try
+ {
+ validOptionsMethod = docletClass.getMethod("validOptions", new Class[]
+ { String[][].class, DocErrorReporter.class });
+ }
+ catch (NoSuchMethodException e)
+ {
+ // Ignore if not found; it's OK it the Doclet class doesn't define
+ // this method.
+ }
+
+ //--- Find the start method in the Doclet class; complain if not found
+
+ try
+ {
+ startTempMethod = docletClass.getMethod("start", new Class[]
+ { TemporaryStore.class });
+ }
+ catch (Exception e)
+ {
+ // ignore
+ }
+ startMethod = docletClass.getMethod("start", new Class[]
+ { RootDoc.class });
+
+ //--- Feed the custom command line tokens to the Doclet
+
+ // stores all recognized options
+ List options = new LinkedList();
+
+ // stores packages and classes defined on the command line
+ List packageAndClasses = new LinkedList();
+
+ for (Iterator it = allOptions.iterator(); it.hasNext();)
+ {
+ String option = (String) it.next();
+
+ Debug.log(9, "parsing option '" + option + "'");
+
+ if (option.startsWith("-"))
+ {
+
+ //--- Parse option
+
+ int optlen = optionLength(option);
+
+ //--- Try to get option length from Doclet class
+
+ if (optlen <= 0 && optionLenMethod != null)
+ {
+
+ optionLenMethod.invoke(null, new Object[]
+ { option });
+
+ Debug.log(3, "invoking optionLen method");
+
+ optlen = ((Integer) optionLenMethod.invoke(null, new Object[]
+ { option })).intValue();
+
+ Debug.log(3, "done");
+ }
+
+ if (optlen <= 0) {
+
+ if (option.startsWith("-JD")) {
+ // Simulate VM option -D
+ String propertyValue = option.substring(3);
+ int ndx = propertyValue.indexOf('=');
+ if (ndx <= 0) {
+ reporter.printError("Illegal format in option " + option + ": use -JDproperty=value");
+ return false;
+ }
+ else {
+ String property = propertyValue.substring(0, ndx);
+ String value = propertyValue.substring(ndx + 1);
+ System.setProperty(property, value);
+ }
+ }
+ else if (option.startsWith("-J")) {
+ //--- Warn if VM option is encountered
+ reporter.printWarning("Ignored option " + option + ". Pass this option to the VM if required.");
+ }
+ else {
+ //--- Complain if not found
+
+ reporter.printError("Unknown option " + option);
+ reporter.printNotice(STRING_TRY_GJDOC_HELP);
+ return false;
+ }
+ }
+ else
+ {
+
+ //--- Read option values
+
+ String[] optionAndValues = new String[optlen];
+ optionAndValues[0] = option;
+ for (int i = 1; i < optlen; ++i)
+ {
+ if (!it.hasNext())
+ {
+ reporter.printError("Missing value for option " + option);
+ return false;
+ }
+ else
+ {
+ optionAndValues[i] = (String) it.next();
+ }
+ }
+
+ //--- Store option for processing later
+
+ options.add(optionAndValues);
+ }
+ }
+ else if (option.length() > 0)
+ {
+
+ //--- Add to list of packages/classes if not option or option
+ // value
+
+ packageAndClasses.add(option);
+ }
+ }
+
+ Debug.log(9, "options parsed...");
+
+ //--- For each package specified with the -subpackages option on
+ // the command line, recursively find all valid java files
+ // beneath it.
+
+ //--- For each class or package specified on the command line,
+ // check that it exists and find out whether it is a class
+ // or a package
+
+ for (Iterator it = option_subpackages.iterator(); it.hasNext();)
+ {
+ String subpackage = (String) it.next();
+ Set foundPackages = new LinkedHashSet();
+
+ for (Iterator pit = option_sourcepath.iterator(); pit.hasNext(); ) {
+ File sourceDir = (File)pit.next();
+ File packageDir = new File(sourceDir, subpackage.replace('.', File.separatorChar));
+ findPackages(subpackage, packageDir, foundPackages);
+ }
+
+ addFoundPackages(subpackage, foundPackages);
+ }
+
+ if (option_all) {
+ Set foundPackages = new LinkedHashSet();
+ for (Iterator pit = option_sourcepath.iterator(); pit.hasNext(); ) {
+ File sourceDir = (File)pit.next();
+ findPackages("", sourceDir, foundPackages);
+ }
+ addFoundPackages(null, foundPackages);
+ for (Iterator packageIt = foundPackages.iterator(); packageIt.hasNext(); ) {
+ String packageName = (String)packageIt.next();
+ if (null == packageName) {
+ packageName = "";
+ }
+ rootDoc.addSpecifiedPackageName(packageName);
+ }
+ }
+
+ for (Iterator it = packageAndClasses.iterator(); it.hasNext();)
+ {
+
+ String classOrPackage = (String) it.next();
+
+ boolean foundSourceFile = false;
+
+ if (classOrPackage.endsWith(".java")) {
+ for (Iterator pit = option_sourcepath.iterator(); pit.hasNext() && !foundSourceFile; ) {
+ File sourceDir = (File)pit.next();
+ File sourceFile = new File(sourceDir, classOrPackage);
+ if (sourceFile.exists() && !sourceFile.isDirectory()) {
+ rootDoc.addSpecifiedSourceFile(sourceFile);
+ foundSourceFile = true;
+ break;
+ }
+ }
+ if (!foundSourceFile) {
+ File sourceFile = new File(classOrPackage);
+ if (sourceFile.exists() && !sourceFile.isDirectory()) {
+ rootDoc.addSpecifiedSourceFile(sourceFile);
+ foundSourceFile = true;
+ }
+ }
+ }
+
+ if (!foundSourceFile) {
+ //--- Check for illegal name
+
+ if (classOrPackage.startsWith(".")
+ || classOrPackage.endsWith(".")
+ || classOrPackage.indexOf("..") > 0
+ || !checkCharSet(classOrPackage,
+ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_."))
+ {
+ throw new ParseException("Illegal class or package name '"
+ + classOrPackage + "'");
+ }
+
+ //--- Assemble absolute path to package
+
+ String classOrPackageRelPath = classOrPackage.replace('.',
+ File.separatorChar);
+
+ //--- Create one file object each for a possible package directory
+ // and a possible class file, and find out if they exist.
+
+ List packageDirs = rootDoc.findSourceFiles(classOrPackageRelPath);
+ List sourceFiles = rootDoc.findSourceFiles(classOrPackageRelPath + ".java");
+
+ boolean packageDirExists = !packageDirs.isEmpty();
+ boolean sourceFileExists = !sourceFiles.isEmpty();
+
+ //--- Complain if neither exists: not found
+
+ if (!packageDirExists && !sourceFileExists)
+ {
+ reporter.printError("Class or package " + classOrPackage
+ + " not found.");
+ return false;
+ }
+
+ //--- Complain if both exist: ambigious
+
+ else
+ if (packageDirExists && sourceFileExists)
+ {
+ reporter.printError("Ambigious class/package name "
+ + classOrPackage + ".");
+ return false;
+ }
+
+ //--- Otherwise, if the package directory exists, it is a package
+
+ else
+ if (packageDirExists) {
+ Iterator packageDirIt = packageDirs.iterator();
+ boolean packageDirFound = false;
+ while (packageDirIt.hasNext()) {
+ File packageDir = (File)packageDirIt.next();
+ if (packageDir.isDirectory()) {
+ rootDoc.addSpecifiedPackageName(classOrPackage);
+ packageDirFound = true;
+ break;
+ }
+ }
+ if (!packageDirFound) {
+ reporter.printError("No suitable file or directory found for" + classOrPackage);
+ return false;
+ }
+ }
+
+ //--- Otherwise, emit error message
+
+ else {
+ reporter.printError("No sources files found for package " + classOrPackage);
+ }
+ }
+ }
+
+ //--- Complain if no packages or classes specified
+
+ if (option_help) {
+ usage();
+ return true;
+ }
+
+ //--- Validate custom options passed on command line
+ // by asking the Doclet if they are OK.
+
+ String[][] customOptionArr = (String[][]) options
+ .toArray(new String[0][0]);
+ if (validOptionsMethod != null
+ && !((Boolean) validOptionsMethod.invoke(null, new Object[]
+ { customOptionArr, reporter })).booleanValue())
+ {
+ // Not ok: shutdown system.
+ reporter.printNotice(STRING_TRY_GJDOC_HELP);
+ return false;
+ }
+
+ if (!rootDoc.hasSpecifiedPackagesOrClasses()) {
+ reporter.printError("No packages or classes specified.");
+ reporter.printNotice(STRING_TRY_GJDOC_HELP);
+ return false;
+ }
+
+ rootDoc.setOptions(customOptionArr);
+
+ rootDoc.build();
+
+ //--- Bail out if no classes found
+
+ if (0 == rootDoc.classes().length
+ && 0 == rootDoc.specifiedPackages().length
+ && 0 == rootDoc.specifiedClasses().length)
+ {
+ reporter.printError("No packages or classes found(!).");
+ return false;
+ }
+
+ //--- Our work is done, tidy up memory
+
+ System.gc();
+ System.gc();
+
+ //--- Set flag indicating Phase II of documentation generation
+
+ docletRunning = true;
+
+ //--- Invoke the start method on the Doclet: produce output
+
+ reporter.printNotice("Running doclet...");
+
+ TemporaryStore tstore = new TemporaryStore(Main.rootDoc);
+
+ Thread.currentThread().setContextClassLoader(docletClass.getClassLoader());
+
+ if (null != startTempMethod)
+ {
+ startTempMethod.invoke(null, new Object[]
+ { tstore });
+ }
+ else
+ {
+ startMethod.invoke(null, new Object[]
+ { tstore.getAndClear() });
+ }
+
+ //--- Let the user know how many warnings/errors occured
+
+ if (reporter.getWarningCount() > 0)
+ {
+ reporter.printNotice(reporter.getWarningCount() + " warnings");
+ }
+
+ if (reporter.getErrorCount() > 0)
+ {
+ reporter.printNotice(reporter.getErrorCount() + " errors");
+ }
+
+ System.gc();
+
+ //--- Done.
+ return true;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ return false;
+ }
+ }
+
+ private void addFoundPackages(String subpackage, Set foundPackages)
+ {
+ if (foundPackages.isEmpty()) {
+ reporter.printWarning("No classes found under subpackage " + subpackage);
+ }
+ else {
+ boolean onePackageAdded = false;
+ for (Iterator rit = foundPackages.iterator(); rit.hasNext();) {
+ String foundPackage = (String)rit.next();
+ boolean excludeThisPackage = false;
+
+ for (Iterator eit = option_exclude.iterator(); eit.hasNext();) {
+ String excludePackage = (String)eit.next();
+ if (foundPackage.equals(excludePackage) ||
+ foundPackage.startsWith(excludePackage + ":")) {
+ excludeThisPackage = true;
+ break;
+ }
+ }
+
+ if (!excludeThisPackage) {
+ rootDoc.addSpecifiedPackageName(foundPackage);
+ onePackageAdded = true;
+ }
+ }
+ if (!onePackageAdded) {
+ if (null != subpackage) {
+ reporter.printWarning("No non-excluded classes found under subpackage " + subpackage);
+ }
+ else {
+ reporter.printWarning("No non-excluded classes found.");
+ }
+ }
+ }
+ }
+
+ /**
+ * Verify that the given file is a valid Java source file and that
+ * it specifies the given package.
+ */
+ private boolean isValidJavaFile(File file,
+ String expectedPackage)
+ {
+ try {
+ InputStream in = new BufferedInputStream(new FileInputStream(file));
+
+ int ch, prevChar = 0;
+
+ final int STATE_DEFAULT = 0;
+ final int STATE_COMMENT = 1;
+ final int STATE_LINE_COMMENT = 2;
+
+ int state = STATE_DEFAULT;
+
+ StringBuffer word = new StringBuffer();
+ int wordIndex = 0;
+
+ while ((ch = in.read()) >= 0) {
+ String completeWord = null;
+
+ switch (state) {
+ case STATE_COMMENT:
+ if (prevChar == '*' && ch == '/') {
+ state = STATE_DEFAULT;
+ }
+ break;
+
+ case STATE_LINE_COMMENT:
+ if (ch == '\n') {
+ state = STATE_DEFAULT;
+ }
+ break;
+
+ case STATE_DEFAULT:
+ if (prevChar == '/' && ch == '*') {
+ word.deleteCharAt(word.length() - 1);
+ if (word.length() > 0) {
+ completeWord = word.toString();
+ word.setLength(0);
+ }
+ state = STATE_COMMENT;
+ }
+ else if (prevChar == '/' && ch == '/') {
+ word.deleteCharAt(word.length() - 1);
+ if (word.length() > 0) {
+ completeWord = word.toString();
+ word.setLength(0);
+ }
+ state = STATE_LINE_COMMENT;
+ }
+ else if (" \t\r\n".indexOf(ch) >= 0) {
+ if (word.length() > 0) {
+ completeWord = word.toString();
+ word.setLength(0);
+ }
+ }
+ else if (1 == wordIndex && ';' == ch) {
+ if (word.length() > 0) {
+ completeWord = word.toString();
+ word.setLength(0);
+ }
+ else {
+ // empty package name in source file: "package ;" -> invalid source file
+ in.close();
+ return false;
+ }
+ }
+ else {
+ word.append((char)ch);
+ }
+ break;
+ }
+
+ if (null != completeWord) {
+ if (0 == wordIndex && !"package".equals(completeWord)) {
+ in.close();
+ return "".equals(expectedPackage);
+ }
+ else if (1 == wordIndex) {
+ in.close();
+ return expectedPackage.equals(completeWord);
+ }
+ ++ wordIndex;
+ }
+
+ prevChar = ch;
+ }
+
+ // no package or class found before end-of-file -> invalid source file
+
+ in.close();
+ return false;
+ }
+ catch (IOException e) {
+ reporter.printWarning("Could not examine file " + file + ": " + e);
+ return false;
+ }
+ }
+
+ /**
+ * Recursively try to locate valid Java packages under the given
+ * package specified by its name and its directory. Add the names
+ * of all valid packages to the result list.
+ */
+ private void findPackages(String subpackage,
+ File packageDir,
+ Set result)
+ {
+ File[] files = packageDir.listFiles();
+ if (null != files) {
+ for (int i=0; i<files.length; ++i) {
+ File file = files[i];
+ if (!file.isDirectory() && file.getName().endsWith(".java")) {
+ if (isValidJavaFile(file, subpackage)) {
+ if ("".equals(subpackage)) {
+ result.add(null);
+ }
+ else {
+ result.add(subpackage);
+ }
+ break;
+ }
+ }
+ }
+ for (int i=0; i<files.length; ++i) {
+ File file = files[i];
+ if (file.isDirectory()) {
+ String newSubpackage;
+ if (null != subpackage && subpackage.length() > 0) {
+ newSubpackage = subpackage + "." + file.getName();
+ }
+ else {
+ newSubpackage = file.getName();
+ }
+ findPackages(newSubpackage, file, result);
+ }
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ private static boolean validOptions(String options[][],
+ DocErrorReporter reporter)
+ {
+
+ boolean foundDocletOption = false;
+ for (int i = 0; i < options.length; i++)
+ {
+ String[] opt = options[i];
+ if (opt[0].equalsIgnoreCase("-doclet"))
+ {
+ if (foundDocletOption)
+ {
+ reporter.printError("Only one -doclet option allowed.");
+ return false;
+ }
+ else
+ {
+ foundDocletOption = true;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * Main entry point. This is the method called when gjdoc is invoked from the
+ * command line.
+ *
+ * @param args
+ * command line arguments
+ */
+ public static void main(String[] args)
+ {
+
+ try
+ {
+ //--- Remember current time for profiling purposes
+
+ Timer.setStartTime();
+
+ //--- Handle control to the Singleton instance of this class
+
+ int result = instance.start(args);
+
+ if (result < 0) {
+ // fatal error
+ System.exit(5);
+ }
+ else if (result > 0) {
+ // errors encountered
+ System.exit(1);
+ }
+ else {
+ // success
+ System.exit(0);
+ }
+ }
+ catch (Exception e)
+ {
+ //--- unexpected error
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
+
+ /**
+ * Parses command line arguments and subsequentially handles control to the
+ * startDoclet() method
+ *
+ * @param args The command line parameters.
+ */
+ public static int execute(String[] args)
+ {
+ try
+ {
+ int result = instance.start(args);
+ if (result < 0) {
+ // fatal error
+ return 5;
+ }
+ else if (result > 0) {
+ // errors encountered
+ return 1;
+ }
+ else {
+ // success
+ return 0;
+ }
+ }
+ catch (Exception e)
+ {
+ // unexpected error
+ return 1;
+ }
+ }
+
+ /**
+ * @param programName Name of the program (for error messages). *disregarded*
+ * @param args The command line parameters.
+ * @returns The return code.
+ */
+ public static int execute(String programName,
+ String[] args)
+ {
+ return execute(args);
+ }
+
+ /**
+ * @param programName Name of the program (for error messages).
+ * @param defaultDocletClassName Fully qualified class name.
+ * @param args The command line parameters.
+ * @returns The return code.
+ *//*
+ public static int execute(String programName,
+ String defaultDocletClassName,
+ String[] args)
+ {
+ // not yet implemented
+ }*/
+
+ /**
+ * @param programName Name of the program (for error messages).
+ * @param defaultDocletClassName Fully qualified class name.
+ * @param args The command line parameters.
+ * @returns The return code.
+ *//*
+ public static int execute(String programName,
+ String defaultDocletClassName,
+ String[] args)
+ {
+ // not yet implemented
+ }*/
+
+ /**
+ * @param programName Name of the program (for error messages).
+ * @param errWriter PrintWriter to receive error messages.
+ * @param warnWriter PrintWriter to receive error messages.
+ * @param noticeWriter PrintWriter to receive error messages.
+ * @param defaultDocletClassName Fully qualified class name.
+ * @param args The command line parameters.
+ * @returns The return code.
+ *//*
+ public static int execute(String programName,
+ PrintWriter errWriter,
+ PrintWriter warnWriter,
+ PrintWriter noticeWriter,
+ String defaultDocletClassName,
+ String[] args)
+ {
+ // not yet implemented
+ }*/
+
+ /**
+ * Parses command line arguments and subsequentially handles control to the
+ * startDoclet() method
+ *
+ * @param args
+ * Command line arguments, as passed to the main() method
+ * @return {@code -1} in case of a fatal error (invalid arguments),
+ * or the number of errors encountered.
+ * @exception ParseException
+ * FIXME
+ * @exception IOException
+ * if an IO problem occur
+ */
+ public int start(String[] args) throws ParseException, IOException
+ {
+
+ //--- Collect unparsed arguments in array and resolve references
+ // to external argument files.
+
+ List arguments = new ArrayList(args.length);
+
+ for (int i = 0; i < args.length; ++i)
+ {
+ if (!args[i].startsWith("@"))
+ {
+ arguments.add(args[i]);
+ }
+ else
+ {
+ FileReader reader = new FileReader(args[i].substring(1));
+ StreamTokenizer st = new StreamTokenizer(reader);
+ st.resetSyntax();
+ st.wordChars('\u0000', '\uffff');
+ st.quoteChar('\"');
+ st.quoteChar('\'');
+ st.whitespaceChars(' ', ' ');
+ st.whitespaceChars('\t', '\t');
+ st.whitespaceChars('\r', '\r');
+ st.whitespaceChars('\n', '\n');
+ while (st.nextToken() != StreamTokenizer.TT_EOF)
+ {
+ arguments.add(st.sval);
+ }
+ }
+ }
+
+ //--- Initialize Map for option parsing
+
+ initOptions();
+
+ //--- This will hold all options recognized by gjdoc itself
+ // and their associated arguments.
+ // Contains objects of type String[], where each entry
+ // specifies an option along with its aguments.
+
+ List options = new LinkedList();
+
+ //--- This will hold all command line tokens not recognized
+ // to be part of a standard option.
+ // These options are intended to be processed by the doclet
+ // Contains objects of type String, where each entry is
+ // one unrecognized token.
+
+ List customOptions = new LinkedList();
+
+ rootDoc = new RootDocImpl();
+ reporter = rootDoc.getReporter();
+
+ //--- Iterate over all options given on the command line
+
+ for (Iterator it = arguments.iterator(); it.hasNext();)
+ {
+
+ String arg = (String) it.next();
+
+ //--- Check if gjdoc recognizes this option as a standard option
+ // and remember the options' argument count
+
+ int optlen = optionLength(arg);
+
+ //--- Argument count == 0 indicates that the option is not recognized.
+ // Add it to the list of custom option tokens
+
+ //--- Otherwise the option is recognized as a standard option.
+ // if all required arguments are supplied. Create a new String
+ // array for the option and its arguments, and store it
+ // in the options array.
+
+ if (optlen > 0)
+ {
+ String[] option = new String[optlen];
+ option[0] = arg;
+ boolean optargs_ok = true;
+ for (int j = 1; j < optlen && optargs_ok; ++j)
+ {
+ if (it.hasNext())
+ {
+ option[j] = (String) it.next();
+ if (option[j].startsWith("-"))
+ {
+ optargs_ok = false;
+ }
+ }
+ else
+ {
+ optargs_ok = false;
+ }
+ }
+ if (optargs_ok)
+ options.add(option);
+ else
+ {
+ // If the option requires more arguments than given on the
+ // command line, issue a fatal error
+
+ reporter.printFatal("Missing value for option " + arg + ".");
+ }
+ }
+ }
+
+ //--- Create an array of String arrays from the dynamic array built above
+
+ String[][] optionArr = (String[][]) options.toArray(new String[options
+ .size()][0]);
+
+ //--- Validate all options and issue warnings/errors
+
+ if (validOptions(optionArr, rootDoc))
+ {
+
+ //--- We got valid options; parse them and store the parsed values
+ // in 'option_*' fields.
+
+ readOptions(optionArr);
+
+ //--- Show version and exit if requested by user
+
+ if (option_showVersion) {
+ System.out.println("gjdoc " + getGjdocVersion());
+ System.exit(0);
+ }
+
+ if (option_bootclasspath_specified) {
+ reporter.printWarning("-bootclasspath ignored: not supported by"
+ + " gjdoc wrapper script, or no wrapper script in use.");
+ }
+
+ // If we have an empty source path list, add the current directory ('.')
+
+ if (option_sourcepath.size() == 0)
+ option_sourcepath.add(new File("."));
+
+ //--- We have all information we need to start the doclet at this time
+
+ if (null != option_encoding) {
+ rootDoc.setSourceEncoding(option_encoding);
+ }
+ else {
+ // be quiet about this for now:
+ // reporter.printNotice("No encoding specified, using platform default: " + System.getProperty("file.encoding"));
+ rootDoc.setSourceEncoding(System.getProperty("file.encoding"));
+ }
+ rootDoc.setSourcePath(option_sourcepath);
+
+ //addJavaLangClasses();
+
+ if (!startDoclet(arguments)) {
+ return -1;
+ }
+ }
+
+ return reporter.getErrorCount();
+ }
+
+ private void addJavaLangClasses()
+ throws IOException
+ {
+ String resourceName = "/java.lang-classes-" + option_source + ".txt";
+ InputStream in = getClass().getResourceAsStream(resourceName);
+ BufferedReader reader = new BufferedReader(new InputStreamReader(in));
+ String line;
+ while ((line = reader.readLine()) != null) {
+
+ String className = line.trim();
+ if (className.length() > 0) {
+ ClassDocImpl classDoc =
+ new ClassDocImpl(null, new PackageDocImpl("java.lang"),
+ ProgramElementDocImpl.ACCESS_PUBLIC,
+ false, false, null);
+ classDoc.setClass(className);
+ rootDoc.addClassDoc(classDoc);
+ }
+ }
+ }
+
+ /**
+ * Helper class for parsing command line arguments. An instance of this class
+ * represents a particular option accepted by gjdoc (e.g. '-sourcepath') along
+ * with the number of expected arguments and behavior to parse the arguments.
+ */
+ private abstract class OptionProcessor
+ {
+
+ /**
+ * Number of arguments expected by this option.
+ */
+ private int argCount;
+
+ /**
+ * Initializes this instance.
+ *
+ * @param argCount
+ * number of arguments
+ */
+ public OptionProcessor(int argCount)
+ {
+ this.argCount = argCount;
+ }
+
+ /**
+ * Overridden by derived classes with behavior to parse the arguments
+ * specified with this option.
+ *
+ * @param args
+ * command line arguments
+ */
+ abstract void process(String[] args);
+ }
+
+ /**
+ * Maps option tags (e.g. '-sourcepath') to OptionProcessor objects.
+ * Initialized only once by method initOptions(). FIXME: Rename to
+ * 'optionProcessors'.
+ */
+ private static Map options = null;
+
+ /**
+ * Initialize all OptionProcessor objects needed to scan/parse command line
+ * options. This cannot be done in a static initializer block because
+ * OptionProcessors need access to the Singleton instance of the Main class.
+ */
+ private void initOptions()
+ {
+
+ options = new HashMap();
+
+ //--- Put one OptionProcessor object into the map
+ // for each option recognized.
+
+ options.put("-overview", new OptionProcessor(2)
+ {
+
+ void process(String[] args)
+ {
+ option_overview = args[0];
+ }
+ });
+ options.put("-public", new OptionProcessor(1)
+ {
+
+ void process(String[] args)
+ {
+ option_coverage = COVERAGE_PUBLIC;
+ }
+ });
+ options.put("-protected", new OptionProcessor(1)
+ {
+
+ void process(String[] args)
+ {
+ option_coverage = COVERAGE_PROTECTED;
+ }
+ });
+ options.put("-package", new OptionProcessor(1)
+ {
+
+ void process(String[] args)
+ {
+ option_coverage = COVERAGE_PACKAGE;
+ }
+ });
+ options.put("-private", new OptionProcessor(1)
+ {
+
+ void process(String[] args)
+ {
+ option_coverage = COVERAGE_PRIVATE;
+ }
+ });
+ OptionProcessor helpProcessor = new OptionProcessor(1)
+ {
+
+ void process(String[] args)
+ {
+ option_help = true;
+ }
+ };
+
+ options.put("-help", helpProcessor);
+ options.put("--help", helpProcessor);
+ options.put("-doclet", new OptionProcessor(2)
+ {
+
+ void process(String[] args)
+ {
+ option_doclet = args[0];
+ }
+ });
+ options.put("-docletpath", new OptionProcessor(2)
+ {
+
+ void process(String[] args)
+ {
+ option_docletpath = args[0];
+ }
+ });
+ options.put("-nowarn", new OptionProcessor(1)
+ {
+
+ void process(String[] args)
+ {
+ option_nowarn = true;
+ }
+ });
+ options.put("-source", new OptionProcessor(2)
+ {
+
+ void process(String[] args)
+ {
+ option_source = args[0];
+ if (!"1.2".equals(option_source)
+ && !"1.3".equals(option_source)
+ && !"1.4".equals(option_source)) {
+
+ throw new RuntimeException("Only he following values are currently"
+ + " supported for option -source: 1.2, 1.3, 1.4.");
+ }
+ }
+ });
+ OptionProcessor sourcePathProcessor = new OptionProcessor(2) {
+ void process(String[] args)
+ {
+ Debug.log(1, "-sourcepath is '" + args[0] + "'");
+ for (StringTokenizer st = new StringTokenizer(args[0],
+ File.pathSeparator); st.hasMoreTokens();)
+ {
+ String path = st.nextToken();
+ File file = new File(path);
+ if (!(file.exists()))
+ {
+ throw new RuntimeException("The source path " + path
+ + " does not exist.");
+ }
+ option_sourcepath.add(file);
+ }
+ }
+ };
+ options.put("-s", sourcePathProcessor);
+ options.put("-sourcepath", sourcePathProcessor);
+ options.put("-subpackages", new OptionProcessor(2)
+ {
+ void process(String[] args)
+ {
+ StringTokenizer st = new StringTokenizer(args[0], ":");
+ while (st.hasMoreTokens()) {
+ String packageName = st.nextToken();
+
+ if (packageName.startsWith(".")
+ || packageName.endsWith(".")
+ || packageName.indexOf("..") > 0
+ || !checkCharSet(packageName,
+ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_.")) {
+ throw new RuntimeException("Illegal package name '"
+ + packageName + "'");
+ }
+ option_subpackages.add(packageName);
+ }
+ }
+ });
+ options.put("-exclude", new OptionProcessor(2)
+ {
+ void process(String[] args)
+ {
+ StringTokenizer st = new StringTokenizer(args[0], ":");
+ while (st.hasMoreTokens()) {
+ String packageName = st.nextToken();
+
+ if (packageName.startsWith(".")
+ || packageName.endsWith(".")
+ || packageName.indexOf("..") > 0
+ || !checkCharSet(packageName,
+ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_.")) {
+ throw new RuntimeException("Illegal package name '"
+ + packageName + "'");
+ }
+ option_exclude.add(packageName);
+ }
+ }
+ });
+ // TODO include other options here
+ options.put("-verbose", new OptionProcessor(1)
+ {
+
+ void process(String[] args)
+ {
+ option_verbose = true;
+ System.err.println("WARNING: Unsupported option -verbose ignored");
+ }
+ });
+ options.put("-quiet", new OptionProcessor(1)
+ {
+
+ void process(String[] args)
+ {
+ reporter.setQuiet(true);
+ }
+ });
+ options.put("-locale", new OptionProcessor(2)
+ {
+
+ void process(String[] args)
+ {
+ String localeName = args[0];
+ String language = null;
+ String country = null;
+ String variant = null;
+ StringTokenizer st = new StringTokenizer(localeName, "_");
+ if (st.hasMoreTokens()) {
+ language = st.nextToken();
+ }
+ if (st.hasMoreTokens()) {
+ country = st.nextToken();
+ }
+ if (st.hasMoreTokens()) {
+ variant = st.nextToken();
+ }
+ if (variant != null) {
+ option_locale = new Locale(language, country, variant);
+ }
+ else if (country != null) {
+ option_locale = new Locale(language, country);
+ }
+ else if (language != null) {
+ option_locale = new Locale(language);
+ }
+ else {
+ throw new RuntimeException("Illegal locale specification '"
+ + localeName + "'");
+ }
+ }
+ });
+ options.put("-encoding", new OptionProcessor(2)
+ {
+
+ void process(String[] args)
+ {
+ option_encoding = args[0];
+ }
+ });
+ options.put("-breakiterator", new OptionProcessor(1)
+ {
+ void process(String[] args)
+ {
+ option_breakiterator = true;
+ }
+ });
+ options.put("-licensetext", new OptionProcessor(1)
+ {
+ void process(String[] args)
+ {
+ option_licensetext = true;
+ }
+ });
+ options.put("-overview", new OptionProcessor(2)
+ {
+ void process(String[] args)
+ {
+ try {
+ getRootDoc().setRawCommentText(RootDocImpl.readHtmlBody(new File(args[0])));
+ }
+ catch (IOException e) {
+ throw new RuntimeException("Cannot read file specified in option -overview: " + e.getMessage());
+ }
+ }
+ });
+ options.put("-classpath", new OptionProcessor(2)
+ {
+ void process(String[] args)
+ {
+ reporter.printWarning("-classpath option could not be passed to the VM. Faking it with ");
+ reporter.printWarning(" System.setProperty(\"java.class.path\", \"" + args[0] + "\");");
+ System.setProperty("java.class.path", args[0]);
+ }
+ });
+ options.put("--version", new OptionProcessor(1)
+ {
+ void process(String[] args)
+ {
+ option_showVersion = true;
+ }
+ });
+ options.put("-bootclasspath", new OptionProcessor(1)
+ {
+ void process(String[] args)
+ {
+ option_bootclasspath_specified = true;
+ }
+ });
+ options.put("-all", new OptionProcessor(1)
+ {
+ void process(String[] args)
+ {
+ option_all = true;
+ }
+ });
+ options.put("-reflection", new OptionProcessor(1)
+ {
+ void process(String[] args)
+ {
+ option_reflection = true;
+ }
+ });
+ }
+
+ /**
+ * Determine how many arguments the given option requires.
+ *
+ * @param option
+ * The name of the option without leading dash.
+ */
+ private static int optionLength(String option)
+ {
+
+ OptionProcessor op = (OptionProcessor) options.get(option.toLowerCase());
+ if (op != null)
+ return op.argCount;
+ else
+ return 0;
+ }
+
+ /**
+ * Process all given options. Assumes that the options have been validated
+ * before.
+ *
+ * @param optionArr
+ * Each element is a series of Strings where [0] is the name of the
+ * option and [1..n] are the arguments to the option.
+ */
+ private void readOptions(String[][] optionArr)
+ {
+
+ //--- For each option, find the appropriate OptionProcessor
+ // and call its process() method
+
+ for (int i = 0; i < optionArr.length; ++i)
+ {
+ String[] opt = optionArr[i];
+ String[] args = new String[opt.length - 1];
+ System.arraycopy(opt, 1, args, 0, opt.length - 1);
+ OptionProcessor op = (OptionProcessor) options.get(opt[0].toLowerCase());
+ op.process(args);
+ }
+ }
+
+ /**
+ * Print command line usage.
+ */
+ private static void usage()
+ {
+ System.out
+ .print("\n"
+ + "USAGE: gjdoc [options] [packagenames] "
+ + "[sourcefiles] [@files]\n\n"
+ + " --version Show version information and exit\n"
+ + " -all Process all source files found in the source path\n"
+ + " -overview <file> Read overview documentation from HTML file\n"
+ + " -public Include only public classes and members\n"
+ + " -protected Include protected and public classes and members\n"
+ + " This is the default\n"
+ + " -package Include package/protected/public classes and members\n"
+ + " -private Include all classes and members\n"
+ + " -help, --help Show this information\n"
+ + " -doclet <class> Doclet class to use for generating output\n"
+ + " -docletpath <classpath> Specifies the search path for the doclet and\n"
+ + " dependencies\n"
+ + " -source <release> Provide source compatibility with specified\n"
+ + " release (1.4 to handle assertion)\n"
+ + " -sourcepath <pathlist> Where to look for source files\n"
+ + " -s <pathlist> Alias for -sourcepath\n"
+ + " -subpackages <spkglist> List of subpackages to recursively load\n"
+ + " -exclude <pkglist> List of packages to exclude\n"
+ + " -verbose Output messages about what Gjdoc is doing [ignored]\n"
+ + " -quiet Do not print non-error and non-warning messages\n"
+ + " -locale <name> Locale to be used, e.g. en_US or en_US_WIN\n"
+ + " -encoding <name> Source file encoding name\n"
+ + " -breakiterator Compute first sentence with BreakIterator\n"
+ + " -classpath <pathlist> Set the path used for loading auxilliary classes\n"
+ + "\n"
+ + "Standard doclet options:\n"
+ + " -d Set target directory\n"
+ + " -use Includes the 'Use' page for each documented class\n"
+ + " and package\n"
+ + " -version Includes the '@version' tag\n"
+ + " -author Includes the '@author' tag\n"
+ + " -splitindex Splits the index file into multiple files\n"
+ + " -windowtitle <text> Browser window title\n"
+ + " -doctitle <text> Title near the top of the overview summary file\n"
+ + " (HTML allowed)\n"
+ + " -title <text> Title for this set of API documentation\n"
+ + " (deprecated, -doctitle should be used instead)\n"
+ + " -header <text> Text to include in the top navigation bar\n"
+ + " (HTML allowed)\n"
+ + " -footer <text> Text to include in the bottom navigation bar\n"
+ + " (HTML allowed)\n"
+ + " -bottom <text> Text to include at the bottom of each output file\n"
+ + " (HTML allowed)\n"
+ + " -link <extdoc URL> Link to external generated documentation at URL\n"
+ + " -linkoffline <extdoc URL> <packagelistLoc>\n"
+ + " Link to external generated documentation for\n"
+ + " the specified package-list\n"
+ + " -linksource Creates an HTML version of each source file\n"
+ + " -group <groupheading> <packagepattern:packagepattern:...>\n"
+ + " Separates packages on the overview page into groups\n"
+ + " -nodeprecated Prevents the generation of any deprecated API\n"
+ + " -nodeprecatedlist Prevents the generation of the file containing\n"
+ + " the list of deprecated APIs and the link to the\n"
+ + " navigation bar to that page\n"
+ + " -nosince Omit the '@since' tag\n"
+ + " -notree Do not generate the class/interface hierarchy page\n"
+ + " -noindex Do not generate the index file\n"
+ + " -nohelp Do not generate the help link\n"
+ + " -nonavbar Do not generate the navbar, header and footer\n"
+ + " -helpfile <filen> Path to an alternate help file\n"
+ + " -stylesheetfile <file> Path to an alternate CSS stylesheet\n"
+ + " -addstylesheet <file> Path to an additional CSS stylesheet\n"
+ + " -serialwarn Complain about missing '@serial' tags [ignored]\n"
+ + " -charset <IANACharset> Specifies the HTML charset\n"
+ + " -docencoding <IANACharset>\n"
+ + " Specifies the encoding of the generated HTML files\n"
+ + " -tag <tagname>:Xaoptcmf:\"<taghead>\"\n"
+ + " Enables gjdoc to interpret a custom tag\n"
+ + " -taglet Adds a Taglet class to the map of taglets\n"
+ + " -tagletpath Sets the CLASSPATH to load subsequent Taglets from\n"
+ + " -docfilessubdirs Enables deep copy of 'doc-files' directories\n"
+ + " -excludedocfilessubdir <name1:name2:...>\n"
+ + " Excludes 'doc-files' subdirectories with a give name\n"
+ + " -noqualifier all|<packagename1:packagename2:...>\n"
+ + " Do never fully qualify given package names\n"
+ + " -nocomment Suppress the entire comment body including the main\n"
+ + " description and all tags, only generate declarations\n"
+ + "\n"
+ + "Gjdoc extension options:\n"
+ + " -reflection Use reflection for resolving unqualified class names\n"
+ + " -licensetext Include license text from source files\n"
+ + " -validhtml Use valid HTML/XML names (breaks compatibility)\n"
+ + " -baseurl <url> Hardwire the given base URL into generated pages\n"
+ /**
+ + " -genhtml Generate HTML code instead of XML code. This is the\n"
+ + " default.\n"
+ + " -geninfo Generate Info code instead of XML code.\n"
+ + " -xslsheet <file> If specified, XML files will be written to a\n"
+ + " temporary directory and transformed using the\n"
+ + " given XSL sheet. The result of the transformation\n"
+ + " is written to the output directory. Not required if\n"
+ + " -genhtml or -geninfo has been specified.\n"
+ + " -xmlonly Generate XML code only, do not generate HTML code.\n"
+ + " -bottomnote HTML code to include at the bottom of each page.\n"
+ + " -nofixhtml If not specified, heurestics will be applied to\n"
+ + " fix broken HTML code in comments.\n"
+ + " -nohtmlwarn Do not emit warnings when encountering broken HTML\n"
+ + " code.\n"
+ + " -noemailwarn Do not emit warnings when encountering strings like\n"
+ + " <abc@foo.com>.\n"
+ + " -indentstep <n> How many spaces to indent each tag level in\n"
+ + " generated XML code.\n"
+ + " -xsltdriver <class> Specifies the XSLT driver to use for transformation.\n"
+ + " By default, xsltproc is used.\n"
+ + " -postprocess <class> XmlDoclet postprocessor class to apply after XSL\n"
+ + " transformation.\n"
+ + " -compress Generated info pages will be Zip-compressed.\n"
+ + " -workpath Specify a temporary directory to use.\n"
+ + " -authormail <type> Specify handling of mail addresses in @author tags.\n"
+ + " no-replace do not replace mail addresses (default).\n"
+ + " mailto-name replace by <a>Real Name</a>.\n"
+ + " name-mailto-address replace by Real Name (<a>abc@foo.com</a>).\n"
+ + " name-mangled-address replace by Real Name (<a>abc AT foo DOT com</a>).\n"
+ **/
+ );
+ }
+
+ /**
+ * The root of the gjdoc tool.
+ *
+ * @return all the options of the gjdoc application.
+ */
+ public static RootDocImpl getRootDoc()
+ {
+ return rootDoc;
+ }
+
+ /**
+ * Get the gjdoc singleton.
+ *
+ * @return the gjdoc instance.
+ */
+ public static Main getInstance()
+ {
+ return instance;
+ }
+
+ /**
+ * Is this access level covered?
+ *
+ * @param accessLevel
+ * the access level we want to know if it is covered.
+ * @return true if the access level is covered.
+ */
+ public boolean includeAccessLevel(int accessLevel)
+ {
+ return coverageTemplates[option_coverage][accessLevel];
+ }
+
+ /**
+ * Is the doclet running?
+ *
+ * @return true if it's running
+ */
+ public boolean isDocletRunning()
+ {
+ return docletRunning;
+ }
+
+ /**
+ * Check the charset. Check that all the characters of the string 'toCheck'
+ * and query if they exist in the 'charSet'. The order does not matter. The
+ * number of times a character is in the variable does not matter.
+ *
+ * @param toCheck
+ * the charset to check.
+ * @param charSet
+ * the reference charset
+ * @return true if they match.
+ */
+ public static boolean checkCharSet(String toCheck, String charSet)
+ {
+ for (int i = 0; i < toCheck.length(); ++i)
+ {
+ if (charSet.indexOf(toCheck.charAt(i)) < 0)
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Makes the RootDoc eligible for the GC.
+ */
+ public static void releaseRootDoc()
+ {
+ rootDoc.flush();
+ }
+
+ /**
+ * Return whether the -breakiterator option has been specified.
+ */
+ public boolean isUseBreakIterator()
+ {
+ return this.option_breakiterator
+ || !getLocale().getLanguage().equals(Locale.ENGLISH.getLanguage());
+ }
+
+ /**
+ * Return whether boilerplate license text should be copied.
+ */
+ public boolean isCopyLicenseText()
+ {
+ return this.option_licensetext;
+ }
+
+ /**
+ * Return the locale specified using the -locale option or the
+ * default locale;
+ */
+ public Locale getLocale()
+ {
+ return this.option_locale;
+ }
+
+ /**
+ * Return the collator to use based on the specified -locale
+ * option. If no collator can be found for the given locale, a
+ * warning is emitted and the default collator is used instead.
+ */
+ public Collator getCollator()
+ {
+ if (null == this.collator) {
+ Locale locale = getLocale();
+ this.collator = Collator.getInstance(locale);
+ Locale defaultLocale = Locale.getDefault();
+ if (null == this.collator
+ && !defaultLocale.equals(locale)) {
+ this.collator = Collator.getInstance(defaultLocale);
+ if (null != this.collator) {
+ reporter.printWarning("No collator found for locale "
+ + locale.getDisplayName()
+ + "; using collator for default locale "
+ + defaultLocale.getDisplayName()
+ + ".");
+ }
+ else {
+ this.collator = Collator.getInstance();
+ reporter.printWarning("No collator found for specified locale "
+ + locale.getDisplayName()
+ + " or default locale "
+ + defaultLocale.getDisplayName()
+ + ": using default collator.");
+ }
+ }
+ if (null == this.collator) {
+ this.collator = Collator.getInstance();
+ reporter.printWarning("No collator found for locale "
+ + locale.getDisplayName()
+ + ": using default collator.");
+ }
+ }
+ return this.collator;
+ }
+
+ public boolean isCacheRawComments()
+ {
+ return true;
+ }
+
+ public String getGjdocVersion()
+ {
+ if (null == gjdocVersion) {
+ try {
+ Properties versionProperties = new Properties();
+ versionProperties.load(getClass().getResourceAsStream("/version.properties"));
+ gjdocVersion = versionProperties.getProperty("gjdoc.version");
+ }
+ catch (IOException ignore) {
+ }
+ if (null == gjdocVersion) {
+ gjdocVersion = "unknown";
+ }
+ }
+ return gjdocVersion;
+ }
+
+ public boolean isReflectionEnabled()
+ {
+ return this.option_reflection;
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/MemberDocImpl.java b/tools/gnu/classpath/tools/gjdoc/MemberDocImpl.java
new file mode 100644
index 000000000..aae2462bb
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/MemberDocImpl.java
@@ -0,0 +1,218 @@
+/* gnu.classpath.tools.gjdoc.MemberDocImpl
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import java.util.*;
+import com.sun.javadoc.*;
+
+public abstract class MemberDocImpl extends ProgramElementDocImpl implements MemberDoc {
+
+ protected String typeName;
+ protected Type type;
+
+ public MemberDocImpl(ClassDoc containingClass,
+ PackageDoc containingPackage,
+ SourcePosition position) {
+
+ super(containingClass,
+ containingPackage,
+ position);
+ }
+
+ public String qualifiedName() {
+ return containingClass().qualifiedName()+"."+name();
+ }
+
+ public boolean isSynthetic() {
+ return false;
+ }
+
+ int parseModifiers(char[] source, int startIndex, int endIndex) {
+
+ Debug.log(9,"parseModifiers '"+new String(source,startIndex,endIndex-startIndex)+"'");
+
+ final int STATE_NORMAL = 1;
+ final int STATE_STARC = 2;
+ final int STATE_SLASHC = 3;
+
+ int state = STATE_NORMAL;
+
+ StringBuffer word = new StringBuffer();
+ StringBuffer typeNameBuf = new StringBuffer();
+ int lastWordStart = startIndex;
+ int firstChar = 0;
+ int lastChar = 0;
+ for (; startIndex<endIndex; ++startIndex) {
+ if (state==STATE_STARC) {
+ if (startIndex<endIndex-1 && source[startIndex]=='*' && source[startIndex+1]=='/') {
+ ++startIndex;
+ state=STATE_NORMAL;
+ }
+ }
+ else if (state==STATE_SLASHC) {
+ if (source[startIndex]=='\n') {
+ state=STATE_NORMAL;
+ }
+ }
+ else if (startIndex<endIndex-1 && source[startIndex]=='/' && source[startIndex+1]=='*') {
+ ++startIndex;
+ state=STATE_STARC;
+ }
+ else if (source[startIndex]=='=' || source[startIndex]=='(' || source[startIndex]==';') {
+ typeName = typeNameBuf.toString();
+ return lastWordStart;
+ }
+ else if (Parser.WHITESPACE.indexOf(source[startIndex])>=0
+ || (startIndex > 0 && source[startIndex-1] == ']' && source[startIndex] != '[')) {
+ if (word.length()>0 && lastChar != '.') {
+ if (processModifier(word.toString())) {
+ }
+ else if (typeNameBuf.length()==0 && !isConstructor()) {
+ typeNameBuf.setLength(0);
+ typeNameBuf.append(word);
+ }
+ else if ((firstChar=='[' || firstChar==']') && !isConstructor()) {
+ typeNameBuf.append(word);
+ }
+ else {
+ typeName = typeNameBuf.toString();
+ return lastWordStart;
+ }
+ word.setLength(0);
+ lastWordStart=startIndex;
+ }
+ }
+ else {
+ if (lastWordStart<0) lastWordStart=startIndex;
+ lastChar = source[startIndex];
+ if (0 == word.length()) {
+ firstChar = lastChar;
+ }
+ word.append((char)lastChar);
+ }
+ }
+
+ typeName = typeNameBuf.toString();
+ return startIndex;
+ }
+
+ public Type type() {
+ //public Type type() throws ParseException {
+ Debug.log(9,"type() called on "+containingClass()+"."+this);
+ if (type==null) {
+ try {
+ type=((ClassDocImpl)containingClass()).typeForString(typeName);
+ } catch (ParseException e) {
+ System.err.println("FIXME: add try-catch to force compilation");
+ e.printStackTrace();
+ }
+ }
+ return type;
+ }
+
+
+ protected void setName(String name) {
+ this.name=name;
+ }
+ private String name;
+
+
+ public String name() {
+ return name;
+ }
+
+ public void setTypeName(String typeName) {
+ this.typeName=typeName;
+ this.type=null;
+ }
+
+ public String getTypeName() {
+ return typeName;
+ }
+
+ // return true if this Doc is include in the active set.
+ public boolean isIncluded() {
+ return Main.getInstance().includeAccessLevel(accessLevel);
+ }
+
+ public int compareTo(Object o) {
+ if (o instanceof MemberDocImpl) {
+ int rc=name().compareTo(((MemberDocImpl)o).name());
+ if (rc==0)
+ rc=containingClass().qualifiedName().compareTo(((MemberDocImpl)o).containingClass().qualifiedName());
+ return rc;
+ }
+ else {
+ return super.compareTo(o);
+ }
+ }
+
+ void resolve() {
+
+ if (type==null && typeName!=null) {
+ Debug.log(1, "MemberDocImpl.resolve(), looking up type named "+typeName);
+ try {
+ type=((ClassDocImpl)containingClass()).typeForString(typeName);
+ } catch (ParseException e) {
+ //System.err.println("FIXME: add try-catch to force compilation");
+ //e.printStackTrace();
+ Debug.log(1, "INTERNAL WARNING: Couldn't find type for name '"+typeName+"'");
+ }
+ }
+
+ if (type instanceof ClassDocProxy) {
+ String className=type.qualifiedTypeName();
+ ClassDoc realClassDoc=((ClassDocImpl)containingClass()).findClass(className, type.dimension());
+ if (realClassDoc!=null) {
+ type=realClassDoc;
+ }
+ else {
+ //throw new Error("Class not found: "+className);
+ /*** This is not an error, the class was not included
+ * on the command line. Perhaps emit a notice here.
+ *
+
+ Main.getRootDoc().printError("Class not found '"
+ + className
+ + "' in class '"
+ + containingClass().qualifiedName()
+ + "' member '"
+ + name()
+ + "'");
+ */
+ }
+ }
+ }
+
+ public void resolveComments()
+ {
+ super.resolveComments();
+
+ if (tagMap.isEmpty()) {
+ TagContainer inheritedTagMap = ClassDocImpl.findInheritedDoc(containingClass(),
+ this,
+ null);
+ if (null != inheritedTagMap) {
+ this.tagMap = inheritedTagMap.getTagMap();
+ }
+ }
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/MethodDocImpl.java b/tools/gnu/classpath/tools/gjdoc/MethodDocImpl.java
new file mode 100644
index 000000000..8654a2249
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/MethodDocImpl.java
@@ -0,0 +1,47 @@
+/* gnu.classpath.tools.gjdoc.MethodDocImpl
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import java.util.*;
+import com.sun.javadoc.*;
+
+public class MethodDocImpl extends ExecutableMemberDocImpl implements MethodDoc {
+
+ public MethodDocImpl(ClassDoc containingClass,
+ PackageDoc containingPackage,
+ SourcePosition position) {
+
+ super(containingClass,
+ containingPackage,
+ position);
+ }
+
+ // Is this Doc item a class.
+ public boolean isMethod() {
+ return true;
+ }
+
+ public Type returnType() {
+ return super.type();
+ }
+
+ public String toString() { return name()+((signature()==null)?"()":signature()); }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/PackageDocImpl.java b/tools/gnu/classpath/tools/gjdoc/PackageDocImpl.java
new file mode 100644
index 000000000..d0b28d627
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/PackageDocImpl.java
@@ -0,0 +1,206 @@
+/* gnu.classpath.tools.gjdoc.PackageDocImpl
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import com.sun.javadoc.*;
+import java.util.*;
+import java.io.File;
+
+class PackageDocImpl extends DocImpl implements GjdocPackageDoc {
+
+ private String packageName;
+ private File packageDirectory;
+
+ private Set allClassesSet = new TreeSet();
+ private List ordinaryClassesList = new ArrayList();
+ private List exceptionsList = new ArrayList();
+ private List interfacesList = new ArrayList();
+ private List errorsList = new ArrayList();
+
+ private ClassDoc[] allClasses;
+ private ClassDoc[] ordinaryClasses;
+ private ClassDoc[] exceptions;
+ private ClassDoc[] interfaces;
+ private ClassDoc[] errors;
+
+ PackageDocImpl(String packageName) {
+ super(null);
+ this.packageName=packageName;
+ }
+
+ public void addClass(ClassDoc classDoc) {
+ if (Main.getInstance().includeAccessLevel(((ClassDocImpl)classDoc).accessLevel)) {
+ allClassesSet.add(classDoc);
+ }
+ }
+
+ public void resolve() {
+ for (Iterator it=allClassesSet.iterator(); it.hasNext(); ) {
+ ClassDocImpl classDoc=(ClassDocImpl)it.next();
+ try {
+ classDoc.resolve();
+ } catch (ParseException e) {
+ System.err.println("FIXME: add try-catch to force compilation"
+ + e);
+ }
+
+ if (classDoc.isInterface()) {
+ interfacesList.add(classDoc);
+ }
+ else if (classDoc.isException()) {
+ exceptionsList.add(classDoc);
+ }
+ else if (classDoc.isError()) {
+ errorsList.add(classDoc);
+ }
+ else {
+ ordinaryClassesList.add(classDoc);
+ }
+ }
+ }
+
+ public void resolveComments() {
+ if (rawDocumentation!=null) {
+ this.tagMap=parseCommentTags(rawDocumentation.toCharArray(),
+ 0,
+ rawDocumentation.length(),
+ null,
+ null,
+ null,
+ null);
+ }
+
+ resolveTags();
+ }
+
+ public String name() {
+ return packageName;
+ }
+
+ public ClassDoc[] allClasses()
+ {
+ if (null == this.allClasses) {
+ this.allClasses = toClassDocArray(allClassesSet);
+ }
+ return this.allClasses;
+ }
+
+ public ClassDoc[] ordinaryClasses()
+ {
+ if (null == this.ordinaryClasses) {
+ this.ordinaryClasses = toClassDocArray(ordinaryClassesList);
+ }
+ return this.ordinaryClasses;
+ }
+
+
+ public ClassDoc[] exceptions()
+ {
+ if (null == this.exceptions) {
+ this.exceptions = toClassDocArray(exceptionsList);
+ }
+ return this.exceptions;
+ }
+
+ public ClassDoc[] interfaces()
+ {
+ if (null == this.interfaces) {
+ this.interfaces = toClassDocArray(interfacesList);
+ }
+ return this.interfaces;
+ }
+
+ public ClassDoc[] errors()
+ {
+ if (null == this.errors) {
+ this.errors = toClassDocArray(errorsList);
+ }
+ return this.errors;
+ }
+
+ private ClassDoc[] toClassDocArray(Collection classDocList)
+ {
+ ClassDoc[] result = (ClassDoc[])classDocList.toArray(new ClassDoc[classDocList.size()]);
+ Arrays.sort(result);
+ return result;
+ }
+
+ public ClassDoc findClass(String name) {
+ return Main.getRootDoc().classNamed(packageName+"."+name);
+ }
+
+ public void dump(int level) {
+ Debug.log(level, "All classes:");
+ Debug.dumpArray(level, allClasses());
+
+ Debug.log(level, "Ordinary classes:");
+ Debug.dumpArray(level, ordinaryClasses());
+
+ }
+
+ public static final PackageDocImpl DEFAULT_PACKAGE = new PackageDocImpl("");
+
+ public boolean isPackage() {
+ return true;
+ }
+
+ public boolean isIncluded() {
+ return isIncluded;
+ }
+
+ void setIsIncluded(boolean b) {
+ this.isIncluded=b;
+ }
+
+ private boolean isIncluded = false;
+
+ public String toString() {
+ return packageName;
+ }
+
+ public int compareTo(Object o) {
+ if (o!=null && o instanceof PackageDocImpl)
+ return name().compareTo(((PackageDocImpl)o).name());
+ else
+ return 0;
+ }
+
+ public boolean equals(Object o) {
+ if (o!=null && o instanceof PackageDocImpl)
+ return name().equals(((PackageDocImpl)o).name());
+ else
+ return false;
+ }
+
+ /**
+ * Sets the directory containing this package's source files.
+ */
+ public void setPackageDirectory(File packageDirectory) {
+ this.packageDirectory = packageDirectory;
+ }
+
+ /**
+ * Gets the directory containing this package's source files.
+ */
+ public File packageDirectory() {
+ return this.packageDirectory;
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/ParamTagImpl.java b/tools/gnu/classpath/tools/gjdoc/ParamTagImpl.java
new file mode 100644
index 000000000..2d9567e66
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/ParamTagImpl.java
@@ -0,0 +1,64 @@
+/* gnu.classpath.tools.gjdoc.ParamTagImpl
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import com.sun.javadoc.*;
+import java.util.*;
+import java.text.*;
+
+public class ParamTagImpl extends AbstractTagImpl implements ParamTag {
+
+ private String parameterName;
+ private String parameterComment;
+
+ public ParamTagImpl(String text,
+ ClassDocImpl contextClass,
+ MemberDocImpl contextMember) {
+ super(text);
+ char[] textarr=text.toCharArray();
+ int i=0;
+ for (; i<textarr.length; ++i) {
+ if (!Parser.isWhitespace(textarr[i])) break;
+ }
+ for (; i<textarr.length; ++i) {
+ if (Parser.isWhitespace(textarr[i])) {
+ parameterName=new String(textarr,0,i).trim();
+ parameterComment=new String(textarr,i,textarr.length-i).trim();
+ break;
+ }
+ }
+ if (parameterComment!=null) {
+ setBody(parameterComment, contextClass, contextMember);
+ }
+ }
+
+ public String parameterComment() {
+ return parameterComment;
+ }
+
+ public String parameterName() {
+ return parameterName;
+ }
+
+ public String kind() {
+ return "@param";
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/ParameterImpl.java b/tools/gnu/classpath/tools/gjdoc/ParameterImpl.java
new file mode 100644
index 000000000..9132270bc
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/ParameterImpl.java
@@ -0,0 +1,52 @@
+/* gnu.classpath.tools.gjdoc.ParameterImpl
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import com.sun.javadoc.*;
+
+public class ParameterImpl implements Parameter {
+
+ String name;
+ String typeName;
+ Type type;
+
+ ParameterImpl(String name, String typeName, Type type) {
+
+ this.name=name;
+ this.typeName=typeName;
+ this.type=type;
+ }
+
+ public void resolve(ClassDoc classContext) {
+ if (type instanceof ClassDocProxy) {
+ String className=type.qualifiedTypeName();
+ ClassDoc realClassDoc=((ClassDocImpl)classContext).findClass(className, type.dimension());
+ if (realClassDoc!=null) {
+ type=realClassDoc;
+ }
+ }
+ }
+
+ public String name() { return name; }
+ public String typeName() { return typeName; }
+ public Type type() { return type; }
+ public String toString() { return typeName+" "+name; }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/ParseException.java b/tools/gnu/classpath/tools/gjdoc/ParseException.java
new file mode 100644
index 000000000..4984ead85
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/ParseException.java
@@ -0,0 +1,35 @@
+/* gnu.classpath.tools.gjdoc.ParseException
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+class ParseException extends Exception {
+
+ public ParseException()
+ {
+ }
+
+ public ParseException(String msg)
+ {
+ super(msg);
+ }
+
+}
+
diff --git a/tools/gnu/classpath/tools/gjdoc/Parser.java b/tools/gnu/classpath/tools/gjdoc/Parser.java
new file mode 100644
index 000000000..5569d4b01
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/Parser.java
@@ -0,0 +1,1047 @@
+/* gnu.classpath.tools.gjdoc.Parser
+ Copyright (C) 2001, 2005, 2008 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import java.io.*;
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CoderResult;
+import java.nio.charset.CodingErrorAction;
+import java.util.*;
+
+import com.sun.javadoc.*;
+
+import gnu.classpath.tools.IOToolkit;
+import gnu.classpath.tools.NotifyingInputStreamReader;
+import gnu.classpath.tools.MalformedInputListener;
+import gnu.classpath.tools.MalformedInputEvent;
+
+ class IgnoredFileParseException extends ParseException
+ {
+ // marker exception
+ }
+
+ abstract class SourceComponent {
+
+ abstract int match(char[] source, int index) throws ParseException;
+
+ int process(Parser parser, char[] source, int startIndex, int endIndex) throws ParseException, IOException {
+ return endIndex;
+ }
+
+ int getEndIndex(char[] source, int endIndex) throws ParseException {
+ return endIndex;
+ }
+ }
+
+ abstract class BlockSourceComponent extends SourceComponent {
+
+ int getEndIndex(char[] source, int endIndex) throws ParseException {
+ return Parser.skipExpression(source, endIndex, 1, '\0');
+ }
+
+ }
+
+ class Whitespace extends SourceComponent {
+
+ int match(char[] source, int index) {
+
+ int rc=index;
+ int slen=source.length;
+ while (rc<slen && Parser.WHITESPACE.indexOf(source[rc])>=0) ++rc;
+
+ return (rc!=index) ? rc : -1;
+ }
+ }
+
+ class BracketClose extends SourceComponent {
+
+ int match(char[] source, int index) {
+ if (source[index]=='}') {
+ return index+1;
+ }
+ else {
+ return -1;
+ }
+ }
+
+ int process(Parser parser, char[] source, int startIndex, int endIndex)
+ throws ParseException, IOException
+ {
+ parser.classClosed();
+ return endIndex;
+ }
+ }
+
+ class CommentComponent extends SourceComponent {
+
+ int match(char[] source, int index) throws ParseException {
+ if (index+1<source.length && source[index]=='/' && source[index+1]=='*') {
+ for (index+=2; index+1<source.length; ++index) {
+ if (source[index]=='*' && source[index+1]=='/')
+ return index+2;
+ }
+ throw new ParseException("unexpected end of input");
+ }
+ return -1;
+ }
+
+ int process(Parser parser, char[] source, int startIndex, int endIndex) {
+
+ if (source[startIndex+0]=='/'
+ && source[startIndex+1]=='*'
+ && source[startIndex+2]=='*') {
+
+ parser.setLastComment(new String(source, startIndex, endIndex-startIndex));
+ }
+ else if (null == parser.getBoilerplateComment() && Main.getInstance().isCopyLicenseText()) {
+ String boilerplateComment = new String(source, startIndex + 2, endIndex-startIndex - 4);
+ if (boilerplateComment.toLowerCase().indexOf("copyright") >= 0) {
+ parser.setBoilerplateComment(boilerplateComment);
+ }
+ }
+
+ return endIndex;
+ }
+ }
+
+ class SlashSlashCommentComponent extends SourceComponent {
+
+ int match(char[] source, int index) {
+ if (index+1<source.length && source[index]=='/' && source[index+1]=='/') {
+ index+=2;
+ while (index<source.length && source[index]!='\n')
+ ++index;
+ return index;
+ }
+ else {
+ return -1;
+ }
+ }
+ }
+
+ class EmptyStatementComponent extends SourceComponent {
+
+ int match(char[] source, int index) {
+ while (index < source.length
+ && Parser.isWhitespace(source[index])) {
+ ++ index;
+ }
+ if (index < source.length && source[index] == ';') {
+ return index+1;
+ }
+ else {
+ return -1;
+ }
+ }
+ }
+
+ class ImportComponent extends SourceComponent {
+
+ int match(char[] source, int index) {
+ if (index+7<source.length) {
+ if (source[index+0]=='i'
+ && source[index+1]=='m'
+ && source[index+2]=='p'
+ && source[index+3]=='o'
+ && source[index+4]=='r'
+ && source[index+5]=='t'
+ && Parser.WHITESPACE.indexOf(source[index+6])>=0) {
+
+ for (index+=7; index<source.length && source[index]!=';'; ++index)
+ ;
+
+ return index+1;
+ }
+ }
+ return -1;
+ }
+
+ int process(Parser parser, char[] source, int startIndex, int endIndex) throws ParseException, IOException {
+ String importString=new String(source,startIndex+7,endIndex-startIndex-7-1).trim();
+ parser.importEncountered(importString);
+ return endIndex;
+ }
+ }
+
+ class PackageComponent extends SourceComponent {
+
+ int match(char[] source, int index) {
+ if (index+10<source.length) {
+ if (source[index+0]=='p'
+ && source[index+1]=='a'
+ && source[index+2]=='c'
+ && source[index+3]=='k'
+ && source[index+4]=='a'
+ && source[index+5]=='g'
+ && source[index+6]=='e'
+ && Parser.WHITESPACE.indexOf(source[index+7])>=0) {
+
+ for (index+=7; index<source.length && source[index]!=';'; ++index)
+ ;
+
+ return index+1;
+ }
+ }
+ return -1;
+ }
+
+ int process(Parser parser, char[] source, int startIndex, int endIndex) {
+ String packageName=new String(source,startIndex+8,endIndex-startIndex-8-1).trim();
+ parser.packageOpened(packageName);
+ return endIndex;
+ }
+ }
+
+ class FieldComponent extends SourceComponent {
+
+ int match(char[] source, int index) throws ParseException {
+ boolean isField=false;
+ final int STATE_NORMAL=1;
+ final int STATE_SLASHC=2;
+ final int STATE_STARC=3;
+ final int STATE_FIELDVAL=4;
+ final int STATE_STRING=5;
+ final int STATE_SINGLEQUOTED=6;
+ final int STATE_STRING_BS=7;
+ final int STATE_SINGLEQUOTED_BS=8;
+
+ int state=STATE_NORMAL;
+ int prevState=STATE_NORMAL;
+
+ int fieldValueLevel = 0;
+
+ for (; index<source.length && !isField; ++index) {
+ if (state==STATE_STARC) {
+ if (index<source.length-1 && source[index]=='*' && source[index+1]=='/') {
+ ++index;
+ state=prevState;
+ }
+ }
+ else if (state==STATE_SLASHC) {
+ if (source[index]=='\n') {
+ state=prevState;
+ }
+ }
+ else if (state==STATE_STRING) {
+ if (source[index]=='\\') {
+ state=STATE_STRING_BS;
+ }
+ else if (source[index]=='\"') {
+ state=prevState;
+ }
+ }
+ else if (state==STATE_STRING_BS) {
+ state=STATE_STRING;
+ }
+ else if (state==STATE_SINGLEQUOTED) {
+ if (source[index]=='\\') {
+ state=STATE_SINGLEQUOTED_BS;
+ }
+ else if (source[index]=='\'') {
+ state=prevState;
+ }
+ }
+ else if (state==STATE_SINGLEQUOTED_BS) {
+ state=STATE_SINGLEQUOTED;
+ }
+ else if (state==STATE_FIELDVAL) {
+ if (source[index]=='/') {
+ if (index<source.length-1 && source[index+1]=='*') {
+ state=STATE_STARC;
+ ++index;
+ }
+ else if (index<source.length-1 && source[index+1]=='/') {
+ state=STATE_SLASHC;
+ ++index;
+ }
+ }
+ else if (source[index]=='{') {
+ ++ fieldValueLevel;
+ }
+ else if (source[index]=='}') {
+ -- fieldValueLevel;
+ }
+ else if (source[index]=='\"') {
+ state=STATE_STRING;
+ }
+ else if (source[index]=='\'') {
+ state=STATE_SINGLEQUOTED;
+ }
+ else if (source[index]==';' && 0 == fieldValueLevel) {
+ isField=true;
+ break;
+ }
+ }
+ else switch (source[index]) {
+ case '/':
+ if (index<source.length-1 && source[index+1]=='*') {
+ state=STATE_STARC;
+ ++index;
+ }
+ else if (index<source.length-1 && source[index+1]=='/') {
+ state=STATE_SLASHC;
+ ++index;
+ }
+ break;
+ case '{': // class
+ case '(': // method
+ return -1;
+ case '=': // field
+ state=STATE_FIELDVAL;
+ prevState=state;
+ continue;
+ case ';': // field
+ isField=true;
+ break;
+ }
+ if (isField) break;
+ }
+ if (!isField || index==source.length) {
+ return -1;
+ }
+
+ //System.err.println("char is "+source[index]);
+
+ if (source[index]!=';') {
+ index=Parser.skipExpression(source, index, 0, ';');
+ }
+ return index+1;
+ }
+
+ int process(Parser parser, char[] source, int startIndex, int endIndex) {
+
+ //Debug.log(9,"found package statement: \""+str+"\"");
+ //Debug.log(9,"found function component: '"+str+"'");
+ //xxx(new FieldDocImpl(ctx.classDoc, ctx.classDoc.containingPackage(), 0, false, false));
+
+ // Ignore superfluous semicoli after class definition
+ if (endIndex-startIndex<=1) return endIndex;
+
+ //assert (parser.ctx!=null);
+ Collection fields=FieldDocImpl.createFromSource(parser.ctx.classDoc,
+ parser.ctx.classDoc.containingPackage(),
+ source, startIndex, endIndex);
+
+ for (Iterator it=fields.iterator(); it.hasNext(); ) {
+ FieldDocImpl field=(FieldDocImpl)it.next();
+ boolean fieldHasSerialTag=!field.isTransient() && !field.isStatic(); //field.hasSerialTag();
+ if ((field.isIncluded() || fieldHasSerialTag) && parser.getAddComments()) {
+ field.setRawCommentText(parser.getLastComment());
+ }
+ parser.ctx.fieldList.add(field);
+ if (field.isIncluded()) {
+ parser.ctx.filteredFieldList.add(field);
+ }
+ if (fieldHasSerialTag) {
+ parser.ctx.sfieldList.add(field);
+ }
+ }
+
+ parser.setLastComment(null);
+ return endIndex;
+ }
+
+
+ }
+
+ class FunctionComponent extends BlockSourceComponent {
+
+ int getEndIndex(char[] source, int endIndex) throws ParseException {
+ if (source[endIndex-1]==';') {
+ return endIndex;
+ }
+ else {
+ return super.getEndIndex(source, endIndex);
+ }
+ }
+
+ int process(Parser parser, char[] source, int startIndex, int endIndex) throws IOException, ParseException {
+
+ //ctx.fieldList.add(FieldDocImpl.createFromSource(source, startIndex, endIndex));
+
+ //System.out.println("function match '"+new String(source,startIndex,endIndex-startIndex)+"'");
+ ExecutableMemberDocImpl execDoc=MethodDocImpl.createFromSource(parser.ctx.classDoc,
+ parser.ctx.classDoc.containingPackage(),
+ source, startIndex, endIndex);
+
+ if (parser.getAddComments())
+ execDoc.setRawCommentText(parser.getLastComment());
+
+ parser.setLastComment(null);
+
+ if (execDoc.isMethod()) {
+ parser.ctx.methodList.add(execDoc);
+ if (execDoc.isIncluded()) {
+ parser.ctx.filteredMethodList.add(execDoc);
+ }
+ }
+ else {
+ parser.ctx.constructorList.add(execDoc);
+ if (execDoc.isIncluded()) {
+ parser.ctx.filteredConstructorList.add(execDoc);
+ }
+ }
+
+ if (execDoc.isMethod()
+ && (execDoc.name().equals("readObject")
+ || execDoc.name().equals("writeObject")
+ || execDoc.name().equals("readExternal")
+ || execDoc.name().equals("writeExternal")
+ || execDoc.name().equals("readResolve"))) {
+ // FIXME: add readExternal here?
+
+ parser.ctx.maybeSerMethodList.add(execDoc);
+ }
+
+ return endIndex;
+ }
+
+ int match(char[] source, int index) {
+ boolean isFunc=false;
+ final int STATE_NORMAL=1;
+ final int STATE_SLASHC=2;
+ final int STATE_STARC=3;
+ int state=STATE_NORMAL;
+ for (; index<source.length && !isFunc; ++index) {
+ if (state==STATE_STARC) {
+ if (source[index]=='*' && source[index+1]=='/') {
+ ++index;
+ state=STATE_NORMAL;
+ }
+ }
+ else if (state==STATE_SLASHC) {
+ if (source[index]=='\n') {
+ state=STATE_NORMAL;
+ }
+ }
+ else switch (source[index]) {
+ case '/':
+ if (source[index+1]=='*') {
+ state=STATE_STARC;
+ ++index;
+ }
+ else if (source[index+1]=='/') {
+ state=STATE_SLASHC;
+ ++index;
+ }
+ break;
+ case '=': // field
+ case ';': // field
+ case '{': // class
+ return -1;
+ case '(':
+ isFunc=true;
+ break;
+ }
+ if (isFunc) break;
+ }
+ if (!isFunc || index==source.length)
+ return -1;
+
+ for (; index<source.length && (state!=STATE_NORMAL || (source[index]!='{' && source[index]!=';')); ++index)
+ if (state==STATE_SLASHC && source[index]=='\n') {
+ state=STATE_NORMAL;
+ }
+ else if (index<source.length-1) {
+ if (state==STATE_STARC) {
+ if (source[index]=='*' && source[index+1]=='/') {
+ state=STATE_NORMAL;
+ }
+ }
+ else {
+ if (source[index]=='/' && source[index+1]=='*') {
+ state=STATE_STARC;
+ }
+ else if (source[index]=='/' && source[index+1]=='/') {
+ state=STATE_SLASHC;
+ }
+ }
+ }
+ return index+1;
+ }
+
+
+ }
+
+ class StaticBlockComponent extends BlockSourceComponent {
+
+ int process(Parser parser, char[] source, int startIndex, int endIndex) {
+ //Debug.log(9,"found package statement: \""+str+"\"");
+ //Debug.log(9,"found function component: '"+str+"'");
+ parser.setLastComment(null);
+ return endIndex;
+ }
+
+ int match(char[] source, int index) {
+ if (source[index]=='{') return index+1;
+
+ if (index+7<source.length) {
+ if (source[index+0]=='s'
+ && source[index+1]=='t'
+ && source[index+2]=='a'
+ && source[index+3]=='t'
+ && source[index+4]=='i'
+ && source[index+5]=='c') {
+
+ for (index+=6; index<source.length && Parser.WHITESPACE.indexOf(source[index])>=0; ++index)
+ ;
+
+ if (index<source.length && source[index]=='{')
+ return index+1;
+ else
+ return -1;
+ }
+ }
+ return -1;
+ }
+
+ }
+
+ class ClassComponent extends SourceComponent {
+
+ int match(char[] source, int index) {
+ boolean isClass=false;
+ for (; index<source.length && !isClass; ++index) {
+ switch (source[index]) {
+ case '/': // possible comment
+ if (index<source.length-1) {
+ char c = source[index+1];
+ if ('/' == c) {
+ index += 2;
+ while (index<source.length && source[index]!=10) {
+ ++ index;
+ }
+ }
+ else if ('*' == c) {
+ index += 3;
+ while (index<source.length && (source[index-1] != '*' || source[index]!='/')) {
+ ++ index;
+ }
+ }
+ }
+ break;
+ case '@': // annotation
+ index += 1;
+ while(index<source.length && Character.isJavaIdentifierPart(source[index])) {
+ ++ index;
+ }
+ if (index<source.length && source[index]=='(') {
+ int parLevel = 1;
+ index += 1;
+ while (index<source.length && parLevel>0) {
+ if (source[index] == '(')
+ ++ parLevel;
+ if (source[index] == ')')
+ -- parLevel;
+ ++ index;
+ if (parLevel==0)
+ break;
+ }
+ }
+ break;
+ case '=': // field
+ case ';': // field
+ case '(': // function
+ return -1;
+ case '{':
+ isClass=true;
+ break;
+ }
+ if (isClass) break;
+ }
+ if (!isClass || index>=source.length)
+ return -1;
+
+ return index+1;
+ }
+
+ int process(Parser parser, char[] source, int startIndex, int endIndex) throws ParseException, IOException {
+
+ parser.classOpened(source, startIndex, endIndex);
+ if (parser.getAddComments())
+ parser.ctx.classDoc.setRawCommentText(parser.getLastComment());
+ parser.setLastComment(null);
+ if (parser.ctx.classDoc.isEnum())
+ {
+ int depth = 0;
+ for (int a = endIndex; a < source.length; ++a)
+ {
+ Debug.log(9, "Enum skipping " + a);
+ if (source[a] == '{')
+ {
+ Debug.log(1, "Found inner { in enum");
+ ++depth;
+ }
+ if (source[a] == '}')
+ {
+ if (depth > 0)
+ {
+ Debug.log(1, "Found inner } in enum");
+ --depth;
+ }
+ else
+ {
+ Debug.log(1, "Found enum }");
+ parser.classClosed();
+ return a + 1;
+ }
+ }
+ }
+ }
+ int rc=parser.parse(source, endIndex, parser.getClassLevelComponents());
+ return rc;
+ }
+
+ }
+
+
+public class Parser {
+
+
+ static int skipExpression(char[] source, int endIndex, int level, char delimiter) throws ParseException {
+
+ int orgEndIndex=endIndex;
+
+ final int STATE_NORMAL=1;
+ final int STATE_STARC=2;
+ final int STATE_SLASHC=3;
+ final int STATE_CHAR=4;
+ final int STATE_STRING=5;
+
+ int state=STATE_NORMAL;
+ int prev=0;
+ for (; !((level==0 && state==STATE_NORMAL && (delimiter=='\0' || source[endIndex]==delimiter))) && endIndex<source.length; ++endIndex) {
+ int c=source[endIndex];
+ if (state==STATE_NORMAL) {
+ if (c=='}') --level;
+ else if (c=='{') ++level;
+ else if (c=='/' && prev=='/') { state=STATE_SLASHC; c=0; }
+ else if (c=='*' && prev=='/') { state=STATE_STARC; c=0; }
+ else if (c=='\'' && prev!='\\') { state=STATE_CHAR; c=0; }
+ else if (c=='\"' && prev!='\\') { state=STATE_STRING; c=0; }
+ }
+ else if (state==STATE_SLASHC) {
+ if (c=='\n') state=STATE_NORMAL;
+ }
+ else if (state==STATE_CHAR) {
+ if (c=='\'' && prev!='\\') state=STATE_NORMAL;
+ else if (c=='\\' && prev=='\\') c=0;
+ }
+ else if (state==STATE_STRING) {
+ if (c=='\"' && prev!='\\') state=STATE_NORMAL;
+ else if (c=='\\' && prev=='\\') c=0;
+ }
+ else {
+ if (c=='/' && prev=='*') { state=STATE_NORMAL; c=0; }
+ }
+ prev=c;
+ }
+ if (level>0)
+ throw new ParseException("Unexpected end of source.");
+ else {
+ String rc=new String(source, orgEndIndex, endIndex-orgEndIndex);
+ return endIndex;
+ }
+ }
+
+ private boolean addComments = false;
+
+ public boolean getAddComments()
+ {
+ return this.addComments;
+ }
+
+ public static final String WHITESPACE=" \t\r\n ";
+
+ public static final boolean isWhitespace(char c) {
+ return (c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == ' ');
+ //return WHITESPACE.indexOf(c)>=0;
+ }
+
+ private int currentLine;
+
+ static char[] loadFile(final File file, String encoding)
+ throws IOException
+ {
+ InputStream in = new FileInputStream(file);
+ NotifyingInputStreamReader notifyingInput
+ = new NotifyingInputStreamReader(in, encoding);
+ notifyingInput.addMalformedInputListener(new MalformedInputListener() {
+ public void malformedInputEncountered(MalformedInputEvent event) {
+ Main.getRootDoc().printWarning("Illegal character in file " + file + ", line " + event.getLineNumber() + ", column " + event.getColumnNumber());
+ try {
+ Main.getRootDoc().printWarning(IOToolkit.getLineFromFile(file, event.getLineNumber()));
+ Main.getRootDoc().printWarning(IOToolkit.getColumnDisplayLine(event.getColumnNumber()));
+ }
+ catch (IOException ignore) {
+ }
+ }
+ });
+ Reader reader
+ = new BufferedReader(notifyingInput);
+ char[] result = IOToolkit.readFully(reader);
+ reader.close();
+ return result;
+ }
+
+ private SourceComponent[] sourceLevelComponents;
+ private SourceComponent[] classLevelComponents;
+
+ public SourceComponent[] getClassLevelComponents()
+ {
+ return this.classLevelComponents;
+ }
+
+ public Parser() {
+ try {
+
+ sourceLevelComponents=new SourceComponent[] {
+ new Whitespace(),
+ new CommentComponent(),
+ new SlashSlashCommentComponent(),
+ new PackageComponent(),
+ new EmptyStatementComponent(),
+ new ImportComponent(),
+ new ClassComponent(),
+ };
+
+ classLevelComponents=new SourceComponent[] {
+ new Whitespace(),
+ new BracketClose(),
+ new CommentComponent(),
+ new SlashSlashCommentComponent(),
+ new FunctionComponent(),
+ new StaticBlockComponent(),
+ new ImportComponent(),
+ new ClassComponent(),
+ new FieldComponent(),
+ };
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public int getNumberOfProcessedFiles() {
+ return processedFiles.size();
+ }
+
+ static Set processedFiles = new HashSet();
+
+ ClassDocImpl processSourceFile(File file, boolean addComments,
+ String encoding, String expectedPackageName)
+ throws IOException, ParseException
+ {
+ //System.err.println("Processing " + file + "...");
+ this.currentFile = file;
+ this.currentPackage = null;
+ this.currentPackageName = null;
+ this.expectedPackageName = expectedPackageName;
+ this.outerClass = null;
+ this.boilerplateComment = null;
+
+ this.addComments=addComments;
+
+ if (processedFiles.contains(file)) {
+ return null;
+ }
+
+ processedFiles.add(file);
+
+ Debug.log(1,"Processing file "+file);
+
+ contextStack.clear();
+ ctx=null;
+
+ importedClassesList.clear();
+ importedStringList.clear();
+ importedPackagesList.clear();
+ importedStatementList.clear();
+
+ currentLine = 1;
+
+ char[] source = loadFile(file, encoding);
+
+ try {
+ parse(source, 0, sourceLevelComponents);
+
+ ClassDoc[] importedClasses=(ClassDoc[])importedClassesList.toArray(new ClassDoc[0]);
+ PackageDoc[] importedPackages=(PackageDoc[])importedPackagesList.toArray(new PackageDoc[0]);
+
+ if (Main.DESCEND_IMPORTED) {
+ for (int i=0; i<importedClasses.length; ++i) {
+ Main.getRootDoc().scheduleClass(currentClass, importedClasses[i].qualifiedName());
+ }
+ }
+
+
+ if (contextStack.size()>0) {
+ Debug.log(1,"-->contextStack not empty! size is "+contextStack.size());
+ }
+
+ return outerClass;
+ }
+ catch (IgnoredFileParseException ignore) {
+ Debug.log(1, "File ignored: " + ignore);
+ return null;
+ }
+ }
+
+ int parse(char[] source, int index, SourceComponent[] componentTypes) throws ParseException, IOException {
+
+ while (index<source.length) {
+
+ int match=-1;
+ int i=0;
+ for (; i<componentTypes.length; ++i) {
+ if ((match=componentTypes[i].match(source, index))>=0) {
+ //Debug.log(1,componentTypes[i].getClass().getName()+" ("+match+"/"+source.length+")");
+ break;
+ }
+ }
+
+ if (i<componentTypes.length) {
+ int endIndex=componentTypes[i].getEndIndex(source, match);
+ Debug.log(9, "Processing " + new String(source,index,endIndex-index) + " with " + componentTypes[i]);
+ index=componentTypes[i].process(this, source, index, endIndex);
+ if (index<0) {
+ //Debug.log(9,"exiting parse because of "+componentTypes[i].getClass().getName()+" (\""+new String(source, index, endIndex-index)+"\")");
+ return endIndex;
+ }
+ }
+ else {
+ //Debug.log(9,"index="+index+", source.length()="+source.length);
+ throw new ParseException("unmatched input in line "+currentLine+": "+new String(source, index, Math.min(50,source.length-index)));
+ }
+
+ }
+ //Debug.log(9,"exiting parse normally, index="+index+" source.length="+source.length);
+ return index;
+ }
+
+ private static int countNewLines(String source) {
+ int i=0;
+ int rc=0;
+ while ((i=source.indexOf('\n',i)+1)>0)
+ ++rc;
+ return rc;
+ }
+
+ public void processSourceDir(File dir, String encoding, String expectedPackageName)
+ throws IOException, ParseException
+ {
+ Debug.log(9,"Processing "+dir.getParentFile().getName()+"."+dir.getName());
+ File[] files=dir.listFiles();
+ if (null!=files) {
+ for (int i=0; i<files.length; ++i) {
+ if (files[i].getName().toLowerCase().endsWith(".java")) {
+ processSourceFile(files[i], true, encoding, expectedPackageName);
+ }
+ }
+ }
+ }
+
+ void classOpened(char[] source, int startIndex, int endIndex) throws ParseException, IOException {
+
+ referencedClassesList.clear();
+
+ if (null == currentPackage) {
+
+ if (expectedPackageName != null) {
+ if (null == currentPackageName ||
+ !currentPackageName.equals(expectedPackageName)) {
+
+ Main.getRootDoc().printWarning("Ignoring file " + currentFile + ": (wrong package, " + currentPackageName + "!=" + expectedPackageName + ")");
+ throw new IgnoredFileParseException();
+ }
+ }
+
+ if (null != currentPackageName) {
+ currentPackage = Main.getRootDoc().findOrCreatePackageDoc(currentPackageName);
+ }
+ else {
+ currentPackage = Main.getRootDoc().findOrCreatePackageDoc("");
+ }
+ }
+
+ if (currentPackageName != null)
+ importedStatementList.add(currentPackageName + ".*");
+ importedStatementList.add("java.lang.*");
+
+ ClassDocImpl classDoc
+ = ClassDocImpl.createInstance((ctx!=null)?(ctx.classDoc):null, currentPackage,
+ null,
+ (PackageDoc[])importedPackagesList.toArray(new PackageDoc[0]),
+ source, startIndex, endIndex,
+ importedStatementList);
+
+ if (ctx != null) {
+ ctx.innerClassesList.add(classDoc);
+ if (classDoc.isIncluded()) {
+ ctx.filteredInnerClassesList.add(classDoc);
+ }
+ }
+
+ if (importedClassesList.isEmpty()) {
+ for (Iterator it=importedStringList.iterator(); it.hasNext(); ) {
+ importedClassesList.add(new ClassDocProxy((String)it.next(), classDoc));
+ }
+ }
+ classDoc.setImportedClasses((ClassDoc[])importedClassesList.toArray(new ClassDoc[0]));
+
+ currentPackage.addClass(classDoc);
+
+ currentClass = classDoc;
+
+ if (null == outerClass) {
+ outerClass = classDoc;
+ }
+
+ if (classDoc.superclass()!=null)
+ referencedClassesList.add(classDoc.superclass());
+
+ Debug.log(1,"classOpened "+classDoc+", adding superclass "+classDoc.superclass());
+ Debug.log(1,"Pushing " + ctx);
+ contextStack.push(ctx);
+ ctx=new Context(classDoc);
+ //Debug.log(9,"ctx="+ctx);
+ }
+
+ private Doc[] toArray(List list, Doc[] template)
+ {
+ Doc[] result = (Doc[])list.toArray(template);
+ return result;
+ }
+
+ void classClosed() throws ParseException, IOException {
+ ctx.classDoc.setFields((FieldDoc[])toArray(ctx.fieldList,
+ new FieldDoc[0]));
+ ctx.classDoc.setFilteredFields((FieldDoc[])toArray(ctx.filteredFieldList,
+ new FieldDoc[0]));
+ ctx.classDoc.setSerializableFields((FieldDoc[])toArray(ctx.sfieldList, new FieldDoc[0]));
+ ctx.classDoc.setMethods((MethodDoc[])toArray(ctx.methodList, new MethodDoc[0]));
+ ctx.classDoc.setFilteredMethods((MethodDoc[])toArray(ctx.filteredMethodList, new MethodDoc[0]));
+ ctx.classDoc.setMaybeSerMethodList(ctx.maybeSerMethodList);
+ ctx.classDoc.setConstructors((ConstructorDoc[])toArray(ctx.constructorList, new ConstructorDoc[0]));
+ ctx.classDoc.setFilteredConstructors((ConstructorDoc[])toArray(ctx.filteredConstructorList, new ConstructorDoc[0]));
+
+ ctx.classDoc.setInnerClasses((ClassDocImpl[])toArray(ctx.innerClassesList, new ClassDocImpl[0]));
+ ctx.classDoc.setFilteredInnerClasses((ClassDocImpl[])toArray(ctx.filteredInnerClassesList, new ClassDocImpl[0]));
+ ctx.classDoc.setBoilerplateComment(boilerplateComment);
+
+ Main.getRootDoc().addClassDoc(ctx.classDoc);
+
+ if (Main.DESCEND_INTERFACES) {
+ for (int i=0; i<ctx.classDoc.interfaces().length; ++i) {
+ Main.getRootDoc().scheduleClass(ctx.classDoc, ctx.classDoc.interfaces()[i].qualifiedName());
+ }
+ }
+
+ Debug.log(1,"classClosed: "+ctx.classDoc);
+
+ ctx=(Context)contextStack.pop();
+ Debug.log(1, "Popping " + ctx);
+ ClassDoc[] referencedClasses=(ClassDoc[])referencedClassesList.toArray(new ClassDoc[0]);
+
+ if (Main.DESCEND_SUPERCLASS) {
+ for (int i=0; i<referencedClasses.length; ++i) {
+ Main.getRootDoc().scheduleClass(currentClass, referencedClasses[i].qualifiedName());
+ }
+ }
+ }
+
+ Context ctx = null;
+ Stack contextStack = new Stack();
+ class Context {
+ Context(ClassDocImpl classDoc) { this.classDoc=classDoc; }
+ ClassDocImpl classDoc = null;
+ List fieldList = new LinkedList();
+ List filteredFieldList = new LinkedList();
+ List sfieldList = new LinkedList();
+ List methodList = new LinkedList();
+ List filteredMethodList = new LinkedList();
+ List maybeSerMethodList = new LinkedList();
+ List constructorList = new LinkedList();
+ List filteredConstructorList = new LinkedList();
+ List innerClassesList = new LinkedList();
+ List filteredInnerClassesList = new LinkedList();
+ }
+
+ File currentFile = null;
+ String lastComment = null;
+ String expectedPackageName = null;
+ String currentPackageName = null;
+ PackageDocImpl currentPackage = null;
+ ClassDocImpl currentClass = null;
+ ClassDocImpl outerClass = null;
+ List ordinaryClassesList = new LinkedList();
+ List allClassesList = new LinkedList();
+ List interfacesList = new LinkedList();
+
+ List importedClassesList = new LinkedList();
+ List importedStringList = new LinkedList();
+ List importedPackagesList = new LinkedList();
+ List importedStatementList = new LinkedList();
+
+ List referencedClassesList = new LinkedList();
+
+ String boilerplateComment = null;
+
+ void packageOpened(String packageName) {
+ currentPackageName = packageName;
+ }
+
+ void importEncountered(String importString) throws ParseException, IOException {
+ //Debug.log(9,"importing '"+importString+"'");
+
+ importedStatementList.add(importString);
+
+ if (importString.endsWith(".*")) {
+ importedPackagesList.add(Main.getRootDoc().findOrCreatePackageDoc(importString.substring(0,importString.length()-2)));
+ }
+ else {
+ importedStringList.add(importString);
+ }
+ }
+
+
+ void setLastComment(String lastComment) {
+ this.lastComment=lastComment;
+ }
+
+ String getLastComment() {
+ return this.lastComment;
+ }
+
+ void setBoilerplateComment(String boilerplateComment)
+ {
+ this.boilerplateComment = boilerplateComment;
+ }
+
+ String getBoilerplateComment()
+ {
+ return boilerplateComment;
+ }
+
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/ProgramElementDocImpl.java b/tools/gnu/classpath/tools/gjdoc/ProgramElementDocImpl.java
new file mode 100644
index 000000000..19353cc01
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/ProgramElementDocImpl.java
@@ -0,0 +1,161 @@
+/* gnu.classpath.tools.gjdoc.ProgramElementDocImpl
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import com.sun.javadoc.*;
+import java.lang.reflect.Modifier;
+
+public abstract class ProgramElementDocImpl extends DocImpl implements ProgramElementDoc {
+
+ protected ClassDoc containingClass;
+ protected PackageDoc containingPackage;
+
+ protected boolean isFinal;
+ protected boolean isStatic;
+ protected int accessLevel=ProgramElementDocImpl.ACCESS_PACKAGEPRIVATE;
+
+ public static final int ACCESS_PUBLIC = 0;
+ public static final int ACCESS_PROTECTED = 1;
+ public static final int ACCESS_PACKAGEPRIVATE = 2;
+ public static final int ACCESS_PRIVATE = 3;
+
+ private static final String[] accessModifiers = { "public ", "protected ", "", "private "};
+
+ public ProgramElementDocImpl(ClassDoc containingClass,
+ PackageDoc containingPackage,
+ SourcePosition position) {
+ super(position);
+ this.containingClass=containingClass;
+ this.containingPackage=containingPackage;
+ }
+ public ProgramElementDocImpl(ClassDoc containingClass, SourcePosition position) {
+ super(position);
+ this.containingClass=containingClass;
+ this.containingPackage=containingClass.containingPackage();
+ }
+ public ProgramElementDocImpl(ClassDoc containingClass,
+ PackageDoc containingPackage,
+ int accessLevel,
+ boolean isFinal,
+ boolean isStatic,
+ SourcePosition position) {
+ super(position);
+ this.containingClass=containingClass;
+ this.containingPackage=containingPackage;
+ this.accessLevel=accessLevel;
+ this.isFinal=isFinal;
+ this.isStatic=isStatic;
+ }
+
+ //Get the containing class of this program element.
+ public ClassDoc containingClass() {
+ return containingClass;
+ }
+
+ // Get the package that this program element is contained in.
+ public PackageDoc containingPackage() {
+ return containingPackage;
+ }
+
+ // Return true if this program element is final
+ public boolean isFinal() {
+ return isFinal;
+ }
+
+ // Return true if this program element is package private
+ public boolean isPackagePrivate() {
+ return accessLevel==ACCESS_PACKAGEPRIVATE;
+ }
+
+ // Return true if this program element is private
+ public boolean isPrivate() {
+ return accessLevel==ACCESS_PRIVATE;
+ }
+
+ // Return true if this program element is protected
+ public boolean isProtected() {
+ return accessLevel==ACCESS_PROTECTED;
+ }
+
+ // Return true if this program element is public
+ public boolean isPublic() {
+ return accessLevel==ACCESS_PUBLIC;
+ }
+
+ // Return true if this program element is static
+ public boolean isStatic() {
+ return isStatic;
+ }
+
+ // Get modifiers string.
+ public String modifiers() {
+ return
+ (accessModifiers[accessLevel]+
+ (isStatic()?"static ":"")+
+ (isFinal()?"final ":"")).trim();
+ }
+
+ // Get the modifier specifier integer.
+ public int modifierSpecifier() {
+ return (isStatic()?Modifier.STATIC:0)
+ | (isFinal()?Modifier.FINAL:0)
+ | (isPublic()?Modifier.PUBLIC:0)
+ | (isProtected()?Modifier.PROTECTED:0)
+ | (isPrivate()?Modifier.PRIVATE:0)
+// | (isAbstract()?Modifier.ABSTRACT:0)
+ ;
+ }
+
+ // Get the fully qualified name.
+ public abstract String qualifiedName();
+
+ protected boolean processModifier(String word) {
+ if (word.equals("public")) {
+ accessLevel=ACCESS_PUBLIC;
+ return true;
+ }
+ else if (word.equals("protected")) {
+ accessLevel=ACCESS_PROTECTED;
+ return true;
+ }
+ else if (word.equals("private")) {
+ accessLevel=ACCESS_PRIVATE;
+ return true;
+ }
+ else if (word.equals("static")) {
+ isStatic=true;
+ return true;
+ }
+ else if (word.equals("final")) {
+ isFinal=true;
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ void setIsStatic(boolean b) {
+ this.isStatic=b;
+ }
+
+}
+
diff --git a/tools/gnu/classpath/tools/gjdoc/RootDocImpl.java b/tools/gnu/classpath/tools/gjdoc/RootDocImpl.java
new file mode 100644
index 000000000..b60a0b6e2
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/RootDocImpl.java
@@ -0,0 +1,1317 @@
+/* gnu.classpath.tools.gjdoc.RootDocImpl
+ Copyright (C) 2001, 2007 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import com.sun.javadoc.*;
+import java.util.*;
+import java.io.*;
+import java.lang.reflect.*;
+
+public class RootDocImpl
+ extends DocImpl
+ implements GjdocRootDoc {
+
+ private ErrorReporter reporter = new ErrorReporter();
+
+ private RandomAccessFile rawCommentCache;
+
+ /**
+ * All options and their corresponding values which are not recognized
+ * by Gjdoc. These are passed to the Doclet as "custom options".
+ * Each element in this array is again a String array, with the
+ * option name as first element (including prefix dash) and possible
+ * option values as following elements.
+ */
+ private String[][] customOptionArr;
+
+ /**
+ * All source files explicitly specified on the command line.
+ *
+ * @contains File
+ */
+ private List specifiedSourceFiles = new LinkedList();
+
+ /**
+ * The names of all packages explicitly specified on the
+ * command line.
+ *
+ * @contains String
+ */
+ private Set specifiedPackageNames = new LinkedHashSet();
+
+ /**
+ * Stores all classes specified by the user: those given by
+ * individual class names on the command line, and those
+ * contained in the packages given on the command line.
+ *
+ * @contains ClassDocImpl
+ */
+ private List classesList = new LinkedList(); //new LinkedList();
+
+ /**
+ * Stores all classes loaded in the course of preparing
+ * the documentation data. Maps the fully qualified name
+ * of a class to its ClassDocImpl representation.
+ *
+ * @contains String->ClassDocImpl
+ */
+ private Map classDocMap = new HashMap();
+
+ /**
+ * Stores all packages loaded in the course of preparing
+ * the documentation data. Maps the package name
+ * to its PackageDocImpl representation.
+ *
+ * @contains String->PackageDocImpl
+ */
+ private Map packageDocMap = new HashMap();
+
+ /**
+ * All classes specified by the user, both those explicitly
+ * individually specified on the command line and those contained
+ * in packages specified on the command line (as Array for quick
+ * retrieval by Doclet). This is created from classesList after
+ * all classes have been loaded.
+ */
+ private ClassDocImpl[] classes;
+
+ /**
+ * All classes which were individually specified on the command
+ * line (as Array for quick retrieval by Doclet). This is created
+ * from specifiedClassNames after all classes have been loaded.
+ */
+ private List specifiedClasses;
+
+ /**
+ * All packages which were specified on the command line (as Array
+ * for quick retrieval by Doclet). This is created from
+ * specifiedPackageNames after all classes have been loaded.
+ */
+ private Set specifiedPackages;
+
+
+ /**
+ * Temporarily stores a list of classes which are referenced
+ * by classes already loaded and which still have to be
+ * resolved.
+ */
+ private List scheduledClasses=new LinkedList();
+
+ private List sourcePath;
+
+ private String sourceEncoding;
+
+ private Parser parser = new Parser();
+
+ private Set unlocatableReportedSet = new HashSet();
+
+ private Set inaccessibleReportedSet = new HashSet();
+
+ //--------------------------------------------------------------------------
+ //
+ // Implementation of RootDoc interface
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * Return classes and interfaces to be documented.
+ */
+ public ClassDoc[] classes() { return classes; }
+
+ /**
+ * Return a ClassDoc object for the specified class/interface
+ * name.
+ *
+ * @return a ClassDoc object describing the given class, or
+ * <code>null</code> if no corresponding ClassDoc object
+ * has been constructed.
+ */
+ public ClassDoc classNamed(String qualifiedName) {
+ return (ClassDoc)classDocMap.get(qualifiedName);
+ }
+
+ /**
+ * Return an xxx
+ */
+ public String[][] options() { return customOptionArr; }
+
+ // Return a PackageDoc for the specified package name
+ public PackageDoc packageNamed(String name) {
+ return (PackageDoc)packageDocMap.get(name);
+ }
+
+
+ // classes and interfaces specified on the command line.
+ public ClassDoc[] specifiedClasses()
+ {
+ return (ClassDocImpl[]) specifiedClasses.toArray(new ClassDocImpl[0]);
+ }
+
+ // packages specified on the command line.
+ public PackageDoc[] specifiedPackages()
+ {
+ return (PackageDocImpl[])specifiedPackages.toArray(new PackageDocImpl[0]);
+ }
+
+ // Print error message, increment error count.
+ public void printError(java.lang.String msg) {
+ reporter.printError(msg);
+ }
+
+ // Print error message, increment error count.
+ public void printFatal(java.lang.String msg) {
+ reporter.printFatal(msg);
+ }
+
+ // Print a message.
+ public void printNotice(java.lang.String msg) {
+ reporter.printNotice(msg);
+ }
+
+ // Print warning message, increment warning count.
+ public void printWarning(java.lang.String msg) {
+ reporter.printWarning(msg);
+ }
+
+ public String name() {
+ return "RootDoc";
+ }
+
+ public ErrorReporter getReporter() {
+ return reporter;
+ }
+
+ public void build() throws ParseException, IOException {
+
+ //--- Create a temporary random access file for caching comment text.
+
+ //File rawCommentCacheFile=File.createTempFile("gjdoc_rawcomment",".cache");
+ File rawCommentCacheFile = new File("gjdoc_rawcomment.cache");
+ rawCommentCacheFile.deleteOnExit();
+ rawCommentCache = new RandomAccessFile(rawCommentCacheFile, "rw");
+
+ //--- Parse all files in "java.lang".
+
+ List javaLangSourceDirs = findSourceFiles("java/lang");
+ if (!javaLangSourceDirs.isEmpty()) {
+ Iterator it = javaLangSourceDirs.iterator();
+ while (it.hasNext()) {
+ File javaLangSourceDir = (File)it.next();
+ parser.processSourceDir(javaLangSourceDir,
+ sourceEncoding, "java.lang");
+ }
+ }
+ else {
+
+ Debug.log(1, "Sourcepath is "+sourcePath);
+
+ // Core docs not included in source-path:
+ // we need to gather the information about java.lang
+ // classes via reflection...
+
+ }
+
+ //--- Parse all files in explicitly specified package directories.
+
+ for (Iterator it=specifiedPackageNames.iterator(); it.hasNext(); ) {
+
+ String specifiedPackageName = (String)it.next();
+ String displayPackageName = specifiedPackageName;
+ if (null == displayPackageName || 0 == displayPackageName.length()) {
+ displayPackageName = "<unnamed>";
+ }
+ printNotice("Loading classes for package "+displayPackageName+"...");
+ String relPath;
+ if (null != specifiedPackageName) {
+ relPath = specifiedPackageName.replace('.',File.separatorChar);
+ }
+ else {
+ relPath = "";
+ }
+ List sourceDirs = findSourceFiles(relPath);
+ if (!sourceDirs.isEmpty()) {
+ Iterator sourceDirIt = sourceDirs.iterator();
+ while (sourceDirIt.hasNext()) {
+ File sourceDir = (File)sourceDirIt.next();
+ parser.processSourceDir(sourceDir, sourceEncoding, specifiedPackageName);
+ }
+ }
+ else {
+ printError("Package '"+specifiedPackageName+"' not found.");
+ }
+ }
+
+ specifiedClasses = new LinkedList();
+
+ //--- Parse all explicitly specified source files.
+
+ for (Iterator it=specifiedSourceFiles.iterator(); it.hasNext(); ) {
+
+ File specifiedSourceFile = (File)it.next();
+ printNotice("Loading source file "+specifiedSourceFile+" ...");
+ ClassDocImpl classDoc = parser.processSourceFile(specifiedSourceFile, true, sourceEncoding, null);
+ if (null != classDoc) {
+ specifiedClasses.add(classDoc);
+ classesList.add(classDoc);
+ classDoc.setIsIncluded(true);
+ addPackageDoc(classDoc.containingPackage());
+ }
+ }
+
+
+ //--- Let the user know that all specified classes are loaded.
+
+ printNotice("Constructing Javadoc information...");
+
+ //--- Load all classes implicitly referenced by explicitly specified classes.
+
+ loadScheduledClasses(parser);
+
+ printNotice("Resolving references in comments...");
+
+ resolveComments();
+
+ //--- Resolve pending references in all ClassDocImpls
+
+ printNotice("Resolving references in classes...");
+
+ for (Iterator it = classDocMap.values().iterator(); it.hasNext(); ) {
+ ClassDoc cd=(ClassDoc)it.next();
+ if (cd instanceof ClassDocImpl) {
+ ((ClassDocImpl)cd).resolve();
+ }
+ }
+
+ //--- Resolve pending references in all PackageDocImpls
+
+ printNotice("Resolving references in packages...");
+
+ for (Iterator it = packageDocMap.values().iterator(); it.hasNext(); ) {
+ PackageDocImpl pd=(PackageDocImpl)it.next();
+ pd.resolve();
+ }
+
+ //--- Assemble the array with all specified packages
+
+ specifiedPackages = new LinkedHashSet();
+ for (Iterator it = specifiedPackageNames.iterator(); it.hasNext(); ) {
+ String specifiedPackageName = (String)it.next();
+ PackageDoc specifiedPackageDoc = (PackageDoc)packageDocMap.get(specifiedPackageName);
+ if (null!=specifiedPackageDoc) {
+ ((PackageDocImpl)specifiedPackageDoc).setIsIncluded(true);
+ specifiedPackages.add(specifiedPackageDoc);
+
+ ClassDoc[] packageClassDocs=specifiedPackageDoc.allClasses();
+ for (int i=0; i<packageClassDocs.length; ++i) {
+ ClassDocImpl specifiedPackageClassDoc=(ClassDocImpl)packageClassDocs[i];
+
+ specifiedPackageClassDoc.setIsIncluded(true);
+ classesList.add(specifiedPackageClassDoc);
+ }
+ }
+ }
+
+ //--- Resolve pending references in comment data of all classes
+
+ printNotice("Resolving references in class comments...");
+
+ for (Iterator it=classDocMap.values().iterator(); it.hasNext(); ) {
+ ClassDoc cd=(ClassDoc)it.next();
+ if (cd instanceof ClassDocImpl) {
+ ((ClassDocImpl)cd).resolveComments();
+ }
+ }
+
+ //--- Resolve pending references in comment data of all packages
+
+ printNotice("Resolving references in package comments...");
+
+ for (Iterator it=packageDocMap.values().iterator(); it.hasNext(); ) {
+ PackageDocImpl pd=(PackageDocImpl)it.next();
+ pd.resolveComments();
+ }
+
+ //--- Create array with all loaded classes
+
+ this.classes=(ClassDocImpl[])classesList.toArray(new ClassDocImpl[0]);
+ Arrays.sort(this.classes);
+
+ //--- Close comment cache
+
+ parser = null;
+ System.gc();
+ System.gc();
+ }
+
+ public long writeRawComment(String rawComment) {
+ try {
+ long pos=rawCommentCache.getFilePointer();
+ //rawCommentCache.writeUTF(rawComment);
+ byte[] bytes = rawComment.getBytes("utf-8");
+ rawCommentCache.writeInt(bytes.length);
+ rawCommentCache.write(bytes);
+ return pos;
+ }
+ catch (IOException e) {
+ printFatal("Cannot write to comment cache: "+e.getMessage());
+ return -1;
+ }
+ }
+
+ public String readRawComment(long pos) {
+ try {
+ rawCommentCache.seek(pos);
+ int sz = rawCommentCache.readInt();
+ byte[] bytes = new byte[sz];
+ rawCommentCache.read(bytes);
+ return new String(bytes, "utf-8");
+ //return rawCommentCache.readUTF();
+ }
+ catch (IOException e) {
+ e.printStackTrace();
+ printFatal("Cannot read from comment cache: "+e.getMessage());
+ return null;
+ }
+ }
+
+ List findSourceFiles(String relPath) {
+
+ List result = new LinkedList();
+ for (Iterator it = sourcePath.iterator(); it.hasNext(); ) {
+ File path = (File)it.next();
+ File file = new File(path, relPath);
+ if (file.exists()) {
+ result.add(file);
+ }
+ }
+
+ return result;
+ }
+
+ PackageDocImpl findOrCreatePackageDoc(String packageName) {
+ PackageDocImpl rc=(PackageDocImpl)getPackageDoc(packageName);
+ if (null==rc) {
+ rc=new PackageDocImpl(packageName);
+ if (specifiedPackageNames.contains(packageName)) {
+ String packageDirectoryName = packageName.replace('.', File.separatorChar);
+ List packageDirectories = findSourceFiles(packageDirectoryName);
+ Iterator it = packageDirectories.iterator();
+ boolean packageDocFound = false;
+ while (it.hasNext()) {
+ File packageDirectory = (File)it.next();
+ File packageDocFile = new File(packageDirectory, "package.html");
+ rc.setPackageDirectory(packageDirectory);
+ packageDocFound = true;
+ if (null!=packageDocFile && packageDocFile.exists()) {
+ try {
+ rc.setRawCommentText(readHtmlBody(packageDocFile));
+ }
+ catch (IOException e) {
+ printWarning("Error while reading documentation for package "+packageName+": "+e.getMessage());
+ }
+ break;
+ }
+ }
+ if (!packageDocFound) {
+ printNotice("No description found for package "+packageName);
+ }
+ }
+ addPackageDoc(rc);
+ }
+ return rc;
+ }
+
+ public void addClassDoc(ClassDoc cd) {
+ classDocMap.put(cd.qualifiedName(), cd);
+ }
+
+ public void addClassDocRecursive(ClassDoc cd) {
+ classDocMap.put(cd.qualifiedName(), cd);
+ ClassDoc[] innerClasses = cd.innerClasses(false);
+ for (int i=0; i<innerClasses.length; ++i) {
+ addClassDocRecursive(innerClasses[i]);
+ }
+ }
+
+ public void addPackageDoc(PackageDoc pd) {
+ packageDocMap.put(pd.name(), pd);
+ }
+
+ public PackageDocImpl getPackageDoc(String name) {
+ return (PackageDocImpl)packageDocMap.get(name);
+ }
+
+ public ClassDocImpl getClassDoc(String qualifiedName) {
+ return (ClassDocImpl)classDocMap.get(qualifiedName);
+ }
+
+ class ScheduledClass {
+
+ ClassDoc contextClass;
+ String qualifiedName;
+ ScheduledClass(ClassDoc contextClass, String qualifiedName) {
+ this.contextClass=contextClass;
+ this.qualifiedName=qualifiedName;
+ }
+
+ public String toString() { return "ScheduledClass{"+qualifiedName+"}"; }
+ }
+
+ public void scheduleClass(ClassDoc context, String qualifiedName) throws ParseException, IOException {
+
+ if (classDocMap.get(qualifiedName)==null) {
+
+ //Debug.log(9,"Scheduling "+qualifiedName+", context "+context+".");
+ //System.err.println("Scheduling " + qualifiedName + ", context " + context);
+
+ scheduledClasses.add(new ScheduledClass(context, qualifiedName));
+ }
+ }
+
+ /**
+ * Load all classes that were implictly referenced by the classes
+ * (already loaded) that the user explicitly specified on the
+ * command line.
+ *
+ * For example, if the user generates Documentation for his simple
+ * 'class Test {}', which of course 'extends java.lang.Object',
+ * then 'java.lang.Object' is implicitly referenced because it is
+ * the base class of Test.
+ *
+ * Gjdoc needs a ClassDocImpl representation of all classes
+ * implicitly referenced through derivation (base class),
+ * or implementation (interface), or field type, method argument
+ * type, or method return type.
+ *
+ * The task of this method is to ensure that Gjdoc has all this
+ * information at hand when it exits.
+ *
+ *
+ */
+ public void loadScheduledClasses(Parser parser) throws ParseException, IOException {
+
+ // Because the referenced classes could in turn reference other
+ // classes, this method runs as long as there are still unloaded
+ // classes.
+
+ while (!scheduledClasses.isEmpty()) {
+
+ // Make a copy of scheduledClasses and empty it. This
+ // prevents any Concurrent Modification issues.
+ // As the copy won't need to grow (as it won't change)
+ // we make it an Array for performance reasons.
+
+ ScheduledClass[] scheduledClassesArr = (ScheduledClass[])scheduledClasses.toArray(new ScheduledClass[0]);
+ scheduledClasses.clear();
+
+ // Load each class specified in our array copy
+
+ for (int i=0; i<scheduledClassesArr.length; ++i) {
+
+ // The name of the class we are looking for. This name
+ // needs not be fully qualified.
+
+ String scheduledClassName=scheduledClassesArr[i].qualifiedName;
+
+ // The ClassDoc in whose context the scheduled class was looked for.
+ // This is necessary in order to resolve non-fully qualified
+ // class names.
+ ClassDoc scheduledClassContext=scheduledClassesArr[i].contextClass;
+
+ // If there already is a class doc with this name, skip. There's
+ // nothing to do for us.
+ if (classDocMap.get(scheduledClassName)!=null) {
+ continue;
+ }
+
+ try {
+ // Try to load the class
+ //printNotice("Trying to load " + scheduledClassName);
+ loadScheduledClass(parser, scheduledClassName, scheduledClassContext);
+ }
+ catch (ParseException e) {
+
+ /**********************************************************
+
+ // Check whether the following is necessary at all.
+
+
+ if (scheduledClassName.indexOf('.')>0) {
+
+ // Maybe the dotted notation doesn't mean a package
+ // name but instead an inner class, as in 'Outer.Inner'.
+ // so let's assume this and try to load the outer class.
+
+ String outerClass="";
+ for (StringTokenizer st=new StringTokenizer(scheduledClassName,"."); st.hasMoreTokens(); ) {
+ if (outerClass.length()>0) outerClass+=".";
+ outerClass+=st.nextToken();
+ if (!st.hasMoreTokens()) break;
+ try {
+ loadClass(outerClass);
+ //FIXME: shouldn't this be loadScheduledClass(outerClass, scheduledClassContext); ???
+ continue;
+ }
+ catch (Exception ee) {
+ // Ignore: try next level
+ }
+ }
+ }
+
+ **********************************************************/
+
+ // If we arrive here, the class could not be found
+
+ printWarning("Couldn't load class "+scheduledClassName+" referenced by "+scheduledClassContext);
+
+ //FIXME: shouldn't this be throw new Error("cannot load: "+scheduledClassName);
+ }
+ }
+ }
+ }
+
+ private void loadScheduledClass(Parser parser, String scheduledClassName, ClassDoc scheduledClassContext) throws ParseException, IOException {
+
+ ClassDoc loadedClass=(ClassDoc)scheduledClassContext.findClass(scheduledClassName);
+
+ if (loadedClass==null || loadedClass instanceof ClassDocProxy) {
+
+ ClassDoc classDoc = findScheduledClassFile(scheduledClassName, scheduledClassContext);
+ if (null != classDoc) {
+
+ if (classDoc instanceof ClassDocReflectedImpl) {
+ Main.getRootDoc().addClassDocRecursive(classDoc);
+ }
+
+ if (Main.DESCEND_SUPERCLASS
+ && null != classDoc.superclass()
+ && (classDoc.superclass() instanceof ClassDocProxy)) {
+ scheduleClass(classDoc, classDoc.superclass().qualifiedName());
+ }
+ }
+ else {
+ // It might be an inner class of one of the outer/super classes.
+ // But we can only check that when they are all fully loaded.
+ boolean retryLater = false;
+
+ int numberOfProcessedFilesBefore = parser.getNumberOfProcessedFiles();
+
+ ClassDoc cc = scheduledClassContext.containingClass();
+ while (cc != null && !retryLater) {
+ ClassDoc sc = cc.superclass();
+ while (sc != null && !retryLater) {
+ if (sc instanceof ClassDocProxy) {
+ ((ClassDocImpl)cc).resolve();
+ retryLater = true;
+ }
+ sc = sc.superclass();
+ }
+ cc = cc.containingClass();
+ }
+
+ // Now that outer/super references have been resolved, try again
+ // to find the class.
+
+ loadedClass = (ClassDoc)scheduledClassContext.findClass(scheduledClassName);
+
+ int numberOfProcessedFilesAfter = parser.getNumberOfProcessedFiles();
+
+ boolean filesWereProcessed = numberOfProcessedFilesAfter > numberOfProcessedFilesBefore;
+
+ // Only re-schedule class if additional files have been processed
+ // If there haven't, there's no point in re-scheduling.
+ // Will avoid infinite loops of re-scheduling
+ if (null == loadedClass && retryLater && filesWereProcessed)
+ scheduleClass(scheduledClassContext, scheduledClassName);
+
+ /* A warning needn't be emitted - this is normal, can happen
+ if the scheduled class is in a package which is not
+ included on the command line.
+
+ else if (null == loadedClass)
+ printWarning("Can't find scheduled class '"
+ + scheduledClassName
+ + "' in context '"
+ + scheduledClassContext.qualifiedName()
+ + "'");
+ */
+ }
+ }
+ }
+
+ private static interface ResolvedImport
+ {
+ public String match(String name);
+ public boolean mismatch(String name);
+ public ClassDoc tryFetch(String name);
+ }
+
+ private class ResolvedImportNotFound
+ implements ResolvedImport
+ {
+ private String importSpecifier;
+ private String name;
+
+ ResolvedImportNotFound(String importSpecifier)
+ {
+ this.importSpecifier = importSpecifier;
+ int ndx = importSpecifier.lastIndexOf('.');
+ if (ndx >= 0) {
+ this.name = importSpecifier.substring(ndx + 1);
+ }
+ else {
+ this.name = importSpecifier;
+ }
+ }
+
+ public String toString()
+ {
+ return "ResolvedImportNotFound{" + importSpecifier + "}";
+ }
+
+ public String match(String name)
+ {
+ if ((name.equals(this.name)) || (importSpecifier.equals(name)))
+ return this.name;
+ // FIXME: note that we don't handle on-demand imports here.
+ return null;
+ }
+
+ public boolean mismatch(String name)
+ {
+ return true; // FIXME!
+ }
+
+ public ClassDoc tryFetch(String name)
+ {
+ return null;
+ }
+ }
+
+ private class ResolvedImportPackageFile
+ implements ResolvedImport
+ {
+ private Set topLevelClassNames;
+ private File packageFile;
+ private String packageName;
+ private Map cache = new HashMap();
+
+ ResolvedImportPackageFile(File packageFile, String packageName)
+ {
+ this.packageFile = packageFile;
+ this.packageName = packageName;
+ topLevelClassNames = new HashSet();
+ File[] files = packageFile.listFiles();
+ for (int i=0; i<files.length; ++i) {
+ if (!files[i].isDirectory() && files[i].getName().endsWith(".java")) {
+ String topLevelClassName = files[i].getName();
+ topLevelClassName
+ = topLevelClassName.substring(0, topLevelClassName.length() - 5);
+ topLevelClassNames.add(topLevelClassName);
+ }
+ }
+ }
+
+ public String match(String name)
+ {
+ ClassDoc loadedClass = classNamed(packageName + "." + name);
+ if (null != loadedClass) {
+ return loadedClass.qualifiedName();
+ }
+ else {
+ String topLevelName = name;
+ int ndx = topLevelName.indexOf('.');
+ String innerClassName = null;
+ if (ndx > 0) {
+ innerClassName = topLevelName.substring(ndx + 1);
+ topLevelName = topLevelName.substring(0, ndx);
+ }
+
+ if (topLevelClassNames.contains(topLevelName)) {
+ //System.err.println(this + ".match returns " + packageName + "." + name);
+ return packageName + "." + name;
+ }
+ // FIXME: inner classes
+ else {
+ return null;
+ }
+ }
+ }
+
+ public boolean mismatch(String name)
+ {
+ return null == match(name);
+ }
+
+ public ClassDoc tryFetch(String name)
+ {
+ ClassDoc loadedClass = classNamed(packageName + "." + name);
+ if (null != loadedClass) {
+ return loadedClass;
+ }
+ else if (null != match(name)) {
+
+ String topLevelName = name;
+ int ndx = topLevelName.indexOf('.');
+ String innerClassName = null;
+ if (ndx > 0) {
+ innerClassName = topLevelName.substring(ndx + 1);
+ topLevelName = topLevelName.substring(0, ndx);
+ }
+
+ ClassDoc topLevelClass = (ClassDoc)cache.get(topLevelName);
+ if (null == topLevelClass) {
+ File classFile = new File(packageFile, topLevelName + ".java");
+ try {
+ // FIXME: inner classes
+ topLevelClass = parser.processSourceFile(classFile, false, sourceEncoding, null);
+ }
+ catch (Exception ignore) {
+ printWarning("Could not parse source file " + classFile);
+ }
+ cache.put(topLevelName, topLevelClass);
+ }
+ if (null == innerClassName) {
+ return topLevelClass;
+ }
+ else {
+ return getInnerClass(topLevelClass, innerClassName);
+ }
+ }
+ else {
+ return null;
+ }
+ }
+
+ public String toString()
+ {
+ return "ResolvedImportPackageFile{" + packageFile + "," + packageName + "}";
+ }
+ }
+
+ private ClassDoc getInnerClass(ClassDoc topLevelClass, String innerClassName)
+ {
+ StringTokenizer st = new StringTokenizer(innerClassName, ".");
+ outer:
+
+ while (st.hasMoreTokens()) {
+ String innerClassNameComponent = st.nextToken();
+ ClassDoc[] innerClasses = topLevelClass.innerClasses();
+ for (int i=0; i<innerClasses.length; ++i) {
+ if (innerClasses[i].name().equals(innerClassNameComponent)) {
+ topLevelClass = innerClasses[i];
+ continue outer;
+ }
+ }
+ printWarning("Could not find inner class " + innerClassName + " in class " + topLevelClass.qualifiedName());
+ return null;
+ }
+ return topLevelClass;
+ }
+
+ private class ResolvedImportClassFile
+ implements ResolvedImport
+ {
+ private File classFile;
+ private String innerClassName;
+ private String name;
+ private ClassDoc classDoc;
+ private boolean alreadyFetched;
+ private String qualifiedName;
+
+ ResolvedImportClassFile(File classFile, String innerClassName, String name, String qualifiedName)
+ {
+ this.classFile = classFile;
+ this.innerClassName = innerClassName;
+ this.name = name;
+ this.qualifiedName = qualifiedName;
+ }
+
+ public String toString()
+ {
+ return "ResolvedImportClassFile{" + classFile + "," + innerClassName + "}";
+ }
+
+ public String match(String name)
+ {
+ String topLevelName = name;
+ int ndx = topLevelName.indexOf('.');
+
+ String _innerClassName = null;
+ if (ndx > 0) {
+ _innerClassName = topLevelName.substring(ndx + 1);
+ topLevelName = topLevelName.substring(0, ndx);
+ }
+
+ if (this.name.equals(topLevelName)) {
+ if (null == _innerClassName) {
+ return qualifiedName;
+ }
+ else {
+ return qualifiedName + "." + _innerClassName;
+ }
+ }
+ else {
+ return null;
+ }
+ }
+
+ public boolean mismatch(String name)
+ {
+ return null == match(name);
+ }
+
+ public ClassDoc tryFetch(String name)
+ {
+ if (null != match(name)) {
+ ClassDoc topLevelClass = null;
+ if (alreadyFetched) {
+ topLevelClass = classDoc;
+ }
+ else {
+ alreadyFetched = true;
+ try {
+ topLevelClass = parser.processSourceFile(classFile, false, sourceEncoding, null);
+ }
+ catch (Exception ignore) {
+ printWarning("Could not parse source file " + classFile);
+ }
+ }
+ if (null == topLevelClass) {
+ return null;
+ }
+ else {
+ return getInnerClass(topLevelClass, innerClassName);
+ }
+ }
+ else {
+ return null;
+ }
+ }
+
+ public String getName()
+ {
+ if (innerClassName != null) {
+ return name + innerClassName;
+ }
+ else {
+ return name;
+ }
+ }
+ }
+
+ private class ResolvedImportReflectionClass
+ implements ResolvedImport
+ {
+ private Class clazz;
+ private String name;
+
+ ResolvedImportReflectionClass(Class clazz)
+ {
+ this.clazz = clazz;
+ String className = clazz.getName();
+ int ndx = className.lastIndexOf('.');
+ if (ndx >= 0) {
+ this.name = className.substring(ndx + 1);
+ }
+ else {
+ this.name = className;
+ }
+ }
+
+ public String toString()
+ {
+ return "ResolvedImportReflectionClass{" + clazz.getName() + "}";
+ }
+
+ public String match(String name)
+ {
+ if ((this.name.equals(name)) || (clazz.getName().equals(name))) {
+ return clazz.getName();
+ }
+ else {
+ return null;
+ }
+ }
+
+ public boolean mismatch(String name)
+ {
+ return null == match(name);
+ }
+
+ public ClassDoc tryFetch(String name)
+ {
+ if (null != match(name)) {
+ return new ClassDocReflectedImpl(clazz);
+ }
+ // FIXME: inner classes?
+ else {
+ return null;
+ }
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+ }
+
+ private class ResolvedImportReflectionPackage
+ implements ResolvedImport
+ {
+ private String packagePrefix;
+
+ ResolvedImportReflectionPackage(String packagePrefix)
+ {
+ this.packagePrefix = packagePrefix;
+ }
+
+ public String toString()
+ {
+ return "ResolvedImportReflectionPackage{" + packagePrefix + ".*}";
+ }
+
+ public String match(String name)
+ {
+ try {
+ Class clazz = Class.forName(packagePrefix + "." + name);
+ return clazz.getName();
+ }
+ catch (Exception e) {
+ return null;
+ }
+ }
+
+ public boolean mismatch(String name)
+ {
+ return null == match(name);
+ }
+
+ public ClassDoc tryFetch(String name)
+ {
+ try {
+ Class clazz = Class.forName(packagePrefix + name);
+ return ClassDocReflectedImpl.newInstance(clazz);
+ }
+ catch (Exception e) {
+ return null;
+ }
+ }
+
+ public String getName()
+ {
+ return packagePrefix;
+ }
+ }
+
+ private List unlocatablePrefixes = new LinkedList();
+
+ private ResolvedImport resolveImport(String importSpecifier)
+ {
+ ResolvedImport result = resolveImportFileSystem(importSpecifier);
+ if (null == result && Main.getInstance().isReflectionEnabled()) {
+ result = resolveImportReflection(importSpecifier);
+ }
+ if (null == result) {
+ result = new ResolvedImportNotFound(importSpecifier);
+ }
+ return result;
+ }
+
+ private ResolvedImport resolveImportReflection(String importSpecifier)
+ {
+ String importedPackageOrClass = importSpecifier;
+ if (importedPackageOrClass.endsWith(".*")) {
+ importedPackageOrClass = importedPackageOrClass.substring(0, importedPackageOrClass.length() - 2);
+
+ return new ResolvedImportReflectionPackage(importedPackageOrClass);
+
+ //return null;
+ }
+ else {
+ try {
+ Class importedClass = Class.forName(importSpecifier);
+ return new ResolvedImportReflectionClass(importedClass);
+ }
+ catch (Throwable ignore) {
+ return null;
+ }
+ }
+ }
+
+ private ResolvedImport resolveImportFileSystem(String importSpecifier)
+ {
+ for (Iterator it = unlocatablePrefixes.iterator(); it.hasNext(); ) {
+ String unlocatablePrefix = (String)it.next();
+ if (importSpecifier.startsWith(unlocatablePrefix)) {
+ return null;
+ }
+ }
+
+ String longestUnlocatablePrefix = "";
+
+ for (Iterator it=sourcePath.iterator(); it.hasNext(); ) {
+
+ File _sourcePath = (File)it.next();
+
+ StringBuffer packageOrClassPrefix = new StringBuffer();
+ StringTokenizer st = new StringTokenizer(importSpecifier, ".");
+ while (st.hasMoreTokens() && _sourcePath.isDirectory()) {
+ String token = st.nextToken();
+ if ("*".equals(token)) {
+ return new ResolvedImportPackageFile(_sourcePath,
+ packageOrClassPrefix.substring(0, packageOrClassPrefix.length() - 1));
+ }
+ else {
+ packageOrClassPrefix.append(token);
+ packageOrClassPrefix.append('.');
+ File classFile = new File(_sourcePath, token + ".java");
+ //System.err.println(" looking for file " + classFile);
+ if (classFile.exists()) {
+ StringBuffer innerClassName = new StringBuffer();
+ while (st.hasMoreTokens()) {
+ token = st.nextToken();
+ if (innerClassName.length() > 0) {
+ innerClassName.append('.');
+ }
+ innerClassName.append(token);
+ }
+ return new ResolvedImportClassFile(classFile, innerClassName.toString(), token, importSpecifier);
+ }
+ else {
+ _sourcePath = new File(_sourcePath, token);
+ }
+ }
+ }
+ if (st.hasMoreTokens()) {
+ if (packageOrClassPrefix.length() > longestUnlocatablePrefix.length()) {
+ longestUnlocatablePrefix = packageOrClassPrefix.toString();
+ }
+ }
+ }
+
+ if (longestUnlocatablePrefix.length() > 0) {
+ unlocatablePrefixes.add(longestUnlocatablePrefix);
+ }
+
+ return null;
+ }
+
+ private Map resolvedImportCache = new HashMap();
+
+ private ResolvedImport getResolvedImport(String importSpecifier)
+ {
+ ResolvedImport result
+ = (ResolvedImport)resolvedImportCache.get(importSpecifier);
+ if (null == result) {
+ result = resolveImport(importSpecifier);
+ resolvedImportCache.put(importSpecifier, result);
+ }
+ return result;
+ }
+
+ public String resolveClassName(String className, ClassDocImpl context)
+ {
+ Iterator it = context.getImportSpecifierList().iterator();
+ while (it.hasNext()) {
+ String importSpecifier = (String)it.next();
+ ResolvedImport resolvedImport = getResolvedImport(importSpecifier);
+ String resolvedScheduledClassName = resolvedImport.match(className);
+
+ if (null != resolvedScheduledClassName) {
+ return resolvedScheduledClassName;
+ }
+ }
+ return className;
+ }
+
+ public ClassDoc findScheduledClassFile(String scheduledClassName,
+ ClassDoc scheduledClassContext)
+ throws ParseException, IOException
+ {
+ String resolvedScheduledClassName = null;
+
+ if (scheduledClassContext instanceof ClassDocImpl) {
+
+ //((ClassDocImpl)scheduledClassContext).resolveReferencedName(scheduledClassName);
+ Iterator it = ((ClassDocImpl)scheduledClassContext).getImportSpecifierList().iterator();
+ while (it.hasNext()) {
+ String importSpecifier = (String)it.next();
+ ResolvedImport resolvedImport = getResolvedImport(importSpecifier);
+ //System.err.println(" looking in import '" + resolvedImport + "'");
+ resolvedScheduledClassName = resolvedImport.match(scheduledClassName);
+ if (null != resolvedScheduledClassName) {
+ ClassDoc result = resolvedImport.tryFetch(scheduledClassName);
+ if (null != result) {
+ return result;
+ }
+ else {
+ if (!inaccessibleReportedSet.contains(scheduledClassName)) {
+ inaccessibleReportedSet.add(scheduledClassName);
+ printWarning("Error while loading class " + scheduledClassName);
+ }
+ // FIXME: output resolved class name here
+ return null;
+ }
+ }
+ }
+ }
+ else {
+ System.err.println("findScheduledClassFile for '" + scheduledClassName + "' in proxy for " + scheduledClassContext);
+ }
+
+ // interpret as fully qualified name on file system
+
+ ResolvedImport fqImport = resolveImportFileSystem(scheduledClassName);
+ if (null != fqImport && fqImport instanceof ResolvedImportClassFile) {
+ return fqImport.tryFetch(((ResolvedImportClassFile)fqImport).getName());
+ }
+
+ // use reflection, assume fully qualified class name
+
+ if (!unlocatableReflectedClassNames.contains(scheduledClassName)) {
+ if (Main.getInstance().isReflectionEnabled()) {
+ try {
+ Class clazz = Class.forName(scheduledClassName);
+ printWarning("Cannot locate class " + scheduledClassName + " on file system, falling back to reflection.");
+ ClassDoc result = new ClassDocReflectedImpl(clazz);
+ return result;
+ }
+ catch (Throwable ignore) {
+ unlocatableReflectedClassNames.add(scheduledClassName);
+ }
+ }
+ else {
+ unlocatableReflectedClassNames.add(scheduledClassName);
+ }
+ }
+
+ if (null == resolvedScheduledClassName) {
+ resolvedScheduledClassName = scheduledClassName;
+ }
+ if (!unlocatableReportedSet.contains(resolvedScheduledClassName)) {
+ unlocatableReportedSet.add(resolvedScheduledClassName);
+ printWarning("Cannot locate class " + resolvedScheduledClassName + " referenced in class " + scheduledClassContext.qualifiedName());
+ }
+ return null;
+ }
+
+ private Set unlocatableReflectedClassNames = new HashSet();
+
+ public static boolean recursiveClasses = false;
+
+ public void addSpecifiedPackageName(String packageName) {
+ specifiedPackageNames.add(packageName);
+ }
+
+ public void addSpecifiedSourceFile(File sourceFile) {
+ specifiedSourceFiles.add(sourceFile);
+ }
+
+ public boolean hasSpecifiedPackagesOrClasses() {
+ return !specifiedPackageNames.isEmpty()
+ || !specifiedSourceFiles.isEmpty();
+ }
+
+ public void setOptions(String[][] customOptionArr) {
+ this.customOptionArr = customOptionArr;
+ }
+
+ public void setSourcePath(List sourcePath) {
+ this.sourcePath = sourcePath;
+ }
+
+ public void finalize() throws Throwable {
+ super.finalize();
+ }
+
+ public void flush()
+ {
+ try {
+ rawCommentCache.close();
+ }
+ catch (IOException e) {
+ printError("Cannot close raw comment cache");
+ }
+
+ rawCommentCache = null;
+ customOptionArr = null;
+ specifiedPackageNames = null;
+ classesList = null;
+ classDocMap = null;
+ packageDocMap = null;
+ classes = null;
+ specifiedClasses = null;
+ specifiedPackages = null;
+ scheduledClasses = null;
+ sourcePath = null;
+ parser = null;
+ unlocatableReportedSet = null;
+ inaccessibleReportedSet = null;
+ }
+
+ public void setSourceEncoding(String sourceEncoding)
+ {
+ this.sourceEncoding = sourceEncoding;
+ }
+
+ public RootDocImpl()
+ {
+ super(null);
+ }
+
+ public static String readHtmlBody(File file)
+ throws IOException
+ {
+ FileReader fr=new FileReader(file);
+ long size = file.length();
+ char[] packageDocBuf=new char[(int)(size)];
+ int index = 0;
+ int i = fr.read(packageDocBuf, index, (int)size);
+ while (i > 0) {
+ index += i;
+ size -= i;
+ i = fr.read(packageDocBuf, index, (int)size);
+ }
+ fr.close();
+
+ // We only need the part between the begin and end body tag.
+ String html = new String(packageDocBuf);
+ int start = html.indexOf("<body");
+ if (start == -1)
+ start = html.indexOf("<BODY");
+ int end = html.indexOf("</body>");
+ if (end == -1)
+ end = html.indexOf("</BODY>");
+ if (start != -1 && end != -1) {
+ // Start is end of body tag.
+ start = html.indexOf('>', start) + 1;
+ if (start != -1 && start < end)
+ html = html.substring(start, end);
+ }
+ return html.trim();
+ }
+
+ public Parser getParser()
+ {
+ return parser;
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/SeeTagImpl.java b/tools/gnu/classpath/tools/gjdoc/SeeTagImpl.java
new file mode 100644
index 000000000..f126c21ae
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/SeeTagImpl.java
@@ -0,0 +1,198 @@
+/* gnu.classpath.tools.gjdoc.SeeTagImpl
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import com.sun.javadoc.*;
+import java.util.*;
+import java.text.*;
+
+public class SeeTagImpl extends AbstractTagImpl implements SeeTag {
+
+ protected String reference;
+ private String referencedClassName;
+ private String referencedMemberName;
+ private ClassDoc referencedClass;
+ private MemberDoc referencedMember;
+ private PackageDoc referencedPackage;
+ private String label;
+ private ClassDocImpl contextClass;
+
+ public SeeTagImpl(String text, ClassDocImpl contextClass) {
+ super(text);
+ this.contextClass=contextClass;
+ }
+
+ public void resolve() {
+
+ super.resolve();
+
+ text = text.trim();
+
+ if (text.startsWith("<") || text.startsWith("\"")) {
+ label = text;
+ return;
+ }
+
+ int labelNdx=text.indexOf(';');
+ if (labelNdx>=0) {
+ label="";
+ return;
+ }
+
+ for (int i=0; i<text.length(); ++i) {
+ if (" \t\r\n".indexOf(text.charAt(i)) >= 0) {
+ labelNdx = i;
+ break;
+ }
+ }
+
+ int openParenNdx = text.indexOf('(');
+ if (openParenNdx >= 0 && openParenNdx < labelNdx) {
+ labelNdx=text.indexOf(')', openParenNdx);
+ if (labelNdx >= 0) {
+ ++ labelNdx;
+ }
+ }
+
+ if (labelNdx<0 || labelNdx>=text.length()) {
+ reference=text.trim();
+ label="";
+ }
+ else {
+ reference=text.substring(0,labelNdx).trim();
+ label=text.substring(labelNdx).trim();
+ }
+
+ int mspecNdx=reference.indexOf('#');
+ String referencedFqName;
+ if (mspecNdx<0) {
+ referencedFqName=reference;
+ }
+ else {
+ referencedFqName=reference.substring(0,mspecNdx);
+ referencedMemberName=reference.substring(mspecNdx+1);
+ }
+
+ // the following is in contradiction to the api docs, but
+ // conform to sun javadoc: return fully qualified classname
+ // with referencedClassName().
+ if (referencedFqName.trim().length()>0) {
+ referencedClassName=referencedFqName;
+ if (contextClass==null)
+ referencedClass=Main.getRootDoc().classNamed(referencedFqName);
+ else
+ referencedClass=contextClass.findClass(referencedFqName);
+ }
+ else {
+ referencedClassName="";
+ referencedClass=contextClass;
+ }
+
+ if (referencedClass==null) {
+ referencedClass = Main.getRootDoc().classNamed("java.lang." + referencedFqName);
+ }
+
+ if (referencedClass!=null && !referencedClass.isIncluded()) referencedClass=null;
+
+ if (referencedClass!=null) {
+ referencedPackage=referencedClass.containingPackage();
+ referencedClassName=referencedClass.qualifiedName();
+
+ if (referencedMemberName!=null) {
+
+ if (referencedMemberName.indexOf('(')<0) {
+ referencedMember=((ClassDocImpl)referencedClass).findFieldRec(referencedMemberName);
+ if (null == referencedMember) {
+ MethodDoc[] methods = ((ClassDocImpl)referencedClass).methods();
+ for (int i=0; i<methods.length; ++i) {
+ if (methods[i].name().equals(referencedMemberName)) {
+ if (null == referencedMember) {
+ referencedMember = methods[i];
+ }
+ else {
+ referencedClass = null;
+ referencedMember = null;
+ //print warning here
+ break;
+ }
+ }
+ }
+ }
+ else {
+ referencedClass = referencedMember.containingClass();
+ }
+ }
+ else {
+ referencedMember=((ClassDocImpl)referencedClass).findExecutableRec(referencedMemberName);
+ if (referencedMember==null) {
+ //System.err.println("cannot find member for '"+referencedMemberName+"'");
+ referencedClass = null;
+ }
+ }
+ }
+ }
+ /*
+ else {
+ System.err.println("class not found: '"+referencedFqName + "' in context class " + contextClass + " in " + this);
+ }
+ */
+ }
+
+ public ClassDoc referencedClass() {
+ return referencedClass;
+ }
+
+ public String referencedClassName() {
+ return referencedClassName;
+ }
+
+ public MemberDoc referencedMember() {
+ return referencedMember;
+ }
+
+ public String referencedMemberName() {
+ return referencedMemberName;
+ }
+
+ public PackageDoc referencedPackage() {
+ return referencedPackage;
+ }
+
+ public String label() {
+ return label;
+ }
+
+ public String kind() {
+ return "@see";
+ }
+
+ public String name() {
+ return "@see";
+ }
+
+ public Tag[] firstSentenceTags() {
+ return inlineTags();
+ }
+
+ public Tag[] inlineTags() {
+ return new Tag[]{new TextTagImpl(referencedClassName)};
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/SerialFieldTagImpl.java b/tools/gnu/classpath/tools/gjdoc/SerialFieldTagImpl.java
new file mode 100644
index 000000000..145161099
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/SerialFieldTagImpl.java
@@ -0,0 +1,111 @@
+/* gnu.classpath.tools.gjdoc.SerialFieldTagImpl
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import com.sun.javadoc.*;
+import java.util.*;
+import java.text.*;
+
+public class SerialFieldTagImpl extends AbstractTagImpl implements SerialFieldTag {
+
+ private String fieldName;
+ private String fieldType;
+ private String description;
+ private ClassDoc fieldTypeDoc;
+ private ClassDocImpl contextClass;
+
+ public SerialFieldTagImpl(String text,
+ ClassDocImpl contextClass,
+ MemberDocImpl contextMember) {
+ super(text);
+ this.contextClass=contextClass;
+
+ if (fieldName==null)
+ fieldName="";
+ if (fieldType==null)
+ fieldType="";
+ if (description==null)
+ description="";
+
+ int state=1;
+ char[] textArr=text.toCharArray();
+ for (int i=0; i<textArr.length; ++i) {
+ char c=textArr[i];
+ switch (state) {
+ case 1:
+ if (Parser.isWhitespace(c)) state=2;
+ else fieldName+=c;
+ break;
+ case 2:
+ if (Parser.isWhitespace(c)) state=3;
+ else fieldType+=c;
+ break;
+ case 3:
+ description+=c;
+ break;
+ }
+ }
+
+ setBody(description, contextClass, contextMember);
+
+ }
+
+ public void resolve() {
+
+ super.resolve();
+ try {
+ Type type=contextClass.typeForString(fieldType);
+ this.fieldTypeDoc=type.asClassDoc();
+ } catch (ParseException e) {
+ System.err.println("FIXME: add try-catch to force compilation"
+ + e);
+ }
+ }
+
+ public ClassDoc fieldTypeDoc() {
+ return fieldTypeDoc;
+ }
+
+ public String fieldName() {
+ return fieldName;
+ }
+
+ public String fieldType() {
+ return fieldType;
+ }
+
+ public String description() {
+ return description;
+ }
+
+ public String kind() {
+ return "@serialField";
+ }
+
+ public int compareTo(Object o) {
+ if (o!=null && o instanceof SerialFieldTagImpl) {
+ return fieldName().compareTo(((SerialFieldTagImpl)o).fieldName());
+ }
+ else {
+ return 0;
+ }
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/SourcePositionImpl.java b/tools/gnu/classpath/tools/gjdoc/SourcePositionImpl.java
new file mode 100644
index 000000000..605d1321e
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/SourcePositionImpl.java
@@ -0,0 +1,60 @@
+/* gnu.classpath.tools.gjdoc.SourcePositionImpl
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import com.sun.javadoc.SourcePosition;
+
+import java.io.File;
+
+public class SourcePositionImpl
+ implements SourcePosition
+{
+ private File file;
+ private int line;
+ private int column;
+
+ public SourcePositionImpl(File file, int line, int column)
+ {
+ this.file = file;
+ this.line = line;
+ this.column = column;
+ }
+
+ public File file()
+ {
+ return this.file;
+ }
+
+ public int line()
+ {
+ return this.line;
+ }
+
+ public int column()
+ {
+ return this.column;
+ }
+
+ public String toString()
+ {
+ return this.file + ":" + this.line;
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/TagContainer.java b/tools/gnu/classpath/tools/gjdoc/TagContainer.java
new file mode 100644
index 000000000..597d73b91
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/TagContainer.java
@@ -0,0 +1,35 @@
+/* gnu.classpath.tools.gjdoc.TagContainer
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import com.sun.javadoc.Tag;
+
+import java.util.Map;
+
+/**
+ * Implemented by Doclet API classes that are associated with tags.
+ */
+interface TagContainer
+{
+ public Tag[] firstSentenceTags();
+ public Tag[] inlineTags();
+ public Map getTagMap();
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/TagImpl.java b/tools/gnu/classpath/tools/gjdoc/TagImpl.java
new file mode 100644
index 000000000..320ccfd20
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/TagImpl.java
@@ -0,0 +1,43 @@
+/* gnu.classpath.tools.gjdoc.TagImpl
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import com.sun.javadoc.*;
+import java.util.*;
+
+public class TagImpl extends AbstractTagImpl implements Tag {
+
+ private String kind;
+ private String name;
+
+ TagImpl(String name, String text, ClassDocImpl contextClass, MemberDocImpl contextMember) {
+ super(text);
+ this.kind=name;
+ this.name=name;
+
+ setBody(text, contextClass, contextMember);
+ }
+
+ public String kind() { return kind; }
+ public String name() { return name; }
+ public String toString() { return kind()+":"+text(); }
+
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/TemporaryStore.java b/tools/gnu/classpath/tools/gjdoc/TemporaryStore.java
new file mode 100644
index 000000000..eb3417d42
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/TemporaryStore.java
@@ -0,0 +1,115 @@
+/* gnu.classpath.tools.gjdoc.TemporaryStore
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+/**
+ * Useful for passing big objects that are no longer needed by the
+ * calling method, reducing memory usage. <p/>
+ *
+ * Consider the following problem:
+ * <pre>
+ * public class A {
+ * public static void foo() {
+ * long[] hugeArray = new long[1000000]; // takes around 8 MB
+ * // ... fill hugeArray with some information ...
+ * bar(hugeArray);
+ * // ... hugeArray is no more required at this point
+ * }
+ * public static void bar(long[] arr) {
+ * // ... process contents of arr ...
+ * arr = null;
+ * System.gc(); // NOTE: will not collect arr!
+ * // ... do something memory-intensive where arr is not needed
+ * }
+ * }
+ * </pre>
+ *
+ * In method <code>bar()</code>, the array cannot be garbage
+ * collected because the local variable <code>hugeArray</code> in
+ * method <code>foo()</code> still holds a reference to the array.
+ * <p/>
+ *
+ * When calling <code>bar(new long[1000000]);</code> in
+ * <code>arr</code> the array <i>can</i> be collected in
+ * <code>bar()</code>, but that way it can't be initialized in
+ * <code>foo()</code>. A local variable is needed for
+ * initialization, but the variable can't be cleared before it is
+ * passed to <code>bar()</code>! <p/>
+ *
+ * <code>TemporaryStore</code> is the solution for this
+ * dilemma. The modified method <code>foo()</code> which uses a
+ * <code>TemporaryStore</code> object would look like this:
+ *
+ * <pre>
+ * public static void foo() {
+ * long[] hugeArray = new long[1000000]; // takes around 7 MB
+ * // ... fill hugeArray with some very important information ...
+ * TemporaryStore tstore = new TemporaryStore(hugeArray);
+ * hugeArray = null;
+ * bar((long[])tstore.getAndClear());
+ * }
+ * </pre>
+ *
+ * When control flow is transferred to <code>bar()</code>,
+ * <code>foo()</code> will hold no more references to the array
+ * and so it can be garbage collected in <code>bar()</code>.
+ *
+ */
+public class TemporaryStore {
+
+ private Object storedObject;
+
+ /**
+ * Temporarily store the given object for passing it to a
+ * different method. <p/>
+ *
+ * The method constructing a new TemporaryStore object should
+ * clear all other references to the stored object, so that
+ * this TemporaryStore is the only object referencing it.
+ *
+ * @param storedObject the object to store temporarily
+ *
+ */
+ public TemporaryStore(Object storedObject) {
+ this.storedObject = storedObject;
+ }
+
+ /**
+ * Return the stored object after clearing the reference to it.
+ * <p/>
+ *
+ * When the user of this class followed the recommendations in
+ * the documentation of @link{TemporaryStore(Object)}, the
+ * returned reference will be the only reference to the stored
+ * object after this method returns. If the returned reference
+ * is passed in a method call, the called method will hold the
+ * only reference to the stored object and can release it by
+ * nulling the corresponding parameter.
+ *
+ * @return the object which was passed to the constructor.
+ *
+ */
+ public Object getAndClear() {
+ Object rc = this.storedObject;
+ this.storedObject = null;
+ return rc;
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/TextTagImpl.java b/tools/gnu/classpath/tools/gjdoc/TextTagImpl.java
new file mode 100644
index 000000000..6d7ee820c
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/TextTagImpl.java
@@ -0,0 +1,39 @@
+/* gnu.classpath.tools.gjdoc.TextTagImpl
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import com.sun.javadoc.*;
+import java.util.*;
+
+public class TextTagImpl extends AbstractTagImpl implements Tag {
+
+ TextTagImpl(String text) {
+ super(text);
+ }
+
+ public Tag[] firstSentenceTags() { return new Tag[]{this}; }
+ public Tag[] inlineTags() { return new Tag[]{this}; }
+ public String kind() { return "Text"; }
+
+ public String toString() { return "TextTagImpl{text=" + text + "}"; }
+
+ public String getText() { return text; }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/ThrowsTagImpl.java b/tools/gnu/classpath/tools/gjdoc/ThrowsTagImpl.java
new file mode 100644
index 000000000..df0091de0
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/ThrowsTagImpl.java
@@ -0,0 +1,88 @@
+/* gnu.classpath.tools.gjdoc.ThrowsTagImpl
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import com.sun.javadoc.*;
+import java.util.*;
+import java.text.*;
+
+public class ThrowsTagImpl extends AbstractTagImpl implements ThrowsTag {
+
+ private ClassDoc exception;
+ private String exceptionName;
+ private String exceptionComment;
+
+ public ThrowsTagImpl(String text,
+ ClassDocImpl contextClass,
+ MemberDocImpl contextMember) {
+ super(text);
+
+ char[] textarr=text.toCharArray();
+ int i=0;
+ for (; i<textarr.length; ++i) {
+ if (!Parser.isWhitespace(textarr[i])) break;
+ }
+ for (; i<textarr.length; ++i) {
+ if (Parser.isWhitespace(textarr[i])) {
+ this.exceptionName=new String(textarr,0,i).trim();
+ this.exceptionComment=new String(textarr,i,textarr.length-i).trim();
+ break;
+ }
+ }
+ if (null != exceptionName) {
+ if (contextClass==null) {
+ this.exception=Main.getRootDoc().classNamed(exceptionName);
+ }
+ else {
+ this.exception=contextClass.findClass(exceptionName);
+ }
+ if (exception!=null)
+ this.exceptionName=exception.qualifiedName();
+ else {
+ if (text.trim().startsWith("<")) {
+ Main.getRootDoc().printWarning("Expected exception name but got '"+text+"' in class "+contextClass.getClassName());
+ }
+ }
+ }
+ else {
+ Main.getRootDoc().printWarning("@throws tag in comment for " + contextClass.qualifiedName() + "." + contextMember.name() + " doesn't specify an exception.");
+ }
+ if (this.exceptionComment!=null) {
+ setBody(this.exceptionComment, contextClass, contextMember);
+ }
+ }
+
+ public ClassDoc exception() {
+ return exception;
+ }
+
+ public String exceptionName() {
+ return exceptionName;
+ }
+
+ public String exceptionComment() {
+ return exceptionComment;
+ }
+
+ public String kind() {
+ return "@throws";
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/Timer.java b/tools/gnu/classpath/tools/gjdoc/Timer.java
new file mode 100644
index 000000000..d1d832ce5
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/Timer.java
@@ -0,0 +1,71 @@
+/* gnu.classpath.tools.gjdoc.Timer
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import java.io.*;
+import java.text.*;
+
+public class Timer {
+
+ private static long startTime, beforeDocletTime, stopTime, memoryUsed, maxDriverHeap=-1, maxDocletHeap=-1;
+
+ static void shutdown() {
+ try{
+ if (stopTime==0) return;
+ PrintWriter pw=new PrintWriter(new FileWriter("timer.out"));
+ pw.println("Preparation (driver) took "+(((double)(beforeDocletTime-startTime))/1000.)+" s");
+ pw.println("Generation (doclet) took "+(((double)(stopTime-beforeDocletTime))/1000.)+" s");
+ pw.println("");
+ pw.println("Memory used for documentation tree: "+(memoryUsed/(1024*1024))+" MB");
+ pw.println("Max. heap used for driver: "+((maxDriverHeap<0)?"N/A":((maxDriverHeap/(1024*1024))+" MB")));
+ pw.println("Max. heap used for doclet: "+((maxDocletHeap<0)?"N/A":((maxDocletHeap/(1024*1024))+" MB")));
+ pw.println("");
+ pw.println("TOTAL TIME: "+(((double)(stopTime-startTime))/1000.)+" s");
+ pw.println("TOTAL HEAP: "+((maxDocletHeap<0)?"N/A":(Math.max(maxDocletHeap,maxDriverHeap)/(1024*1024))+" MB"));
+ pw.close();
+ }
+ catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void setStartTime() {
+ Timer.startTime=System.currentTimeMillis();
+ }
+
+ public static void setStopTime() {
+ Timer.stopTime=System.currentTimeMillis();
+ }
+
+ public static void setBeforeDocletTime() {
+ Timer.beforeDocletTime=System.currentTimeMillis();
+ Timer.memoryUsed=Runtime.getRuntime().totalMemory()-Runtime.getRuntime().freeMemory();
+ }
+
+ public static void setMaxDocletHeap(long maximumHeap) {
+ Timer.maxDocletHeap=maximumHeap;
+ }
+
+ public static void setMaxDriverHeap(long maximumHeap) {
+ Timer.maxDriverHeap=maximumHeap;
+ }
+
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/TimerDoclet.java b/tools/gnu/classpath/tools/gjdoc/TimerDoclet.java
new file mode 100644
index 000000000..68d2c4d8b
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/TimerDoclet.java
@@ -0,0 +1,87 @@
+/* gnu.classpath.tools.gjdoc.TimerDoclet
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import com.sun.javadoc.*;
+
+public class TimerDoclet {
+
+ private static Object doclet = null;
+
+ private static long maximumHeap = -1;
+
+ private static Thread memThread;
+
+ private static boolean runMemThread = true;
+
+ private static void init() throws Exception {
+ if (doclet==null) {
+ doclet=Class.forName("com.sun.tools.doclets.standard.Standard").newInstance();
+ memThread=new Thread() {
+
+ public void run() {
+ while (runMemThread) {
+ synchronized (TimerDoclet.class) {
+ TimerDoclet.maximumHeap=Math.max(TimerDoclet.maximumHeap,
+ Runtime.getRuntime().totalMemory()-Runtime.getRuntime().freeMemory());
+ }
+ try { Thread.sleep(50); } catch (Exception e) {}
+ }
+ }
+ };
+ //memThread.start();
+ }
+ }
+
+ public static boolean validOptions(String[][] options, DocErrorReporter reporter)
+ throws Exception {
+
+ init();
+ return ((Boolean)doclet.getClass().getMethod("validOptions", new Class[]{String[][].class, DocErrorReporter.class}).invoke(null, new Object[]{options, reporter})).booleanValue();
+ //return false; //doclet.validOptions(options, reporter);
+ }
+
+ public static int optionLength(String option) throws Exception {
+ init();
+ return ((Integer)doclet.getClass().getMethod("optionLength", new Class[]{String.class}).invoke(null, new Object[]{option})).intValue();
+ }
+
+ public static boolean start(RootDoc root) throws Exception {
+ Timer.setBeforeDocletTime();
+ synchronized (TimerDoclet.class) {
+ Timer.setMaxDriverHeap(maximumHeap);
+ maximumHeap=-1;
+ }
+ //new com.sun.tools.doclets.standard.Standard().validOptions(root.options(), root);
+ //new com.sun.tools.doclets.standard.Standard().start(root);
+
+ if (validOptions(root.options(), root)) {
+ doclet.getClass().getMethod("start", new Class[]{RootDoc.class}).invoke(null, new Object[]{root});
+ }
+ runMemThread=false;
+ Timer.setStopTime();
+ synchronized (TimerDoclet.class) {
+ Timer.setMaxDocletHeap(maximumHeap);
+ }
+ Timer.shutdown();
+ return true;
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/TypeImpl.java b/tools/gnu/classpath/tools/gjdoc/TypeImpl.java
new file mode 100644
index 000000000..a66a85e89
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/TypeImpl.java
@@ -0,0 +1,92 @@
+/* gnu.classpath.tools.gjdoc.TypeImpl
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import com.sun.javadoc.*;
+import java.util.Collections;
+import java.util.Set;
+import java.util.HashSet;
+
+public class TypeImpl implements Type, WritableType {
+
+ private String packageName;
+ private String typeName;
+ private String dimension;
+
+ TypeImpl(String packageName, String typeName, String dimension) {
+ this.packageName=packageName;
+ this.typeName=typeName;
+ this.dimension=dimension;
+
+ if (typeName.indexOf('[') >= 0 || typeName.indexOf(']') >= 0) {
+ throw new RuntimeException("Typename must not contain dimension information.");
+ }
+ }
+
+ public ClassDoc asClassDoc() {
+
+ if (this instanceof ClassDoc)
+ return ((ClassDocImpl)(ClassDoc)this).getBaseClassDoc();
+ else
+ return null;
+ }
+
+ public String typeName() { return typeName; }
+
+ public String qualifiedTypeName() { return (packageName!=null)?(packageName+"."+typeName):(typeName); }
+
+ public String dimension() { return dimension; }
+ public void setDimension(String dimension) { this.dimension = dimension; }
+
+ public String toString() { return "Type{"+qualifiedTypeName()+dimension()+"}"; }
+
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public boolean isPrimitive()
+ {
+ return null == packageName && primitiveNames.contains(typeName);
+ }
+
+ private static final Set primitiveNames;
+ static {
+ Set _primitiveNames = new HashSet();
+ _primitiveNames.add("boolean");
+ _primitiveNames.add("char");
+ _primitiveNames.add("byte");
+ _primitiveNames.add("short");
+ _primitiveNames.add("int");
+ _primitiveNames.add("long");
+ _primitiveNames.add("float");
+ _primitiveNames.add("double");
+ primitiveNames = Collections.unmodifiableSet(_primitiveNames);
+ }
+
+ public TypeVariable asTypeVariable()
+ {
+ if (this instanceof TypeVariable)
+ return (TypeVariable) this;
+ else
+ return null;
+ }
+
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/TypeVariableImpl.java b/tools/gnu/classpath/tools/gjdoc/TypeVariableImpl.java
new file mode 100644
index 000000000..4524ab169
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/TypeVariableImpl.java
@@ -0,0 +1,91 @@
+/* gnu.classpath.tools.gjdoc.TypeVariableImpl
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import com.sun.javadoc.ProgramElementDoc;
+import com.sun.javadoc.Type;
+import com.sun.javadoc.TypeVariable;
+
+import java.util.List;
+
+public class TypeVariableImpl
+ extends TypeImpl
+ implements TypeVariable, WritableType
+{
+
+ /**
+ * The bounds of this particular type variable.
+ */
+ Type[] bounds;
+
+ /**
+ * The owning program element of this type variable.
+ */
+ ProgramElementDoc owner;
+
+ /**
+ * Constructs a new type variable with the supplied name and owner.
+ *
+ * @param packageName the name of the package containing the type variable.
+ * @param typeName the name of the type variable.
+ * @param dimension the dimensions of the type variable (always "").
+ * @param owner the owning program element of the type variable.
+ */
+ TypeVariableImpl(String packageName, String typeName, String dimension,
+ ProgramElementDoc owner)
+ {
+ super(packageName, typeName, dimension);
+ this.owner = owner;
+ }
+
+ /**
+ * Set the bounds to the contents of the supplied list.
+ *
+ * @param parsedBounds a list of type bounds.
+ */
+ void setBounds(List parsedBounds)
+ {
+ bounds = (Type[]) parsedBounds.toArray(new Type[parsedBounds.size()]);
+ }
+
+ /**
+ * Returns the bounds of this type variable.
+ *
+ * @return the bounds of the variable.
+ */
+ public Type[] bounds()
+ {
+ return bounds;
+ }
+
+ /**
+ * Returns the owning program element for this type variable.
+ *
+ * @return the owning program element, whether a class, interface,
+ * constructor or method.
+ */
+ public ProgramElementDoc owner()
+ {
+ return owner;
+ }
+
+
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/ValueTagImpl.java b/tools/gnu/classpath/tools/gjdoc/ValueTagImpl.java
new file mode 100644
index 000000000..8f0ba79e6
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/ValueTagImpl.java
@@ -0,0 +1,48 @@
+/* gnu.classpath.tools.gjdoc.ValueTagImpl
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+import com.sun.javadoc.*;
+import java.util.*;
+import java.text.*;
+
+public class ValueTagImpl extends SeeTagImpl {
+
+ public ValueTagImpl(String _text, ClassDocImpl contextClass) {
+ super(_text, contextClass);
+ }
+
+ public String name() { return "@value"; }
+
+ public Tag[] firstSentenceTags() {
+ return inlineTags();
+ }
+
+ public Tag[] inlineTags() {
+ if (null != reference && reference.trim().length() > 0) {
+ return new Tag[] { new TextTagImpl(reference) };
+ }
+ else {
+ return new Tag[0];
+ }
+ }
+
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/WritableType.java b/tools/gnu/classpath/tools/gjdoc/WritableType.java
new file mode 100644
index 000000000..6293602b8
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/WritableType.java
@@ -0,0 +1,27 @@
+/* gnu.classpath.tools.gjdoc.WritableType
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc;
+
+public interface WritableType extends Cloneable {
+
+ public void setDimension(String dimension);
+ public Object clone() throws CloneNotSupportedException;
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/.cvsignore b/tools/gnu/classpath/tools/gjdoc/expr/.cvsignore
new file mode 100644
index 000000000..639b87828
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/.cvsignore
@@ -0,0 +1,8 @@
+.deps
+.dirstamp
+.libs
+*.lo
+JavaLexer.java
+JavaRecognizer.java
+JavaTokenTypes.java
+JavaTokenTypes.txt
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/AdditionExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/AdditionExpression.java
new file mode 100644
index 000000000..bf9e3ff1c
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/AdditionExpression.java
@@ -0,0 +1,69 @@
+/* gnu.classpath.tools.gjdoc.expr.AdditionExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class AdditionExpression
+ extends BinaryComputationExpression
+{
+ public AdditionExpression(Expression left, Expression right)
+ {
+ super(left, right);
+ }
+
+ protected double compute(double leftValue, double rightValue)
+ {
+ return leftValue + rightValue;
+ }
+
+ protected float compute(float leftValue, float rightValue)
+ {
+ return leftValue + rightValue;
+ }
+
+ protected long compute(long leftValue, long rightValue)
+ {
+ return leftValue + rightValue;
+ }
+
+ protected int compute(int leftValue, int rightValue)
+ {
+ return leftValue + rightValue;
+ }
+
+ public ConstantExpression evaluate(Context context)
+ throws IllegalExpressionException
+ {
+ ConstantExpression leftValue = left.evaluate(context);
+ ConstantExpression rightValue = right.evaluate(context);
+
+ if (Type.STRING == leftValue.getType()
+ || Type.STRING == rightValue.getType()) {
+
+ return new ConstantString(leftValue.asObject().toString()
+ + rightValue.asObject().toString());
+ }
+ else {
+ return super.evaluate(leftValue, rightValue);
+ }
+
+ }
+
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/AndExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/AndExpression.java
new file mode 100644
index 000000000..9e9e13c99
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/AndExpression.java
@@ -0,0 +1,40 @@
+/* gnu.classpath.tools.gjdoc.expr.AndExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class AndExpression
+ extends BinaryBitwiseExpression
+{
+ public AndExpression(Expression left, Expression right)
+ {
+ super(left, right);
+ }
+
+ protected long compute(long leftValue, long rightValue)
+ {
+ return leftValue & rightValue;
+ }
+
+ protected int compute(int leftValue, int rightValue)
+ {
+ return leftValue & rightValue;
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/BinaryBitwiseExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/BinaryBitwiseExpression.java
new file mode 100644
index 000000000..4b0a993e5
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/BinaryBitwiseExpression.java
@@ -0,0 +1,51 @@
+/* gnu.classpath.tools.gjdoc.expr.BinaryBitwiseExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+abstract class BinaryBitwiseExpression
+ extends BinaryExpression
+{
+ protected BinaryBitwiseExpression(Expression left, Expression right)
+ {
+ super(left, right);
+ }
+
+ public ConstantExpression evaluate(Context context)
+ throws IllegalExpressionException
+ {
+ ConstantExpression leftValue = left.evaluate(context);
+ ConstantExpression rightValue = right.evaluate(context);
+
+ if (Type.LONG == leftValue.getType()
+ || Type.LONG == rightValue.getType()) {
+
+ return new ConstantLong(compute(leftValue.asNumber().longValue(),
+ rightValue.asNumber().longValue()));
+ }
+ else {
+ return new ConstantInteger(compute(leftValue.asNumber().intValue(),
+ rightValue.asNumber().intValue()));
+ }
+ }
+
+ protected abstract long compute(long leftValue, long rightValue);
+ protected abstract int compute(int leftValue, int rightValue);
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/BinaryComputationExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/BinaryComputationExpression.java
new file mode 100644
index 000000000..97cdf221e
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/BinaryComputationExpression.java
@@ -0,0 +1,75 @@
+/* gnu.classpath.tools.gjdoc.expr.BinaryComputationExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+abstract class BinaryComputationExpression
+ extends BinaryExpression
+{
+ protected BinaryComputationExpression(Expression left, Expression right)
+ {
+ super(left, right);
+ }
+
+ public ConstantExpression evaluate(Context context)
+ throws IllegalExpressionException
+ {
+ ConstantExpression leftValue = left.evaluate(context);
+ ConstantExpression rightValue = right.evaluate(context);
+
+ return evaluate(leftValue, rightValue);
+ }
+
+ protected ConstantExpression evaluate(ConstantExpression leftValue,
+ ConstantExpression rightValue)
+ throws IllegalExpressionException
+ {
+ if (Type.DOUBLE == leftValue.getType()
+ || Type.DOUBLE == rightValue.getType()) {
+
+ return new ConstantDouble(compute(leftValue.asNumber().doubleValue(),
+ rightValue.asNumber().doubleValue()));
+ }
+ else if (Type.FLOAT == leftValue.getType()
+ || Type.FLOAT == rightValue.getType()) {
+
+ return new ConstantFloat(compute(leftValue.asNumber().floatValue(),
+ rightValue.asNumber().floatValue()));
+ }
+ else if (Type.LONG == leftValue.getType()
+ || Type.LONG == rightValue.getType()) {
+
+ return new ConstantLong(compute(leftValue.asNumber().longValue(),
+ rightValue.asNumber().longValue()));
+ }
+ else if (leftValue.isNumber() && rightValue.isNumber()) {
+ return new ConstantInteger(compute(leftValue.asNumber().intValue(),
+ rightValue.asNumber().intValue()));
+ }
+ else {
+ throw new IllegalExpressionException("Operator ? cannot be applied to " + leftValue.getType() + "," + rightValue.getType());
+ }
+ }
+
+ protected abstract double compute(double leftValue, double rightValue);
+ protected abstract float compute(float leftValue, float rightValue);
+ protected abstract long compute(long leftValue, long rightValue);
+ protected abstract int compute(int leftValue, int rightValue);
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/BinaryEqualityExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/BinaryEqualityExpression.java
new file mode 100644
index 000000000..27fe2cf1f
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/BinaryEqualityExpression.java
@@ -0,0 +1,72 @@
+/* gnu.classpath.tools.gjdoc.expr.BinaryEqualityExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+abstract class BinaryEqualityExpression
+ extends BinaryExpression
+{
+ protected BinaryEqualityExpression(Expression left, Expression right)
+ {
+ super(left, right);
+ }
+
+ public ConstantExpression evaluate(Context context)
+ throws IllegalExpressionException
+ {
+ ConstantExpression leftValue = left.evaluate(context);
+ ConstantExpression rightValue = right.evaluate(context);
+
+ if (Type.DOUBLE == leftValue.getType()
+ || Type.DOUBLE == rightValue.getType()) {
+
+ return new ConstantBoolean(compute(leftValue.asNumber().doubleValue(),
+ rightValue.asNumber().doubleValue()));
+ }
+ else if (Type.FLOAT == leftValue.getType()
+ || Type.FLOAT == rightValue.getType()) {
+
+ return new ConstantBoolean(compute(leftValue.asNumber().floatValue(),
+ rightValue.asNumber().floatValue()));
+ }
+ else if (Type.LONG == leftValue.getType()
+ || Type.LONG == rightValue.getType()) {
+
+ return new ConstantBoolean(compute(leftValue.asNumber().longValue(),
+ rightValue.asNumber().longValue()));
+ }
+ else if (Type.BOOLEAN == leftValue.getType()
+ && Type.BOOLEAN == rightValue.getType()) {
+
+ return new ConstantBoolean(compute(((ConstantBoolean)leftValue).booleanValue(),
+ ((ConstantBoolean)rightValue).booleanValue()));
+ }
+ else {
+ return new ConstantBoolean(compute(leftValue.asNumber().intValue(),
+ rightValue.asNumber().intValue()));
+ }
+ }
+
+ protected abstract boolean compute(double leftValue, double rightValue);
+ protected abstract boolean compute(float leftValue, float rightValue);
+ protected abstract boolean compute(long leftValue, long rightValue);
+ protected abstract boolean compute(int leftValue, int rightValue);
+ protected abstract boolean compute(boolean leftValue, boolean rightValue);
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/BinaryExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/BinaryExpression.java
new file mode 100644
index 000000000..e44551d05
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/BinaryExpression.java
@@ -0,0 +1,34 @@
+/* gnu.classpath.tools.gjdoc.expr.BinaryExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+abstract class BinaryExpression
+ implements Expression
+{
+ protected Expression left;
+ protected Expression right;
+
+ protected BinaryExpression(Expression left, Expression right)
+ {
+ this.left = left;
+ this.right = right;
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/BinaryLogicalExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/BinaryLogicalExpression.java
new file mode 100644
index 000000000..00bbfccbc
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/BinaryLogicalExpression.java
@@ -0,0 +1,47 @@
+/* gnu.classpath.tools.gjdoc.expr.BinaryLogicalExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+abstract class BinaryLogicalExpression
+ extends BinaryExpression
+{
+ protected BinaryLogicalExpression(Expression left, Expression right)
+ {
+ super(left, right);
+ }
+
+ public ConstantExpression evaluate(Context context)
+ throws IllegalExpressionException
+ {
+ ConstantExpression leftValue = left.evaluate(context);
+ ConstantExpression rightValue = right.evaluate(context);
+
+ if (leftValue.getType() != Type.BOOLEAN || rightValue.getType() != Type.BOOLEAN) {
+ throw new IllegalExpressionException("logical expression expects boolean subexpressions");
+ }
+ else {
+ return new ConstantBoolean(compute(((ConstantBoolean)leftValue).booleanValue(),
+ ((ConstantBoolean)rightValue).booleanValue()));
+ }
+ }
+
+ protected abstract boolean compute(boolean leftValue, boolean rightValue);
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/BinaryRelationExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/BinaryRelationExpression.java
new file mode 100644
index 000000000..91c4441ca
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/BinaryRelationExpression.java
@@ -0,0 +1,65 @@
+/* gnu.classpath.tools.gjdoc.expr.BinaryRelationExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+abstract class BinaryRelationExpression
+ extends BinaryExpression
+{
+ protected BinaryRelationExpression(Expression left, Expression right)
+ {
+ super(left, right);
+ }
+
+ public ConstantExpression evaluate(Context context)
+ throws IllegalExpressionException
+ {
+ ConstantExpression leftValue = left.evaluate(context);
+ ConstantExpression rightValue = right.evaluate(context);
+
+ if (Type.DOUBLE == leftValue.getType()
+ || Type.DOUBLE == rightValue.getType()) {
+
+ return new ConstantBoolean(compute(leftValue.asNumber().doubleValue(),
+ rightValue.asNumber().doubleValue()));
+ }
+ else if (Type.FLOAT == leftValue.getType()
+ || Type.FLOAT == rightValue.getType()) {
+
+ return new ConstantBoolean(compute(leftValue.asNumber().floatValue(),
+ rightValue.asNumber().floatValue()));
+ }
+ else if (Type.LONG == leftValue.getType()
+ || Type.LONG == rightValue.getType()) {
+
+ return new ConstantBoolean(compute(leftValue.asNumber().longValue(),
+ rightValue.asNumber().longValue()));
+ }
+ else {
+ return new ConstantBoolean(compute(leftValue.asNumber().intValue(),
+ rightValue.asNumber().intValue()));
+ }
+ }
+
+ protected abstract boolean compute(double leftValue, double rightValue);
+ protected abstract boolean compute(float leftValue, float rightValue);
+ protected abstract boolean compute(long leftValue, long rightValue);
+ protected abstract boolean compute(int leftValue, int rightValue);
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/BinaryShiftExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/BinaryShiftExpression.java
new file mode 100644
index 000000000..a5eac4d98
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/BinaryShiftExpression.java
@@ -0,0 +1,49 @@
+/* gnu.classpath.tools.gjdoc.expr.BinaryShiftExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+abstract class BinaryShiftExpression
+ extends BinaryExpression
+{
+ protected BinaryShiftExpression(Expression left, Expression right)
+ {
+ super(left, right);
+ }
+
+ public ConstantExpression evaluate(Context context)
+ throws IllegalExpressionException
+ {
+ ConstantExpression leftValue = left.evaluate(context);
+ ConstantExpression rightValue = right.evaluate(context);
+
+ if (Type.LONG == leftValue.getType()) {
+ return new ConstantLong(compute(leftValue.asNumber().longValue(),
+ rightValue.asNumber().intValue()));
+ }
+ else {
+ return new ConstantInteger(compute(leftValue.asNumber().intValue(),
+ rightValue.asNumber().intValue()));
+ }
+ }
+
+ protected abstract long compute(long leftValue, int rightValue);
+ protected abstract int compute(int leftValue, int rightValue);
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/BitShiftRightExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/BitShiftRightExpression.java
new file mode 100644
index 000000000..503421ed4
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/BitShiftRightExpression.java
@@ -0,0 +1,40 @@
+/* gnu.classpath.tools.gjdoc.expr.BitShiftRightExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class BitShiftRightExpression
+ extends BinaryShiftExpression
+{
+ public BitShiftRightExpression(Expression left, Expression right)
+ {
+ super(left, right);
+ }
+
+ protected long compute(long leftValue, int rightValue)
+ {
+ return leftValue >>> rightValue;
+ }
+
+ protected int compute(int leftValue, int rightValue)
+ {
+ return leftValue >>> rightValue;
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/CircularExpressionException.java b/tools/gnu/classpath/tools/gjdoc/expr/CircularExpressionException.java
new file mode 100644
index 000000000..b745de41a
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/CircularExpressionException.java
@@ -0,0 +1,35 @@
+/* gnu.classpath.tools.gjdoc.expr.IllegalExpressionException
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+public class CircularExpressionException
+ extends IllegalExpressionException
+{
+ public CircularExpressionException(String message)
+ {
+ super(message);
+ }
+
+ public CircularExpressionException(Throwable cause)
+ {
+ super(cause);
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/ConditionalExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/ConditionalExpression.java
new file mode 100644
index 000000000..e4f86f657
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/ConditionalExpression.java
@@ -0,0 +1,57 @@
+/* gnu.classpath.tools.gjdoc.expr.ConditionalExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class ConditionalExpression
+ implements Expression
+{
+ private Expression condition;
+ private Expression ifTrue;
+ private Expression ifFalse;
+
+ ConditionalExpression(Expression condition, Expression ifTrue, Expression ifFalse)
+ {
+ this.condition = condition;
+ this.ifTrue = ifTrue;
+ this.ifFalse = ifFalse;
+ }
+
+ public ConstantExpression evaluate(Context context)
+ throws IllegalExpressionException
+ {
+ ConstantExpression conditionValue = condition.evaluate(context);
+ ConstantExpression ifTrueValue = ifTrue.evaluate(context);
+ ConstantExpression ifFalseValue = ifFalse.evaluate(context);
+
+ if (Type.BOOLEAN != conditionValue.getType()) {
+ throw new IllegalExpressionException("condition must be boolean");
+ }
+ else {
+ boolean cond = ((ConstantBoolean)conditionValue).booleanValue();
+ if (cond) {
+ return ifTrueValue;
+ }
+ else {
+ return ifFalseValue;
+ }
+ }
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/ConstantBoolean.java b/tools/gnu/classpath/tools/gjdoc/expr/ConstantBoolean.java
new file mode 100644
index 000000000..4ef75c642
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/ConstantBoolean.java
@@ -0,0 +1,67 @@
+/* gnu.classpath.tools.gjdoc.expr.ConstantBoolean
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class ConstantBoolean
+ extends ConstantExpression
+{
+ private boolean value;
+
+ public ConstantBoolean(String stringValue)
+ {
+ this.value = "true".equals(stringValue);
+ }
+
+ public ConstantBoolean(boolean booleanValue)
+ {
+ this.value = booleanValue;
+ }
+
+ public boolean booleanValue()
+ {
+ return value;
+ }
+
+ public Type getType()
+ {
+ return Type.BOOLEAN;
+ }
+
+ public Number asNumber()
+ {
+ return null;
+ }
+
+ public boolean isNumber()
+ {
+ return true;
+ }
+
+ public Object asObject()
+ {
+ return new Boolean(value);
+ }
+
+ public String toString()
+ {
+ return Boolean.toString(value);
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/ConstantByte.java b/tools/gnu/classpath/tools/gjdoc/expr/ConstantByte.java
new file mode 100644
index 000000000..bbe30b295
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/ConstantByte.java
@@ -0,0 +1,57 @@
+/* gnu.classpath.tools.gjdoc.expr.ConstantByte
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class ConstantByte
+ extends ConstantExpression
+{
+ private byte value;
+
+ public ConstantByte(byte byteValue)
+ {
+ this.value = byteValue;
+ }
+
+ public Type getType()
+ {
+ return Type.BYTE;
+ }
+
+ public Number asNumber()
+ {
+ return new Byte(value);
+ }
+
+ public boolean isNumber()
+ {
+ return true;
+ }
+
+ public Object asObject()
+ {
+ return asNumber();
+ }
+
+ public String toString()
+ {
+ return Byte.toString(value);
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/ConstantChar.java b/tools/gnu/classpath/tools/gjdoc/expr/ConstantChar.java
new file mode 100644
index 000000000..56d323083
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/ConstantChar.java
@@ -0,0 +1,81 @@
+/* gnu.classpath.tools.gjdoc.expr.ConstantChar
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class ConstantChar
+ extends ConstantExpression
+{
+ private char value;
+
+ public ConstantChar(String stringValue)
+ {
+ this.value = stringValue.charAt(1); // FIXME
+ if (value == '\\') {
+ switch (stringValue.charAt(2)) {
+ case 'n': value = '\n'; break;
+ case 't': value = '\t'; break;
+ case 'f': value = '\f'; break;
+ case 'r': value = '\r'; break;
+ case 'b': value = '\b'; break;
+ case 'u':
+ {
+ String stringVal = stringValue.substring(3, stringValue.length() - 1);
+ /*
+ while (stringVal.length() > 1 && stringVal.charAt(0) == '0') {
+ stringVal = stringVal.substring(1);
+ }
+ */
+ value = (char)Integer.parseInt(stringVal, 16); break;
+ }
+ }
+ }
+ }
+
+ public ConstantChar(char charValue)
+ {
+ this.value = charValue;
+ }
+
+ public Type getType()
+ {
+ return Type.CHAR;
+ }
+
+ public Number asNumber()
+ {
+ return new Integer((int)value);
+ }
+
+ public Object asObject()
+ {
+ return new Character(value);
+ }
+
+ public boolean isNumber()
+ {
+ return true;
+ }
+
+ public String toString()
+ {
+ return Character.toString(value);
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/ConstantDouble.java b/tools/gnu/classpath/tools/gjdoc/expr/ConstantDouble.java
new file mode 100644
index 000000000..ad9709277
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/ConstantDouble.java
@@ -0,0 +1,62 @@
+/* gnu.classpath.tools.gjdoc.expr.ConstantDouble
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class ConstantDouble
+ extends ConstantExpression
+{
+ private double value;
+
+ public ConstantDouble(String stringValue)
+ {
+ this.value = Double.parseDouble(stringValue);
+ }
+
+ public ConstantDouble(double doubleValue)
+ {
+ this.value = doubleValue;
+ }
+
+ public Type getType()
+ {
+ return Type.DOUBLE;
+ }
+
+ public Number asNumber()
+ {
+ return new Double(value);
+ }
+
+ public boolean isNumber()
+ {
+ return true;
+ }
+
+ public Object asObject()
+ {
+ return asNumber();
+ }
+
+ public String toString()
+ {
+ return Double.toString(value);
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/ConstantExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/ConstantExpression.java
new file mode 100644
index 000000000..3078b4c58
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/ConstantExpression.java
@@ -0,0 +1,35 @@
+/* gnu.classpath.tools.gjdoc.expr.ConstantExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+abstract class ConstantExpression
+ implements Expression
+{
+ public abstract Type getType();
+ public abstract Number asNumber();
+ public abstract Object asObject();
+ public abstract boolean isNumber();
+
+ public ConstantExpression evaluate(Context context)
+ {
+ return this;
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/ConstantFloat.java b/tools/gnu/classpath/tools/gjdoc/expr/ConstantFloat.java
new file mode 100644
index 000000000..cf378dba4
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/ConstantFloat.java
@@ -0,0 +1,62 @@
+/* gnu.classpath.tools.gjdoc.expr.ConstantFloat
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class ConstantFloat
+ extends ConstantExpression
+{
+ private float value;
+
+ public ConstantFloat(String stringValue)
+ {
+ this.value = Float.parseFloat(stringValue);
+ }
+
+ public ConstantFloat(float floatValue)
+ {
+ this.value = floatValue;
+ }
+
+ public Type getType()
+ {
+ return Type.FLOAT;
+ }
+
+ public Number asNumber()
+ {
+ return new Float(value);
+ }
+
+ public boolean isNumber()
+ {
+ return true;
+ }
+
+ public Object asObject()
+ {
+ return asNumber();
+ }
+
+ public String toString()
+ {
+ return "ConstantFloat{" + value + "}";
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/ConstantInteger.java b/tools/gnu/classpath/tools/gjdoc/expr/ConstantInteger.java
new file mode 100644
index 000000000..56217cc02
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/ConstantInteger.java
@@ -0,0 +1,62 @@
+/* gnu.classpath.tools.gjdoc.expr.ConstantInteger
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class ConstantInteger
+ extends ConstantExpression
+{
+ private long value;
+
+ public ConstantInteger(String stringValue)
+ {
+ this.value = Evaluator.parseLong(stringValue);
+ }
+
+ public ConstantInteger(int integerValue)
+ {
+ this.value = integerValue;
+ }
+
+ public Type getType()
+ {
+ return Type.INTEGER;
+ }
+
+ public Number asNumber()
+ {
+ return new Long(value);
+ }
+
+ public boolean isNumber()
+ {
+ return true;
+ }
+
+ public Object asObject()
+ {
+ return new Integer((int)value);
+ }
+
+ public String toString()
+ {
+ return Long.toString(value);
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/ConstantLong.java b/tools/gnu/classpath/tools/gjdoc/expr/ConstantLong.java
new file mode 100644
index 000000000..bfc1a0ad3
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/ConstantLong.java
@@ -0,0 +1,67 @@
+/* gnu.classpath.tools.gjdoc.expr.ConstantLong
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class ConstantLong
+ extends ConstantExpression
+{
+ private long value;
+
+ public ConstantLong(String stringValue)
+ {
+ if ('l' == Character.toLowerCase(stringValue.charAt(stringValue.length() - 1))) {
+ this.value = Evaluator.parseLong(stringValue.substring(0, stringValue.length() - 1));
+ }
+ else {
+ this.value = Evaluator.parseInt(stringValue.substring(0, stringValue.length() - 1));
+ }
+ }
+
+ public ConstantLong(long longValue)
+ {
+ this.value = longValue;
+ }
+
+ public Type getType()
+ {
+ return Type.LONG;
+ }
+
+ public Number asNumber()
+ {
+ return new Long(value);
+ }
+
+ public boolean isNumber()
+ {
+ return true;
+ }
+
+ public Object asObject()
+ {
+ return asNumber();
+ }
+
+ public String toString()
+ {
+ return Long.toString(value);
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/ConstantNull.java b/tools/gnu/classpath/tools/gjdoc/expr/ConstantNull.java
new file mode 100644
index 000000000..23f965907
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/ConstantNull.java
@@ -0,0 +1,49 @@
+/* gnu.classpath.tools.gjdoc.expr.ConstantNull
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class ConstantNull
+ extends ConstantExpression
+{
+ public ConstantNull()
+ {
+ }
+
+ public Type getType()
+ {
+ return Type.NULL;
+ }
+
+ public Number asNumber()
+ {
+ return null;
+ }
+
+ public boolean isNumber()
+ {
+ return false;
+ }
+
+ public Object asObject()
+ {
+ return null;
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/ConstantShort.java b/tools/gnu/classpath/tools/gjdoc/expr/ConstantShort.java
new file mode 100644
index 000000000..acd020de2
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/ConstantShort.java
@@ -0,0 +1,57 @@
+/* gnu.classpath.tools.gjdoc.expr.ConstantShort
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class ConstantShort
+ extends ConstantExpression
+{
+ private short value;
+
+ public ConstantShort(short shortValue)
+ {
+ this.value = shortValue;
+ }
+
+ public Type getType()
+ {
+ return Type.SHORT;
+ }
+
+ public Number asNumber()
+ {
+ return new Short(value);
+ }
+
+ public boolean isNumber()
+ {
+ return true;
+ }
+
+ public Object asObject()
+ {
+ return asNumber();
+ }
+
+ public String toString()
+ {
+ return Short.toString(value);
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/ConstantString.java b/tools/gnu/classpath/tools/gjdoc/expr/ConstantString.java
new file mode 100644
index 000000000..847e2951a
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/ConstantString.java
@@ -0,0 +1,58 @@
+/* gnu.classpath.tools.gjdoc.expr.ConstantString
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class ConstantString
+ extends ConstantExpression
+{
+ private String value;
+
+ public ConstantString(String value)
+ {
+ this.value = value;
+ }
+
+ public Type getType()
+ {
+ return Type.STRING;
+ }
+
+ public Number asNumber()
+ {
+ return null;
+ }
+
+ public boolean isNumber()
+ {
+ return false;
+ }
+
+ public Object asObject()
+ {
+ return value;
+ }
+
+ public String toString()
+ {
+ return value;
+ }
+}
+
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/Context.java b/tools/gnu/classpath/tools/gjdoc/expr/Context.java
new file mode 100644
index 000000000..99093f7cb
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/Context.java
@@ -0,0 +1,45 @@
+/* gnu.classpath.tools.gjdoc.expr.Context
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+import java.util.Set;
+
+class Context
+{
+ private EvaluatorEnvironment evaluatorEnvironment;
+ private Set visitedFields;
+
+ Context(EvaluatorEnvironment evaluatorEnvironment, Set visitedFields)
+ {
+ this.evaluatorEnvironment = evaluatorEnvironment;
+ this.visitedFields = visitedFields;
+ }
+
+ public EvaluatorEnvironment getEvaluatorEnvironment()
+ {
+ return evaluatorEnvironment;
+ }
+
+ public Set getVisitedFields()
+ {
+ return visitedFields;
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/DivisionExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/DivisionExpression.java
new file mode 100644
index 000000000..baaf65de6
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/DivisionExpression.java
@@ -0,0 +1,50 @@
+/* gnu.classpath.tools.gjdoc.expr.DivisionExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class DivisionExpression
+ extends BinaryComputationExpression
+{
+ public DivisionExpression(Expression left, Expression right)
+ {
+ super(left, right);
+ }
+
+ protected double compute(double leftValue, double rightValue)
+ {
+ return leftValue / rightValue;
+ }
+
+ protected float compute(float leftValue, float rightValue)
+ {
+ return leftValue / rightValue;
+ }
+
+ protected long compute(long leftValue, long rightValue)
+ {
+ return leftValue / rightValue;
+ }
+
+ protected int compute(int leftValue, int rightValue)
+ {
+ return leftValue / rightValue;
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/EqualExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/EqualExpression.java
new file mode 100644
index 000000000..c31ff884f
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/EqualExpression.java
@@ -0,0 +1,55 @@
+/* gnu.classpath.tools.gjdoc.expr.EqualExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class EqualExpression
+ extends BinaryEqualityExpression
+{
+ public EqualExpression(Expression left, Expression right)
+ {
+ super(left, right);
+ }
+
+ protected boolean compute(double leftValue, double rightValue)
+ {
+ return leftValue == rightValue;
+ }
+
+ protected boolean compute(float leftValue, float rightValue)
+ {
+ return leftValue == rightValue;
+ }
+
+ protected boolean compute(long leftValue, long rightValue)
+ {
+ return leftValue == rightValue;
+ }
+
+ protected boolean compute(int leftValue, int rightValue)
+ {
+ return leftValue == rightValue;
+ }
+
+ protected boolean compute(boolean leftValue, boolean rightValue)
+ {
+ return leftValue == rightValue;
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/Evaluator.java b/tools/gnu/classpath/tools/gjdoc/expr/Evaluator.java
new file mode 100644
index 000000000..94c54c25d
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/Evaluator.java
@@ -0,0 +1,131 @@
+/* gnu.classpath.tools.gjdoc.expr.Evaluator
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+import java.io.StringReader;
+import java.math.BigInteger;
+import antlr.RecognitionException;
+import antlr.TokenStreamException;
+import java.util.Set;
+
+public class Evaluator
+{
+ /**
+ * Try to evaluate the given Java expression in the context of the
+ * given environment.
+ *
+ * @param expression the Java expression to evaluate. The
+ * expression string must not include a terminating semicolon.
+ *
+ * @param source the FieldDoc (part of) whose constant field value
+ * expression is being evaluated. Used to prevent circular
+ * references.
+ *
+ * @param environment callback hook used by the Evaluator to query
+ * the value of static fields referenced in the expression.
+ *
+ * @return a Java object representing the value of the expression,
+ * or <code>null</code> if the expression evaluates to
+ * <code>null</code>.
+ *
+ * @throws IllegalExpressionException if the expression is
+ * invalid, uses unsupported syntax constructs (e.g. method calls,
+ * array access) or references unknown static fields.
+ */
+ public static Object evaluate(String expression,
+ Set visitedFields,
+ EvaluatorEnvironment environment)
+ throws IllegalExpressionException
+ {
+ try {
+ JavaLexer lexer = new JavaLexer(new StringReader(expression));
+ JavaRecognizer recognizer = new JavaRecognizer(lexer);
+ Expression e = recognizer.expression();
+ ConstantExpression value = e.evaluate(new Context(environment, visitedFields));
+ return value.asObject();
+ }
+ catch (RecognitionException e) {
+ throw new IllegalExpressionException(e);
+ }
+ catch (TokenStreamException e) {
+ throw new IllegalExpressionException(e);
+ }
+ }
+
+ static int parseInt(String stringValue)
+ {
+ int base = 10;
+
+ if (stringValue.startsWith("0x")) {
+ base = 16;
+ stringValue = stringValue.substring(2);
+ }
+ else if (stringValue.length() > 1 && stringValue.startsWith("0")) {
+ base = 8;
+ stringValue = stringValue.substring(1);
+ }
+ while (stringValue.length() > 1 && stringValue.startsWith("0")) {
+ stringValue = stringValue.substring(1);
+ }
+
+ if (10 == base) {
+ return Integer.parseInt(stringValue);
+ }
+ else {
+ long result = Long.parseLong(stringValue, base);
+
+ if (result > Integer.MAX_VALUE) {
+ result -= 0x100000000L;
+ }
+
+ if (result > Integer.MAX_VALUE) {
+ throw new NumberFormatException(result + " > " + Integer.MAX_VALUE);
+ }
+ else if (result < Integer.MIN_VALUE) {
+ throw new NumberFormatException(result + " < " + Integer.MIN_VALUE);
+ }
+ else {
+ return (int)result;
+ }
+ }
+ }
+
+ static long parseLong(String stringValue)
+ {
+ int base = 10;
+
+ if (stringValue.startsWith("0x")) {
+ base = 16;
+ stringValue = stringValue.substring(2);
+ }
+ else if (stringValue.length() > 1 && stringValue.startsWith("0")) {
+ base = 8;
+ stringValue = stringValue.substring(1);
+ }
+ while (stringValue.length() > 1 && stringValue.startsWith("0")) {
+ stringValue = stringValue.substring(1);
+ }
+
+ BigInteger bigInt = new BigInteger(stringValue, base);
+ long result = bigInt.longValue();
+ return result;
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/EvaluatorEnvironment.java b/tools/gnu/classpath/tools/gjdoc/expr/EvaluatorEnvironment.java
new file mode 100644
index 000000000..a268b965e
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/EvaluatorEnvironment.java
@@ -0,0 +1,29 @@
+/* gnu.classpath.tools.gjdoc.expr.EvaluatorEnvironment
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+import java.util.Set;
+
+public interface EvaluatorEnvironment
+{
+ public Object getValue(String identifier, Set visitedFields)
+ throws IllegalExpressionException, UnknownIdentifierException;
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/ExclusiveOrExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/ExclusiveOrExpression.java
new file mode 100644
index 000000000..563cb1b0d
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/ExclusiveOrExpression.java
@@ -0,0 +1,40 @@
+/* gnu.classpath.tools.gjdoc.expr.ExclusiveOrExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class ExclusiveOrExpression
+ extends BinaryBitwiseExpression
+{
+ public ExclusiveOrExpression(Expression left, Expression right)
+ {
+ super(left, right);
+ }
+
+ protected long compute(long leftValue, long rightValue)
+ {
+ return leftValue ^ rightValue;
+ }
+
+ protected int compute(int leftValue, int rightValue)
+ {
+ return leftValue ^ rightValue;
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/Expression.java b/tools/gnu/classpath/tools/gjdoc/expr/Expression.java
new file mode 100644
index 000000000..660806d59
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/Expression.java
@@ -0,0 +1,27 @@
+/* gnu.classpath.tools.gjdoc.expr.Expression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+interface Expression
+{
+ public ConstantExpression evaluate(Context context)
+ throws IllegalExpressionException;
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/GreaterThanExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/GreaterThanExpression.java
new file mode 100644
index 000000000..647ac77fa
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/GreaterThanExpression.java
@@ -0,0 +1,50 @@
+/* gnu.classpath.tools.gjdoc.expr.GreaterThanExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class GreaterThanExpression
+ extends BinaryRelationExpression
+{
+ public GreaterThanExpression(Expression left, Expression right)
+ {
+ super(left, right);
+ }
+
+ protected boolean compute(double leftValue, double rightValue)
+ {
+ return leftValue > rightValue;
+ }
+
+ protected boolean compute(float leftValue, float rightValue)
+ {
+ return leftValue > rightValue;
+ }
+
+ protected boolean compute(long leftValue, long rightValue)
+ {
+ return leftValue > rightValue;
+ }
+
+ protected boolean compute(int leftValue, int rightValue)
+ {
+ return leftValue > rightValue;
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/GreaterThanOrEqualExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/GreaterThanOrEqualExpression.java
new file mode 100644
index 000000000..e183482aa
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/GreaterThanOrEqualExpression.java
@@ -0,0 +1,50 @@
+/* gnu.classpath.tools.gjdoc.expr.GreaterThanOrEqualExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class GreaterThanOrEqualExpression
+ extends BinaryRelationExpression
+{
+ public GreaterThanOrEqualExpression(Expression left, Expression right)
+ {
+ super(left, right);
+ }
+
+ protected boolean compute(double leftValue, double rightValue)
+ {
+ return leftValue >= rightValue;
+ }
+
+ protected boolean compute(float leftValue, float rightValue)
+ {
+ return leftValue >= rightValue;
+ }
+
+ protected boolean compute(long leftValue, long rightValue)
+ {
+ return leftValue >= rightValue;
+ }
+
+ protected boolean compute(int leftValue, int rightValue)
+ {
+ return leftValue >= rightValue;
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/IdentifierExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/IdentifierExpression.java
new file mode 100644
index 000000000..d6cf3224b
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/IdentifierExpression.java
@@ -0,0 +1,72 @@
+/* gnu.classpath.tools.gjdoc.expr.IdentifierExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class IdentifierExpression
+ implements Expression
+{
+ private String identifier;
+
+ public IdentifierExpression(String identifier)
+ {
+ this.identifier = identifier;
+ }
+
+ public ConstantExpression evaluate(Context context)
+ throws IllegalExpressionException
+ {
+ Object value = context.getEvaluatorEnvironment().getValue(identifier, context.getVisitedFields());
+
+ if (value instanceof Byte) {
+ return new ConstantByte(((Byte)value).byteValue());
+ }
+ else if (value instanceof Short) {
+ return new ConstantShort(((Short)value).shortValue());
+ }
+ else if (value instanceof Integer) {
+ return new ConstantInteger(((Integer)value).intValue());
+ }
+ else if (value instanceof Long) {
+ return new ConstantLong(((Long)value).longValue());
+ }
+ else if (value instanceof Float) {
+ return new ConstantFloat(((Float)value).floatValue());
+ }
+ else if (value instanceof Double) {
+ return new ConstantDouble(((Double)value).doubleValue());
+ }
+ else if (value instanceof Boolean) {
+ return new ConstantBoolean(((Boolean)value).booleanValue());
+ }
+ else if (value instanceof Character) {
+ return new ConstantChar(((Character)value).charValue());
+ }
+ else if (value instanceof String) {
+ return new ConstantString((String)value);
+ }
+ else if (null != value) {
+ throw new IllegalExpressionException("Unsupported type " + value.getClass().getName() + " for identifier " + identifier);
+ }
+ else {
+ throw new IllegalExpressionException("Cannot resolve identifier " + identifier);
+ }
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/IllegalExpressionException.java b/tools/gnu/classpath/tools/gjdoc/expr/IllegalExpressionException.java
new file mode 100644
index 000000000..bb84a5547
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/IllegalExpressionException.java
@@ -0,0 +1,35 @@
+/* gnu.classpath.tools.gjdoc.expr.IllegalExpressionException
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+public class IllegalExpressionException
+ extends Exception
+{
+ public IllegalExpressionException(String message)
+ {
+ super(message);
+ }
+
+ public IllegalExpressionException(Throwable cause)
+ {
+ super(cause);
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/InclusiveOrExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/InclusiveOrExpression.java
new file mode 100644
index 000000000..350027ea2
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/InclusiveOrExpression.java
@@ -0,0 +1,40 @@
+/* gnu.classpath.tools.gjdoc.expr.InclusiveOrExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class InclusiveOrExpression
+ extends BinaryBitwiseExpression
+{
+ public InclusiveOrExpression(Expression a, Expression b)
+ {
+ super(a, b);
+ }
+
+ protected long compute(long leftValue, long rightValue)
+ {
+ return leftValue | rightValue;
+ }
+
+ protected int compute(int leftValue, int rightValue)
+ {
+ return leftValue | rightValue;
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/LessThanExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/LessThanExpression.java
new file mode 100644
index 000000000..d57b862c9
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/LessThanExpression.java
@@ -0,0 +1,50 @@
+/* gnu.classpath.tools.gjdoc.expr.LessThanExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class LessThanExpression
+ extends BinaryRelationExpression
+{
+ public LessThanExpression(Expression left, Expression right)
+ {
+ super(left, right);
+ }
+
+ protected boolean compute(double leftValue, double rightValue)
+ {
+ return leftValue < rightValue;
+ }
+
+ protected boolean compute(float leftValue, float rightValue)
+ {
+ return leftValue < rightValue;
+ }
+
+ protected boolean compute(long leftValue, long rightValue)
+ {
+ return leftValue < rightValue;
+ }
+
+ protected boolean compute(int leftValue, int rightValue)
+ {
+ return leftValue < rightValue;
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/LessThanOrEqualExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/LessThanOrEqualExpression.java
new file mode 100644
index 000000000..eaf24994e
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/LessThanOrEqualExpression.java
@@ -0,0 +1,50 @@
+/* gnu.classpath.tools.gjdoc.expr.LessThanOrEqualExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class LessThanOrEqualExpression
+ extends BinaryRelationExpression
+{
+ public LessThanOrEqualExpression(Expression left, Expression right)
+ {
+ super(left, right);
+ }
+
+ protected boolean compute(double leftValue, double rightValue)
+ {
+ return leftValue <= rightValue;
+ }
+
+ protected boolean compute(float leftValue, float rightValue)
+ {
+ return leftValue <= rightValue;
+ }
+
+ protected boolean compute(long leftValue, long rightValue)
+ {
+ return leftValue <= rightValue;
+ }
+
+ protected boolean compute(int leftValue, int rightValue)
+ {
+ return leftValue <= rightValue;
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/LogicalAndExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/LogicalAndExpression.java
new file mode 100644
index 000000000..44e50751f
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/LogicalAndExpression.java
@@ -0,0 +1,35 @@
+/* gnu.classpath.tools.gjdoc.expr.LogicalAndExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class LogicalAndExpression
+ extends BinaryLogicalExpression
+{
+ LogicalAndExpression(Expression left, Expression right)
+ {
+ super(left, right);
+ }
+
+ protected boolean compute(boolean leftValue, boolean rightValue)
+ {
+ return leftValue && rightValue;
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/LogicalNotExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/LogicalNotExpression.java
new file mode 100644
index 000000000..c315166d0
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/LogicalNotExpression.java
@@ -0,0 +1,43 @@
+/* gnu.classpath.tools.gjdoc.expr.LogicalNotExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class LogicalNotExpression
+ extends UnaryExpression
+{
+ protected LogicalNotExpression(Expression expr)
+ {
+ super(expr);
+ }
+
+ public ConstantExpression evaluate(Context context)
+ throws IllegalExpressionException
+ {
+ ConstantExpression value = expr.evaluate(context);
+
+ if (Type.BOOLEAN == value.getType()) {
+ return new ConstantBoolean(!((ConstantBoolean)value).booleanValue());
+ }
+ else {
+ throw new IllegalExpressionException("Operator ! cannot be applied to " + value.getType());
+ }
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/LogicalOrExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/LogicalOrExpression.java
new file mode 100644
index 000000000..77c33b4fe
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/LogicalOrExpression.java
@@ -0,0 +1,35 @@
+/* gnu.classpath.tools.gjdoc.expr.LogicalOrExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class LogicalOrExpression
+ extends BinaryLogicalExpression
+{
+ LogicalOrExpression(Expression a, Expression b)
+ {
+ super(a, b);
+ }
+
+ protected boolean compute(boolean leftValue, boolean rightValue)
+ {
+ return leftValue || rightValue;
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/ModuloExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/ModuloExpression.java
new file mode 100644
index 000000000..c8681177b
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/ModuloExpression.java
@@ -0,0 +1,50 @@
+/* gnu.classpath.tools.gjdoc.expr.ModuloExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class ModuloExpression
+ extends BinaryComputationExpression
+{
+ public ModuloExpression(Expression left, Expression right)
+ {
+ super(left, right);
+ }
+
+ protected double compute(double leftValue, double rightValue)
+ {
+ return leftValue % rightValue;
+ }
+
+ protected float compute(float leftValue, float rightValue)
+ {
+ return leftValue % rightValue;
+ }
+
+ protected long compute(long leftValue, long rightValue)
+ {
+ return leftValue % rightValue;
+ }
+
+ protected int compute(int leftValue, int rightValue)
+ {
+ return leftValue % rightValue;
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/MultiplicationExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/MultiplicationExpression.java
new file mode 100644
index 000000000..520380c34
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/MultiplicationExpression.java
@@ -0,0 +1,50 @@
+/* gnu.classpath.tools.gjdoc.expr.MultiplicationExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class MultiplicationExpression
+ extends BinaryComputationExpression
+{
+ public MultiplicationExpression(Expression left, Expression right)
+ {
+ super(left, right);
+ }
+
+ protected double compute(double leftValue, double rightValue)
+ {
+ return leftValue * rightValue;
+ }
+
+ protected float compute(float leftValue, float rightValue)
+ {
+ return leftValue * rightValue;
+ }
+
+ protected long compute(long leftValue, long rightValue)
+ {
+ return leftValue * rightValue;
+ }
+
+ protected int compute(int leftValue, int rightValue)
+ {
+ return leftValue * rightValue;
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/NegateExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/NegateExpression.java
new file mode 100644
index 000000000..e14a469c2
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/NegateExpression.java
@@ -0,0 +1,49 @@
+/* gnu.classpath.tools.gjdoc.expr.NegateExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class NegateExpression
+ extends UnaryExpression
+{
+ protected NegateExpression(Expression expr)
+ {
+ super(expr);
+ }
+
+ public ConstantExpression evaluate(Context context)
+ throws IllegalExpressionException
+ {
+ ConstantExpression value = expr.evaluate(context);
+
+ if (Type.LONG == value.getType()) {
+ return new ConstantLong(-value.asNumber().longValue());
+ }
+ else if (Type.DOUBLE == value.getType()) {
+ return new ConstantDouble(-value.asNumber().doubleValue());
+ }
+ else if (Type.FLOAT == value.getType()) {
+ return new ConstantDouble(-value.asNumber().floatValue());
+ }
+ else {
+ return new ConstantInteger(-value.asNumber().intValue());
+ }
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/NotEqualExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/NotEqualExpression.java
new file mode 100644
index 000000000..c3d8ab234
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/NotEqualExpression.java
@@ -0,0 +1,55 @@
+/* gnu.classpath.tools.gjdoc.expr.NotEqualExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class NotEqualExpression
+ extends BinaryEqualityExpression
+{
+ public NotEqualExpression(Expression left, Expression right)
+ {
+ super(left, right);
+ }
+
+ protected boolean compute(double leftValue, double rightValue)
+ {
+ return leftValue != rightValue;
+ }
+
+ protected boolean compute(float leftValue, float rightValue)
+ {
+ return leftValue != rightValue;
+ }
+
+ protected boolean compute(long leftValue, long rightValue)
+ {
+ return leftValue != rightValue;
+ }
+
+ protected boolean compute(int leftValue, int rightValue)
+ {
+ return leftValue != rightValue;
+ }
+
+ protected boolean compute(boolean leftValue, boolean rightValue)
+ {
+ return leftValue != rightValue;
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/NotExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/NotExpression.java
new file mode 100644
index 000000000..3351b8ef7
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/NotExpression.java
@@ -0,0 +1,43 @@
+/* gnu.classpath.tools.gjdoc.expr.NotExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class NotExpression
+ extends UnaryExpression
+{
+ protected NotExpression(Expression expr)
+ {
+ super(expr);
+ }
+
+ public ConstantExpression evaluate(Context context)
+ throws IllegalExpressionException
+ {
+ ConstantExpression value = expr.evaluate(context);
+
+ if (Type.LONG == value.getType()) {
+ return new ConstantLong(~value.asNumber().longValue());
+ }
+ else {
+ return new ConstantInteger(~value.asNumber().intValue());
+ }
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/ShiftLeftExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/ShiftLeftExpression.java
new file mode 100644
index 000000000..af51cf3de
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/ShiftLeftExpression.java
@@ -0,0 +1,40 @@
+/* gnu.classpath.tools.gjdoc.expr.ShiftLeftExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class ShiftLeftExpression
+ extends BinaryShiftExpression
+{
+ public ShiftLeftExpression(Expression left, Expression right)
+ {
+ super(left, right);
+ }
+
+ protected long compute(long leftValue, int rightValue)
+ {
+ return leftValue << rightValue;
+ }
+
+ protected int compute(int leftValue, int rightValue)
+ {
+ return leftValue << rightValue;
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/ShiftRightExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/ShiftRightExpression.java
new file mode 100644
index 000000000..0aedf12f0
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/ShiftRightExpression.java
@@ -0,0 +1,40 @@
+/* gnu.classpath.tools.gjdoc.expr.ShiftRightExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class ShiftRightExpression
+ extends BinaryShiftExpression
+{
+ public ShiftRightExpression(Expression left, Expression right)
+ {
+ super(left, right);
+ }
+
+ protected long compute(long leftValue, int rightValue)
+ {
+ return leftValue >> rightValue;
+ }
+
+ protected int compute(int leftValue, int rightValue)
+ {
+ return leftValue >> rightValue;
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/SubtractionExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/SubtractionExpression.java
new file mode 100644
index 000000000..14e5edf03
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/SubtractionExpression.java
@@ -0,0 +1,50 @@
+/* gnu.classpath.tools.gjdoc.expr.SubtractionExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class SubtractionExpression
+ extends BinaryComputationExpression
+{
+ public SubtractionExpression(Expression left, Expression right)
+ {
+ super(left, right);
+ }
+
+ protected double compute(double leftValue, double rightValue)
+ {
+ return leftValue - rightValue;
+ }
+
+ protected float compute(float leftValue, float rightValue)
+ {
+ return leftValue - rightValue;
+ }
+
+ protected long compute(long leftValue, long rightValue)
+ {
+ return leftValue - rightValue;
+ }
+
+ protected int compute(int leftValue, int rightValue)
+ {
+ return leftValue - rightValue;
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/Type.java b/tools/gnu/classpath/tools/gjdoc/expr/Type.java
new file mode 100644
index 000000000..47f9ea68d
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/Type.java
@@ -0,0 +1,43 @@
+/* gnu.classpath.tools.gjdoc.expr.Type
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class Type
+{
+ public static final Type LONG = new Type(Long.TYPE);
+ public static final Type INTEGER = new Type(Integer.TYPE);
+ public static final Type BOOLEAN = new Type(Boolean.TYPE);
+ public static final Type DOUBLE = new Type(Double.TYPE);
+ public static final Type FLOAT = new Type(Float.TYPE);
+ public static final Type CHAR = new Type(Character.TYPE);
+ public static final Type BYTE = new Type(Byte.TYPE);
+ public static final Type SHORT = new Type(Short.TYPE);
+ public static final Type VOID = new Type(Void.TYPE);
+ public static final Type STRING = new Type(String.class);
+ public static final Type NULL = new Type(null);
+
+ private Class clazz;
+
+ private Type(Class clazz)
+ {
+ this.clazz = clazz;
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/TypeCastExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/TypeCastExpression.java
new file mode 100644
index 000000000..8c06ee27a
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/TypeCastExpression.java
@@ -0,0 +1,70 @@
+/* gnu.classpath.tools.gjdoc.expr.TypeCastExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+class TypeCastExpression
+ extends UnaryExpression
+{
+ private Type type;
+
+ public TypeCastExpression(Type type, Expression expr)
+ {
+ super(expr);
+ this.type = type;
+ }
+
+ public ConstantExpression evaluate(Context context)
+ throws IllegalExpressionException
+ {
+ ConstantExpression value = expr.evaluate(context);
+
+ if (Type.BYTE == type) {
+ return new ConstantByte(value.asNumber().byteValue());
+ }
+ else if (Type.SHORT == type) {
+ return new ConstantShort(value.asNumber().shortValue());
+ }
+ else if (Type.INTEGER == type) {
+ return new ConstantInteger(value.asNumber().intValue());
+ }
+ else if (Type.LONG == type) {
+ return new ConstantLong(value.asNumber().longValue());
+ }
+ else if (Type.CHAR == type) {
+ return new ConstantChar((char)value.asNumber().intValue());
+ }
+ else if (Type.FLOAT == type) {
+ return new ConstantFloat((float)value.asNumber().intValue());
+ }
+ else if (Type.DOUBLE == type) {
+ return new ConstantDouble((float)value.asNumber().intValue());
+ }
+ else if (Type.BOOLEAN == type && Type.BOOLEAN == value.getType()) {
+ return value;
+ }
+ else if (Type.STRING == type && Type.STRING == value.getType()) {
+ return value;
+ }
+ else {
+ throw new IllegalExpressionException("Cannot cast " + value.getType() + " to " + type);
+ }
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/UnaryExpression.java b/tools/gnu/classpath/tools/gjdoc/expr/UnaryExpression.java
new file mode 100644
index 000000000..e5421c061
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/UnaryExpression.java
@@ -0,0 +1,32 @@
+/* gnu.classpath.tools.gjdoc.expr.UnaryExpression
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+abstract class UnaryExpression
+ implements Expression
+{
+ protected Expression expr;
+
+ protected UnaryExpression(Expression expr)
+ {
+ this.expr = expr;
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/UnknownIdentifierException.java b/tools/gnu/classpath/tools/gjdoc/expr/UnknownIdentifierException.java
new file mode 100644
index 000000000..f84970717
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/UnknownIdentifierException.java
@@ -0,0 +1,30 @@
+/* gnu.classpath.tools.gjdoc.expr.UnknownIdentifierException
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.gjdoc.expr;
+
+public class UnknownIdentifierException
+ extends IllegalExpressionException
+{
+ public UnknownIdentifierException(String identifier)
+ {
+ super(identifier);
+ }
+}
diff --git a/tools/gnu/classpath/tools/gjdoc/expr/java-expression.g b/tools/gnu/classpath/tools/gjdoc/expr/java-expression.g
new file mode 100644
index 000000000..4a21a8618
--- /dev/null
+++ b/tools/gnu/classpath/tools/gjdoc/expr/java-expression.g
@@ -0,0 +1,471 @@
+/*
+ * This grammar is derived from the Java 1.3 Recognizer
+ * (http://www.antlr.org/grammar/java/java.g) by Mitchell, Parr, Lilley,
+ * Stanchfield, Mohnen, Williams, Jacobs, Messick and Pybus, Version
+ * 1.21.
+ *
+ * This grammar recognizes simple Java expressions. The following
+ * language elements are NOT supported:
+ *
+ * - type casts to non-primitive types
+ * - method calls
+ * - constructor calls
+ * - array access
+ * - comma expressions
+ * - increment and decrement operators (both prefix/postfix)
+ * - expressions involving constant classes (Abc.class)
+ */
+
+header {
+ package gnu.classpath.tools.gjdoc.expr;
+}
+
+class JavaRecognizer extends Parser;
+options {
+ k = 2; // two token lookahead
+ exportVocab=Java; // Call its vocabulary "Java"
+ codeGenMakeSwitchThreshold = 2; // Some optimizations
+ codeGenBitsetTestThreshold = 3;
+ defaultErrorHandler = false; // Don't generate parser error handlers
+ buildAST = true;
+}
+
+tokens {
+ BLOCK; MODIFIERS; OBJBLOCK; SLIST; CTOR_DEF; METHOD_DEF; VARIABLE_DEF;
+ INSTANCE_INIT; STATIC_INIT; TYPE; CLASS_DEF; INTERFACE_DEF;
+ PACKAGE_DEF; ARRAY_DECLARATOR; EXTENDS_CLAUSE; IMPLEMENTS_CLAUSE;
+ PARAMETERS; PARAMETER_DEF; LABELED_STAT; TYPECAST; INDEX_OP;
+ POST_INC; POST_DEC; METHOD_CALL; EXPR; ARRAY_INIT;
+ IMPORT; UNARY_MINUS; UNARY_PLUS; CASE_GROUP; ELIST; FOR_INIT; FOR_CONDITION;
+ FOR_ITERATOR; EMPTY_STAT; FINAL="final"; ABSTRACT="abstract";
+ STRICTFP="strictfp"; SUPER_CTOR_CALL; CTOR_CALL;
+}
+
+// A builtin type specification is a builtin type with possible brackets
+// afterwards (which would make it an array type).
+builtInTypeSpec[boolean addImagNode] returns [Type t = null]
+ : t=builtInType (lb:LBRACK^ {#lb.setType(ARRAY_DECLARATOR);} RBRACK!)*
+ {
+ if ( addImagNode ) {
+ #builtInTypeSpec = #(#[TYPE,"TYPE"], #builtInTypeSpec);
+ }
+ }
+ ;
+
+// A type name. which is either a (possibly qualified) class name or
+// a primitive (builtin) type
+type returns [Type t]
+ : t=builtInType
+ ;
+
+// The primitive types.
+builtInType returns [Type t = null]
+ : "void" {t=Type.VOID;}
+ | "boolean" {t=Type.BOOLEAN;}
+ | "byte" {t=Type.BYTE;}
+ | "char" {t=Type.CHAR;}
+ | "short" {t=Type.SHORT;}
+ | "int" {t=Type.INTEGER;}
+ | "float"{t=Type.FLOAT;}
+ | "long" {t=Type.LONG;}
+ | "double" {t=Type.DOUBLE;}
+ | "String" {t=Type.STRING;}
+ ;
+
+// A (possibly-qualified) java identifier. We start with the first IDENT
+// and expand its name by adding dots and following IDENTS
+identifier returns [String s = null;]
+ : i:IDENT {s=i.getText();} ( DOT^ i2:IDENT {s+="."+i2.getText();} )*
+ ;
+
+expression returns [Expression e = null]
+ : e=conditionalExpression EOF!
+ ;
+
+// conditional test (level 12)
+conditionalExpression returns [Expression e = null] { Expression a,b,c; }
+ : e=logicalOrExpression
+ ( QUESTION^ b=conditionalExpression COLON! c=conditionalExpression {e=new ConditionalExpression(e,b,c);} )?
+ ;
+
+
+// logical or (||) (level 11)
+logicalOrExpression returns [Expression e = null] { Expression a,b; }
+ : e=logicalAndExpression (LOR^ b=logicalAndExpression {e=new LogicalOrExpression(e,b);})*
+ ;
+
+
+// logical and (&&) (level 10)
+logicalAndExpression returns [Expression e = null] { Expression a,b; }
+ : e=inclusiveOrExpression (LAND^ b=inclusiveOrExpression {e=new LogicalAndExpression(e,b);})*
+ ;
+
+
+// bitwise or non-short-circuiting or (|) (level 9)
+inclusiveOrExpression returns [Expression e = null] { Expression a,b; }
+ : e=exclusiveOrExpression (BOR^ b=exclusiveOrExpression {e=new InclusiveOrExpression(e,b);})*
+ ;
+
+
+// exclusive or (^) (level 8)
+exclusiveOrExpression returns [Expression e = null] { Expression a,b; }
+ : e=andExpression (BXOR^ b=andExpression {e=new ExclusiveOrExpression(e,b);})*
+ ;
+
+
+// bitwise or non-short-circuiting and (&) (level 7)
+andExpression returns [Expression e = null] { Expression a,b; }
+ : e=equalityExpression (BAND^ b=equalityExpression {e=new AndExpression(e,b);})*
+ ;
+
+
+// equality/inequality (==/!=) (level 6)
+equalityExpression returns [Expression e = null] { Expression a,b; }
+ : e=relationalExpression ((NOT_EQUAL^ a=relationalExpression {e=new NotEqualExpression(e,a);} | EQUAL^ a=relationalExpression {e=new EqualExpression(e,a);}))*
+ ;
+
+
+// boolean relational expressions (level 5)
+relationalExpression returns [Expression e = null] { Expression a,b; }
+ : e=shiftExpression
+ ( ( ( LT^ a=shiftExpression {e=new LessThanExpression(e,a);}
+ | GT^ a=shiftExpression {e=new GreaterThanExpression(e,a);}
+ | LE^ a=shiftExpression {e=new LessThanOrEqualExpression(e,a);}
+ | GE^ a=shiftExpression {e=new GreaterThanOrEqualExpression(e,a);}
+ )
+
+ )*
+ )
+ ;
+
+
+// bit shift expressions (level 4)
+shiftExpression returns [Expression e = null] { Expression a,b; }
+ : e=additiveExpression ((SL^ a=additiveExpression {e=new ShiftLeftExpression(e,a);} | SR^ a=additiveExpression {e=new ShiftRightExpression(e,a);} | BSR^ a=additiveExpression {e=new BitShiftRightExpression(e,a);}))*
+ ;
+
+
+// binary addition/subtraction (level 3)
+additiveExpression returns [Expression e = null] { Expression a,b; }
+ : e=multiplicativeExpression ((PLUS^ a=multiplicativeExpression {e=new AdditionExpression(e,a);} | MINUS^ a=multiplicativeExpression {e=new SubtractionExpression(e,a);}))*
+ ;
+
+
+// multiplication/division/modulo (level 2)
+multiplicativeExpression returns [Expression e = null] { Expression a,b; }
+ : e=unaryExpression ((STAR^ a=unaryExpression {e=new MultiplicationExpression(e,a);} | DIV^ a=unaryExpression {e=new DivisionExpression(e,a);} | MOD^ a=unaryExpression {e=new ModuloExpression(e,a);} ))*
+ ;
+
+
+unaryExpression returns [Expression e = null] { Expression a,b; }
+ : MINUS^ {#MINUS.setType(UNARY_MINUS);} a=unaryExpression {e=new NegateExpression(a);}
+ | PLUS^ {#PLUS.setType(UNARY_PLUS);} e=unaryExpression
+ | e=unaryExpressionNotPlusMinus
+ ;
+
+unaryExpressionNotPlusMinus returns [Expression e = null] { Expression a; Type t; }
+ : BNOT^ a=unaryExpression {e=new NotExpression(a);}
+ | LNOT^ a=unaryExpression {e=new LogicalNotExpression(a);}
+
+ // use predicate to skip cases like: (int.class)
+ | (LPAREN builtInTypeSpec[true] RPAREN) =>
+ lpb:LPAREN^ {#lpb.setType(TYPECAST);} t=builtInTypeSpec[true] RPAREN!
+ a=unaryExpression {e=new TypeCastExpression(t,a);}
+
+ | e=primaryExpression
+ ;
+
+// the basic element of an expression
+primaryExpression returns [Expression e = null; String i = null;]
+ : e=constant
+ | i=identifier {e=new IdentifierExpression(i);}
+ | "true" { e=new ConstantBoolean(true); }
+ | "false" { e=new ConstantBoolean(false); }
+ | "null" { e=new ConstantNull(); }
+ | LPAREN! e=conditionalExpression RPAREN!
+ ;
+
+/** Match a, a.b.c refs
+ */
+identPrimary returns [Expression e = null]
+ : IDENT
+ (
+ options {
+ // .ident could match here or in postfixExpression.
+ // We do want to match here. Turn off warning.
+ greedy=true;
+ }
+ : DOT^ IDENT
+ )*
+ ;
+
+constant returns [Expression e = null]
+ : l1:NUM_INT {e=new ConstantInteger(l1.getText());}
+ | l2:CHAR_LITERAL {e=new ConstantChar(l2.getText());}
+ | l3:STRING_LITERAL {e=new ConstantString(l3.getText().substring(1, l3.getText().length()-1)); }
+ | l4:NUM_FLOAT {e=new ConstantFloat(l4.getText());}
+ | l5:NUM_LONG {e=new ConstantLong(l5.getText());}
+ | l6:NUM_DOUBLE {e=new ConstantDouble(l6.getText());}
+ ;
+
+
+//----------------------------------------------------------------------------
+// The Java scanner
+//----------------------------------------------------------------------------
+class JavaLexer extends Lexer;
+
+options {
+ exportVocab=Java; // call the vocabulary "Java"
+ testLiterals=false; // don't automatically test for literals
+ k=4; // four characters of lookahead
+ charVocabulary='\u0003'..'\uFFFF';
+ // without inlining some bitset tests, couldn't do unicode;
+ // I need to make ANTLR generate smaller bitsets; see
+ // bottom of JavaLexer.java
+ codeGenBitsetTestThreshold=20;
+}
+
+
+
+// OPERATORS
+QUESTION : '?' ;
+LPAREN : '(' ;
+RPAREN : ')' ;
+LBRACK : '[' ;
+RBRACK : ']' ;
+LCURLY : '{' ;
+RCURLY : '}' ;
+COLON : ':' ;
+COMMA : ',' ;
+//DOT : '.' ;
+ASSIGN : '=' ;
+EQUAL : "==" ;
+LNOT : '!' ;
+BNOT : '~' ;
+NOT_EQUAL : "!=" ;
+DIV : '/' ;
+DIV_ASSIGN : "/=" ;
+PLUS : '+' ;
+PLUS_ASSIGN : "+=" ;
+INC : "++" ;
+MINUS : '-' ;
+MINUS_ASSIGN : "-=" ;
+DEC : "--" ;
+STAR : '*' ;
+STAR_ASSIGN : "*=" ;
+MOD : '%' ;
+MOD_ASSIGN : "%=" ;
+SR : ">>" ;
+SR_ASSIGN : ">>=" ;
+BSR : ">>>" ;
+BSR_ASSIGN : ">>>=" ;
+GE : ">=" ;
+GT : ">" ;
+SL : "<<" ;
+SL_ASSIGN : "<<=" ;
+LE : "<=" ;
+LT : '<' ;
+BXOR : '^' ;
+BXOR_ASSIGN : "^=" ;
+BOR : '|' ;
+BOR_ASSIGN : "|=" ;
+LOR : "||" ;
+BAND : '&' ;
+BAND_ASSIGN : "&=" ;
+LAND : "&&" ;
+SEMI : ';' ;
+
+
+// Whitespace -- ignored
+WS : ( ' '
+ | '\t'
+ | '\f'
+ // handle newlines
+ | ( options {generateAmbigWarnings=false;}
+ : "\r\n" // Evil DOS
+ | '\r' // Macintosh
+ | '\n' // Unix (the right way)
+ )
+ { newline(); }
+ )+
+ { _ttype = Token.SKIP; }
+ ;
+
+// Single-line comments
+SL_COMMIT
+ : "//"
+ (~('\n'|'\r'))* ('\n'|'\r'('\n')?)
+ {$setType(Token.SKIP); newline();}
+ ;
+
+// multiple-line comments
+ML_COMMENT
+ : "/*"
+ ( /* '\r' '\n' can be matched in one alternative or by matching
+ '\r' in one iteration and '\n' in another. I am trying to
+ handle any flavor of newline that comes in, but the language
+ that allows both "\r\n" and "\r" and "\n" to all be valid
+ newline is ambiguous. Consequently, the resulting grammar
+ must be ambiguous. I'm shutting this warning off.
+ */
+ options {
+ generateAmbigWarnings=false;
+ }
+ :
+ { LA(2)!='/' }? '*'
+ | '\r' '\n' {newline();}
+ | '\r' {newline();}
+ | '\n' {newline();}
+ | ~('*'|'\n'|'\r')
+ )*
+ "*/"
+ {$setType(Token.SKIP);}
+ ;
+
+
+// character literals
+CHAR_LITERAL
+ : '\'' ( ESC | ~('\''|'\n'|'\r'|'\\') ) '\''
+ ;
+
+// string literals
+STRING_LITERAL
+ : '"' (ESC|~('"'|'\\'|'\n'|'\r'))* '"'
+ ;
+
+
+// escape sequence -- note that this is protected; it can only be called
+// from another lexer rule -- it will not ever directly return a token to
+// the parser
+// There are various ambiguities hushed in this rule. The optional
+// '0'...'9' digit matches should be matched here rather than letting
+// them go back to STRING_LITERAL to be matched. ANTLR does the
+// right thing by matching immediately; hence, it's ok to shut off
+// the FOLLOW ambig warnings.
+protected
+ESC
+ : '\\'
+ ( 'n'
+ | 'r'
+ | 't'
+ | 'b'
+ | 'f'
+ | '"'
+ | '\''
+ | '\\'
+ | ('u')+ HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT
+ | '0'..'3'
+ (
+ options {
+ warnWhenFollowAmbig = false;
+ }
+ : '0'..'7'
+ (
+ options {
+ warnWhenFollowAmbig = false;
+ }
+ : '0'..'7'
+ )?
+ )?
+ | '4'..'7'
+ (
+ options {
+ warnWhenFollowAmbig = false;
+ }
+ : '0'..'7'
+ )?
+ )
+ ;
+
+
+// hexadecimal digit (again, note it's protected!)
+protected
+HEX_DIGIT
+ : ('0'..'9'|'A'..'F'|'a'..'f')
+ ;
+
+
+// a dummy rule to force vocabulary to be all characters (except special
+// ones that ANTLR uses internally (0 to 2)
+protected
+VOCAB
+ : '\3'..'\377'
+ ;
+
+
+// an identifier. Note that testLiterals is set to true! This means
+// that after we match the rule, we look in the literals table to see
+// if it's a literal or really an identifer
+IDENT
+ options {testLiterals=true;}
+ : ('a'..'z'|'A'..'Z'|'_'|'$') ('a'..'z'|'A'..'Z'|'_'|'0'..'9'|'$')*
+ ;
+
+
+// a numeric literal
+NUM_INT
+ {boolean isDecimal=false; Token t=null;}
+ : '.' {_ttype = DOT;}
+ ( ('0'..'9')+ (EXPONENT)? (f1:FLOAT_SUFFIX {t=f1;})?
+ {
+ if (t != null && t.getText().toUpperCase().indexOf('F')>=0) {
+ _ttype = NUM_FLOAT;
+ }
+ else {
+ _ttype = NUM_DOUBLE; // assume double
+ }
+ }
+ )?
+
+ | ( '0' {isDecimal = true;} // special case for just '0'
+ ( ('x'|'X')
+ ( // hex
+ // the 'e'|'E' and float suffix stuff look
+ // like hex digits, hence the (...)+ doesn't
+ // know when to stop: ambig. ANTLR resolves
+ // it correctly by matching immediately. It
+ // is therefor ok to hush warning.
+ options {
+ warnWhenFollowAmbig=false;
+ }
+ : HEX_DIGIT
+ )+
+
+ | //float or double with leading zero
+ (('0'..'9')+ ('.'|EXPONENT|FLOAT_SUFFIX)) => ('0'..'9')+
+
+ | ('0'..'7')+ // octal
+ )?
+ | ('1'..'9') ('0'..'9')* {isDecimal=true;} // non-zero decimal
+ )
+ ( ('l'|'L') { _ttype = NUM_LONG; }
+
+ // only check to see if it's a float if looks like decimal so far
+ | {isDecimal}?
+ ( '.' ('0'..'9')* (EXPONENT)? (f2:FLOAT_SUFFIX {t=f2;})?
+ | EXPONENT (f3:FLOAT_SUFFIX {t=f3;})?
+ | f4:FLOAT_SUFFIX {t=f4;}
+ )
+ {
+ if (t != null && t.getText().toUpperCase() .indexOf('F') >= 0) {
+ _ttype = NUM_FLOAT;
+ }
+ else {
+ _ttype = NUM_DOUBLE; // assume double
+ }
+ }
+ )?
+ ;
+
+
+// a couple protected methods to assist in matching floating point numbers
+protected
+EXPONENT
+ : ('e'|'E') ('+'|'-')? ('0'..'9')+
+ ;
+
+
+protected
+FLOAT_SUFFIX
+ : 'f'|'F'|'d'|'D'
+ ;
diff --git a/tools/gnu/classpath/tools/java2xhtml/.cvsignore b/tools/gnu/classpath/tools/java2xhtml/.cvsignore
new file mode 100644
index 000000000..74e8a83b2
--- /dev/null
+++ b/tools/gnu/classpath/tools/java2xhtml/.cvsignore
@@ -0,0 +1,4 @@
+.deps
+.dirstamp
+.libs
+*.lo
diff --git a/tools/gnu/classpath/tools/java2xhtml/Java2xhtml.java b/tools/gnu/classpath/tools/java2xhtml/Java2xhtml.java
new file mode 100644
index 000000000..a7da7c4aa
--- /dev/null
+++ b/tools/gnu/classpath/tools/java2xhtml/Java2xhtml.java
@@ -0,0 +1,1337 @@
+/* gnu.classpath.tools.java2xhtml.Java2xhtml
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+/** Java2xhtml.java Version 0.9
+ * Produces an XHTML file from Java source code with syntax highlighting,
+ * includes additional options (line numbering, tab spacing, etc.)
+ * <P>
+ * NOTE: Common java naming structure is assumed
+ * Capitalize the first letter that appears in a class or interface name
+ * Use lowercase for the first letter in a method or variable name
+ * Use only uppercase letters when naming constants
+ *
+ * @version 0.9, March 2003
+ * @author Shayne Steele
+ */
+package gnu.classpath.tools.java2xhtml;
+
+import java.io.*;
+import java.util.*;
+
+public class Java2xhtml
+{
+ //--- define CSS classes for individual output elements
+
+ private static final String sourceCodeStyle = "source";
+ private static final String lineNumberStyle = "line-number even";
+ private static final String modulusLineNumberStyle = "line-number odd";
+
+ private static final String keywordStyle = "keyword";
+ private static final String methodStyle = "method member";
+ private static final String variableStyle = "variable member";
+ private static final String singleLineCommentStyle = "line comment";
+ private static final String traditionalCommentStyle = "c comment";
+ private static final String javadocCommentStyle = "javadoc comment";
+ private static final String javadocTagStyle = "javadoc tag";
+ private static final String importNameStyle = "import header type";
+ private static final String packageNameStyle = "package header type";
+ private static final String primitiveTypeStyle = "primitive type";
+ private static final String nonPrimitiveTypeStyle = "non-primitive type";
+ private static final String constructorStyle = "constructor member";
+ private static final String constantStyle = "constant member";
+ private static final String doubleQuoteStyle = "double quote";
+ private static final String singleQuoteStyle = "single quote";
+ private static final String numericLiteralStyle = "numeric literal";
+ private static final String primitiveLiteralStyle = "primitive literal";
+
+ private static final String iconStyle = "icon";
+
+
+
+ // parse the command line arguments
+ // give a decent responce for bad input
+ // call the HTMLifier on good input
+ public static void main(String args[])
+ {
+ // parse the invokation arguments
+ if (args.length < 1 || args.length > 3) // invoked program incorrectly
+ {
+ System.out.println("Java2xhtml Version 0.9 (C) 2005 Free Software Foundation");
+ System.out.println(" Produces an XHTML file of Java source" +
+ " code with syntax highlighting,");
+ System.out.println(" includes additional options " +
+ "(line numbering, tab spacing, etc.)");
+ System.out.println(" This tool is part of GNU Classpath.");
+ System.out.println(" GNU Classpath is free software; you can redistribute it and/or modify");
+ System.out.println(" it under the terms of the GNU General Public License as published by");
+ System.out.println(" the Free Software Foundation; either version 2, or (at your option)");
+ System.out.println(" any later version.");
+ System.out.println(" NOTE: Common java naming structure is " +
+ "assumed");
+ System.out.println("");
+ System.out.println("USAGE:");
+ System.out.println("java [java options] Java2xhtml " +
+ "source.java [options file] " +
+ "[output file]");
+ System.out.println("");
+ System.out.println(" - java is the name of the Java interpreter");
+ System.out.println(" - [java options] are the optional options " +
+ "of the Java interpreter");
+ System.out.println(" - Java2xhtml is the name of this " +
+ "application");
+ System.out.println(" - source is a file or the directory to the " +
+ "Java source file(s)");
+ System.out.println(" - [options file] is the optional " +
+ "path of a file with");
+ System.out.println(" a structure like this:");
+ System.out.println(" externalStyleSheetName=file_name" +
+ " (default style.css)");
+ System.out.println(" tabSize=integer (default value is 4)");
+ System.out.println(" extraIndentation=integer " +
+ "(default value is 0)");
+ System.out.println(" lineModulus=integer (default value 5)");
+ System.out.println(" isCodeSnippet=boolean" +
+ " (default false)");
+ System.out.println(" isXHTML_1_1=boolean" +
+ " (default true)");
+ System.out.println(" hasInternalStyleSheet=boolean" +
+ " (default true)");
+ System.out.println(" hasExternalStyleSheet=boolean" +
+ " (default true)");
+ System.out.println(" hasTitle=boolean" +
+ " (default false)");
+ System.out.println(" hasLegend=boolean" +
+ " (default false)");
+ System.out.println(" hasAllBoldSourceCode=boolean" +
+ " (default false)");
+ System.out.println(" hasLineNumbers=boolean" +
+ " (default false)");
+ System.out.println(" hasLineModulusDrawnLines=boolean" +
+ " (default false)");
+ System.out.println(" hasLineModulusCodeBlocks=boolean" +
+ " (default false)");
+ System.out.println(" hasFooter=boolean" +
+ " (default false)");
+ System.out.println(" hasFooterIcons=boolean" +
+ " (default false)");
+ System.out.println(" hasFooterDate=boolean" +
+ " (default true)");
+ System.out.println(" NOTE: filename must end with '.prop'");
+ System.out.println(" Default [options file] is " +
+ "options.prop");
+ System.out.println(" - [output file] is name of the XHTML file " +
+ "that is produced");
+ System.out.println(" Default [output file] is source_java.html");
+ System.out.println("");
+ System.out.println("Output: source.java --> [output file]");
+ System.out.println(" Default Output is ");
+ System.out.println(" source.java --> source_java.html");
+ System.out.println("");
+ System.out.println("Examples of calling the program:");
+ System.out.println(" process one file (say Java2xhtml.java):");
+ System.out.println(" java Java2xhtml Java2xhtml.java");
+ System.out.println(" process one directory (say C:\\HOME):");
+ System.out.println(" java Java2xhtml C:\\HOME");
+ System.out.println(" process one directory (say C:\\HOME with a " +
+ "given options file (options.prop)):");
+ System.out.println(" java Java2xhtml C:\\HOME options.prop");
+ }
+ else
+ {
+ // invoked program correctly, now get command line arguments
+ // get the source file name
+ String sourceName;
+ sourceName = args[0];
+ // make sure that the source file exist and if so HTMLify it
+ File sourceFilePath = new File(sourceName);
+ if (sourceFilePath.exists())
+ {
+ // good pathname so HTMLify it
+ // get the default html options file name
+ String propertiesFileName = "options.prop";
+ // create a unique default html file name,
+ // bubba.java -> bubba_java.html
+ String htmlFileName = sourceName.replace('.', '_') + ".html";
+ if (args.length == 2 || args.length == 3)
+ {
+ if (args[1].endsWith(".prop"))
+ {
+ // get the user supplied html options file name
+ propertiesFileName = args[1];
+ }
+ else
+ {
+ // get the user supplied html outputfile name
+ htmlFileName = args[1];
+ }
+ }
+ if (args.length == 3)
+ {
+ if (args[2].endsWith(".prop"))
+ {
+ // get the user supplied html options file name
+ propertiesFileName = args[2];
+ }
+ else
+ {
+ // get the user supplied html outputfile name
+ htmlFileName = args[2];
+ }
+ }
+ new Java2xhtml(propertiesFileName, sourceFilePath,
+ htmlFileName);
+ }
+ else // source file does not exist, print message and exit normally
+ {
+ System.out.println("The source parameter must be an existent" +
+ " file or directory");
+ System.out.println("Run Java2xHtml without parameters for " +
+ "help");
+ }
+ }
+ }
+
+ // collect various sets of keywords
+ static Collection keywordCollection;
+ static Collection primitiveTypeCollection;
+ static Collection primitiveLiteralCollection;
+ static Collection javadocTagCollection;
+
+ // all these variables are changeable by a options file
+ int extraIndentation = 0;
+ int tabSize = 4;
+ int lineModulus = 5;
+ boolean hasLegend = false;
+ boolean hasLineNumbers = false;
+ boolean hasLineModulusDrawnLines = false;
+ boolean hasLineModulusCodeBlocks = false;
+ boolean hasFooter = false;
+ boolean hasFooterIcons = false;
+ boolean hasFooterDate = true;
+ boolean isCodeSnippet = false;
+ boolean isXHTML_1_1 = true;
+ boolean hasTitle = false;
+ boolean hasAllBoldSourceCode = false;
+ boolean hasInternalStyleSheet = true;
+ boolean hasExternalStyleSheet = true;
+ String externalStyleSheetName = "style.css";
+
+ static
+ {
+ // collection type is Hashset for unique elements and fast retieval
+ String keywordArray[] =
+ {
+ "abstract", "default", "if", "private",
+ "do", "implements", "protected", "throws",
+ "break", "import", "public", "transient",
+ "else", "instanceof", "return", "try",
+ "case", "extends", "throw", "static",
+ "catch", "final", "interface", "while",
+ "volatile", "finally", "super", "synchronized",
+ "class", "native", "switch", "package",
+ "const", "for", "new", "goto",
+ "continue", "this", "assert", "strictfp"
+ };
+ keywordCollection = new HashSet(Arrays.asList(keywordArray));
+ String primitiveTypeArray[] =
+ {
+ "boolean", "char", "byte", "short", "int",
+ "long", "float", "double", "void"
+ };
+ primitiveTypeCollection =
+ new HashSet(Arrays.asList(primitiveTypeArray));
+ String primitiveLiteralArray[]=
+ {
+ "false", "null", "true"
+ };
+ primitiveLiteralCollection =
+ new HashSet(Arrays.asList(primitiveLiteralArray));
+ String javadocTagArray[]=
+ {
+ "see", "author", "version", "param", "return", "exception",
+ "deprecated", "throws", "link", "since", "serial",
+ "serialField","serialData", "beaninfo"
+ };
+ javadocTagCollection = new HashSet(Arrays.asList(javadocTagArray));
+ }
+
+ public Java2xhtml()
+ {
+ }
+
+ // create the various keyword collections
+ // parse the html options file
+ Java2xhtml(String propertiesFileName, File sourceFilePath,
+ String htmlFileName)
+ {
+ // get html properties (use defaults if necessary)
+ File propertiesFilePath = new File (propertiesFileName);
+ if (propertiesFilePath.exists())
+ {
+ // html properies file exist try parsing it
+ try
+ {
+ InputStream propertiesFile =
+ new FileInputStream(propertiesFileName);
+ Properties htmlProperties = new Properties();
+ htmlProperties.load(propertiesFile);
+ propertiesFile.close();
+ setProperties(htmlProperties);
+ }
+ catch (IOException exception)
+ {
+ System.out.println(exception);
+ }
+ }
+ if (sourceFilePath.isFile())
+ {
+ // process the file
+ processFile(sourceFilePath, htmlFileName);
+ }
+ else if (sourceFilePath.isDirectory())
+ {
+ // process a directory
+ File [] sourceFilePathArray = sourceFilePath.listFiles();
+ for (int i = 0; i < sourceFilePathArray.length; i++)
+ {
+ if (((sourceFilePathArray[i]).getName()).endsWith(".java"))
+ {
+ // process each file that ends in .java
+ // create a unique default html file name,
+ // bubba.java -> bubba_java.html
+ htmlFileName = ((sourceFilePathArray[i]).getName()).replace(
+ '.', '_') + ".html";
+ processFile(sourceFilePathArray[i], htmlFileName);
+ }
+ }
+ }
+ }
+
+ public void setProperties(Properties htmlProperties)
+ {
+ hasLegend
+ = Boolean.valueOf(htmlProperties.getProperty("hasLegend",
+ "false")).booleanValue();
+ extraIndentation
+ = Integer.parseInt(htmlProperties.getProperty("extraIndentation", "0"));
+ tabSize
+ = Integer.parseInt(htmlProperties.getProperty("tabSize", "4"));
+ hasLineNumbers
+ = Boolean.valueOf(htmlProperties.getProperty("hasLineNumbers",
+ "false")).booleanValue();
+ lineModulus
+ = Integer.parseInt(htmlProperties.getProperty("lineModulus", "5"));
+ hasLineModulusDrawnLines
+ = Boolean.valueOf(htmlProperties.getProperty("hasLineModulusDrawnLines",
+ "false")).booleanValue();
+ hasLineModulusCodeBlocks
+ = Boolean.valueOf(htmlProperties.getProperty("hasLineModulusCodeBlocks",
+ "false")).booleanValue();
+ hasFooter
+ = Boolean.valueOf(htmlProperties.getProperty("hasFooter",
+ "false")).booleanValue();
+ hasFooterIcons
+ = Boolean.valueOf(htmlProperties.getProperty("hasFooterIcons",
+ "false")).booleanValue();
+ hasFooterDate
+ = Boolean.valueOf(htmlProperties.getProperty("hasFooterDate",
+ "true")).booleanValue();
+ isXHTML_1_1
+ = Boolean.valueOf(htmlProperties.getProperty("isXHTML_1_1",
+ "true")).booleanValue();
+ isCodeSnippet
+ = Boolean.valueOf(htmlProperties.getProperty("isCodeSnippet",
+ "false")).booleanValue();
+ hasTitle
+ = Boolean.valueOf(htmlProperties.getProperty("hasTitle",
+ "false")).booleanValue();
+ hasAllBoldSourceCode
+ = Boolean.valueOf(htmlProperties.getProperty("hasAllBoldSourceCode",
+ "false")).booleanValue();
+ hasInternalStyleSheet
+ = Boolean.valueOf(htmlProperties.getProperty("hasInternalStyleSheet",
+ "true")).booleanValue();
+ hasExternalStyleSheet
+ = Boolean.valueOf(htmlProperties.getProperty("hasExternalStyleSheet",
+ "true")).booleanValue();
+ externalStyleSheetName
+ = htmlProperties.getProperty("externalStyleSheetName", "style.css");
+ }
+
+
+ // read the file and put it into a stringbuffer
+ void processFile(File sourceFilePath, String htmlFileName)
+ {
+ // open the file, copy it to a Stringbuffer , process into an
+ // HTMLified String and convert result into an HTML file
+ try
+ {
+ BufferedReader sourceReader =
+ new BufferedReader(new FileReader(sourceFilePath));
+ StringBuffer bufferIn = new StringBuffer();
+ int readInInt = 0;
+ char presentChar = 0;
+ // copy file into a Stringbuffer
+ while (readInInt != -1) // -1 value means end of stream/file
+ {
+ // put the file into a Stringbuffer
+ readInInt= sourceReader.read();
+ presentChar = ((readInInt >= 0) ? (char) readInInt : 0);
+ bufferIn.append(presentChar);
+ }
+ sourceReader.close();
+ BufferedWriter tempBufferedWriter =
+ new BufferedWriter(new FileWriter(htmlFileName));
+ tempBufferedWriter.write(makeHTML(bufferIn,
+ sourceFilePath.getName()));
+ tempBufferedWriter.close();
+ System.out.println(sourceFilePath.getName() + " --> " +
+ htmlFileName);
+ }
+ catch (IOException exception)
+ {
+ System.out.println(exception);
+ }
+ }
+
+ // constant 'States' java source code can be in
+ public final static class State
+ {
+ public final static State TEXT = new State();
+ public final static State IMPORT_NAME = new State();
+ public final static State PARAM_VARIABLE = new State();
+ public final static State JAVADOC = new State();
+ public final static State PACKAGE_NAME = new State();
+ public final static State DOUBLE_QUOTE = new State();
+ public final static State SINGLE_QUOTE = new State();
+ public final static State TRADITIONAL_COMMENT = new State();
+ public final static State LINE_COMMENT = new State();
+
+ // empty constructor
+ private State()
+ {
+ // empty body
+ }
+ }
+
+ // Convert java source code StringBufffer into colorized (and tab spaced)
+ // HTML String .
+ // Assumes that Java naming convention is used
+ // Uses a very basic state machine design.
+ public String makeHTML(StringBuffer bufferIn, String sourceFileName)
+ {
+ int codeLineNumber = 0;
+ boolean isNewLine = true;
+ boolean isNewBlock = true;
+ int identifierLength = 0;
+ int qualifiedIdentifierLength = 0;
+ int presentIndex = -1;
+ int spaceLength = 0;
+ int saveIndex = 0;
+ char presentChar = 0;
+ State presentState = State.TEXT;
+ StringBuffer bufferOut = new StringBuffer(8192);
+ if (!isCodeSnippet)
+ {
+ bufferOut.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n");
+ if (isXHTML_1_1)
+ {
+ bufferOut.append("<!DOCTYPE html PUBLIC " +
+ "\"-//W3C//DTD XHTML 1.1//EN\"\r\n");
+ bufferOut.append(" \"http://www.w3.org/TR/xhtml11/DTD/" +
+ "xhtml11.dtd\">\r\n");
+ bufferOut.append("<html xmlns=\"http://www.w3.org/1999/xhtml\""+
+ " xml:lang=\"en\">\r\n");
+ }
+ else
+ {
+ bufferOut.append("<!DOCTYPE html PUBLIC " +
+ "\"-//W3C//DTD XHTML 1.0 Strict//EN\"\r\n");
+ bufferOut.append(" \"http://www.w3.org/TR/xhtml1/DTD/" +
+ "xhtml1-strict.dtd\">\r\n");
+ bufferOut.append("<html xmlns=\"http://www.w3.org/1999/xhtml\""+
+ " xml:lang=\"en\" lang=\"en\">\r\n");
+ }
+ bufferOut.append(" <head>\r\n");
+ bufferOut.append(" <title>\r\n");
+ bufferOut.append(" " + sourceFileName + "\r\n");
+ bufferOut.append(" </title>\r\n");
+ bufferOut.append(" <meta name=\"generator\"\r\n");
+ bufferOut.append(" content=\"Java2xhtml 0.9\" />\r\n");
+ if (hasInternalStyleSheet)
+ {
+ bufferOut.append(" <style type=\"text/css\">\r\n");
+ bufferOut.append(" <!-- /* <![CDATA[ */\r\n");
+ bufferOut.append(" ." + sourceCodeStyle + "\r\n");
+ bufferOut.append(" {\r\n");
+ bufferOut.append(" color: #000000;\r\n");
+ bufferOut.append(" background-color: #FFFFFF;\r\n");
+ if (hasAllBoldSourceCode)
+ {
+ bufferOut.append(" font-weight: bold;\r\n");
+ }
+ bufferOut.append(" }\r\n");
+ bufferOut.append(" ." + lineNumberStyle + "\r\n");
+ bufferOut.append(" {\r\n");
+ bufferOut.append(" font-weight: normal;\r\n");
+ bufferOut.append(" color: #000000;\r\n");
+ bufferOut.append(" background-color: transparent;\r\n");
+ bufferOut.append(" }\r\n");
+ if (lineModulus > 0)
+ {
+ bufferOut.append(" ." + modulusLineNumberStyle + "\r\n");
+ bufferOut.append(" {\r\n");
+ bufferOut.append(" font-weight: bold;\r\n");
+ bufferOut.append(" color: #000000;\r\n");
+ bufferOut.append(" background-color: ");
+ bufferOut.append("transparent;\r\n");
+ bufferOut.append(" }\r\n");
+ if (hasLineModulusDrawnLines)
+ {
+ bufferOut.append(" .modulusLineStyle\r\n");
+ bufferOut.append(" {\r\n");
+ bufferOut.append(" text-decoration: ");
+ bufferOut.append("line-through;\r\n");
+ bufferOut.append(" color: #000000;\r\n");
+ bufferOut.append(" background-color: ");
+ bufferOut.append("transparent;\r\n");
+ bufferOut.append(" }\r\n");
+ }
+ if (hasLineModulusCodeBlocks)
+ {
+ bufferOut.append(" .modulusBlockPREStyle\r\n");
+ bufferOut.append(" {\r\n");
+ bufferOut.append(" margin: 0em\r\n");
+ bufferOut.append(" }\r\n");
+ bufferOut.append(" .modulusBlockStyle\r\n");
+ bufferOut.append(" {\r\n");
+ bufferOut.append(" color: #000000;\r\n");
+ bufferOut.append(" background-color: ");
+ bufferOut.append("#CCCCCC;\r\n");
+ bufferOut.append(" }\r\n");
+ }
+ }
+ bufferOut.append(" ." + keywordStyle + "\r\n");
+ bufferOut.append(" {\r\n");
+ bufferOut.append(" color: #9900FF;\r\n");
+ bufferOut.append(" background-color: transparent;\r\n");
+ bufferOut.append(" }\r\n");
+ bufferOut.append(" ." + methodStyle + "\r\n");
+ bufferOut.append(" {\r\n");
+ bufferOut.append(" color: #0000FF;\r\n");
+ bufferOut.append(" background-color: transparent;\r\n");
+ bufferOut.append(" }\r\n");
+ bufferOut.append(" ." + variableStyle + "\r\n");
+ bufferOut.append(" {\r\n");
+ bufferOut.append(" color: #CC9933;\r\n");
+ bufferOut.append(" background-color: transparent;\r\n");
+ bufferOut.append(" }\r\n");
+ bufferOut.append(" ." + singleLineCommentStyle + "\r\n");
+ bufferOut.append(" {\r\n");
+ bufferOut.append(" color: #CC3333;\r\n");
+ bufferOut.append(" background-color: transparent;\r\n");
+ bufferOut.append(" }\r\n");
+ bufferOut.append(" ." + traditionalCommentStyle + "\r\n");
+ bufferOut.append(" {\r\n");
+ bufferOut.append(" color: #FF0000;\r\n");
+ bufferOut.append(" background-color: transparent;\r\n");
+ bufferOut.append(" }\r\n");
+ bufferOut.append(" ." + javadocCommentStyle + "\r\n");
+ bufferOut.append(" {\r\n");
+ bufferOut.append(" color: #CC0033;\r\n");
+ bufferOut.append(" background-color: transparent;\r\n");
+ bufferOut.append(" }\r\n");
+ bufferOut.append(" ." + javadocTagStyle + "\r\n");
+ bufferOut.append(" {\r\n");
+ bufferOut.append(" color: #0099CC;\r\n");
+ bufferOut.append(" background-color: transparent;\r\n");
+ bufferOut.append(" }\r\n");
+ bufferOut.append(" ." + importNameStyle + "\r\n");
+ bufferOut.append(" {\r\n");
+ bufferOut.append(" color: #33CCCC;\r\n");
+ bufferOut.append(" background-color: transparent;\r\n");
+ bufferOut.append(" }\r\n");
+ bufferOut.append(" ." + packageNameStyle + "\r\n");
+ bufferOut.append(" {\r\n");
+ bufferOut.append(" color: #339999;\r\n");
+ bufferOut.append(" background-color: transparent;\r\n");
+ bufferOut.append(" }\r\n");
+ bufferOut.append(" ." + primitiveTypeStyle + "\r\n");
+ bufferOut.append(" {\r\n");
+ bufferOut.append(" color: #009900;\r\n");
+ bufferOut.append(" background-color: transparent;\r\n");
+ bufferOut.append(" }\r\n");
+ bufferOut.append(" ." + nonPrimitiveTypeStyle + "\r\n");
+ bufferOut.append(" {\r\n");
+ bufferOut.append(" color: #009966;\r\n");
+ bufferOut.append(" background-color: transparent;\r\n");
+ bufferOut.append(" }\r\n");
+ bufferOut.append(" ." + constructorStyle + "\r\n");
+ bufferOut.append(" {\r\n");
+ bufferOut.append(" color: #3300CC;\r\n");
+ bufferOut.append(" background-color: transparent;\r\n");
+ bufferOut.append(" }\r\n");
+ bufferOut.append(" ." + constantStyle + "\r\n");
+ bufferOut.append(" {\r\n");
+ bufferOut.append(" color: #666666;\r\n");
+ bufferOut.append(" background-color: transparent;\r\n");
+ bufferOut.append(" }\r\n");
+ bufferOut.append(" ." + doubleQuoteStyle + "\r\n");
+ bufferOut.append(" {\r\n");
+ bufferOut.append(" color: #996633;\r\n");
+ bufferOut.append(" background-color: transparent;\r\n");
+ bufferOut.append(" font-style: italic;\r\n");
+ bufferOut.append(" }\r\n");
+ bufferOut.append(" ." + singleQuoteStyle + "\r\n");
+ bufferOut.append(" {\r\n");
+ bufferOut.append(" color: #663333;\r\n");
+ bufferOut.append(" background-color: transparent;\r\n");
+ bufferOut.append(" font-style: oblique;\r\n");
+ bufferOut.append(" }\r\n");
+ bufferOut.append(" ." + numericLiteralStyle + "\r\n");
+ bufferOut.append(" {\r\n");
+ bufferOut.append(" color: #333300;\r\n");
+ bufferOut.append(" background-color: transparent;\r\n");
+ bufferOut.append(" }\r\n");
+ bufferOut.append(" ." + primitiveLiteralStyle + "\r\n");
+ bufferOut.append(" {\r\n");
+ bufferOut.append(" color: #006600;\r\n");
+ bufferOut.append(" background-color: transparent;\r\n");
+ bufferOut.append(" }\r\n");
+ if (hasFooterIcons)
+ {
+ bufferOut.append(" ." + iconStyle + "\r\n");
+ bufferOut.append(" {\r\n");
+ bufferOut.append(" border-style: none;\r\n");
+ bufferOut.append(" }\r\n");
+ }
+ if (hasTitle)
+ {
+ bufferOut.append(" #title\r\n");
+ bufferOut.append(" {\r\n");
+ bufferOut.append(" text-align: center;\r\n");
+ bufferOut.append(" font-size: xx-large;\r\n");
+ bufferOut.append(" }\r\n");
+ }
+ if (hasLegend)
+ {
+ bufferOut.append(" #legendTitle\r\n");
+ bufferOut.append(" {\r\n");
+ bufferOut.append(" text-align: center;\r\n");
+ bufferOut.append(" font-size: x-large;\r\n");
+ bufferOut.append(" }\r\n");
+ bufferOut.append(" #legend\r\n");
+ bufferOut.append(" {\r\n");
+ bufferOut.append(" font-family: monospace;\r\n");
+ bufferOut.append(" font-size: large;\r\n");
+ bufferOut.append(" }\r\n");
+ }
+ if (hasFooter)
+ {
+ bufferOut.append(" #footer\r\n");
+ bufferOut.append(" {\r\n");
+ bufferOut.append(" font-size: xx-small;\r\n");
+ bufferOut.append(" }\r\n");
+ }
+ bufferOut.append(" /* ]]> */ -->\r\n");
+ bufferOut.append(" </style>\r\n");
+ }
+
+ if (hasExternalStyleSheet)
+ {
+ bufferOut.append(" <link rel=\"stylesheet\" " +
+ "type=\"text/css\" href=\"" +
+ externalStyleSheetName + "\" />\r\n");
+ }
+ bufferOut.append(" </head>\r\n");
+ bufferOut.append(" <body>\r\n");
+ }
+ if (hasTitle)
+ {
+ bufferOut.append(" <div id=\"title\">\r\n");
+ bufferOut.append(" " + sourceFileName + "\r\n");
+ bufferOut.append(" </div>\r\n");
+ bufferOut.append(" <hr />\r\n");
+ }
+ if (hasLegend)
+ {
+ bufferOut.append(" <div id=\"legendTitle\">\r\n");
+ bufferOut.append(" Legend\r\n");
+ bufferOut.append(" </div>\r\n");
+ bufferOut.append(" <div class=\"" + sourceCodeStyle + "\">\r\n");
+ bufferOut.append(" <div id=\"legend\">\r\n");
+ bufferOut.append(" <span class=\"" + keywordStyle + "\">");
+ bufferOut.append("keyword</span>\r\n");
+ bufferOut.append(" <span class=\"" + methodStyle + "\">");
+ bufferOut.append("method</span>\r\n");
+ bufferOut.append(" <span class=\"" + variableStyle + "\">variable" +
+ "</span>\r\n");
+ bufferOut.append(" <span class=\"" + singleLineCommentStyle + "\">" +
+ "singleLineComment</span>\r\n");
+ bufferOut.append(" <span class=\"" + traditionalCommentStyle + "\">" +
+ "traditionalComment</span>\r\n");
+ bufferOut.append(" <span class=\"" + javadocCommentStyle + "\">" +
+ "javadocComment</span>\r\n");
+ bufferOut.append(" <span class=\"" + javadocTagStyle + "\">javadocTag" +
+ "</span>\r\n");
+ bufferOut.append(" <span class=\"" + importNameStyle + "\">" +
+ "importName</span>\r\n");
+ bufferOut.append(" <span class=\"" + packageNameStyle + "\">" +
+ "packageName</span>\r\n");
+ bufferOut.append(" <span class=\"" + primitiveTypeStyle + "\">" +
+ "primitiveType</span>\r\n");
+ bufferOut.append(" <span class=\"" + nonPrimitiveTypeStyle + "\">" +
+ "nonPrimitiveType</span>\r\n");
+ bufferOut.append(" <span class=\"" + constructorStyle + "\">" +
+ "constructor</span>\r\n");
+ bufferOut.append(" <span class=\"" + constantStyle + "\">" +
+ "constant</span>\r\n");
+ bufferOut.append(" <span class=\"" + doubleQuoteStyle + "\">" +
+ "doubleQuote</span>\r\n");
+ bufferOut.append(" <span class=\"" + singleQuoteStyle + "\">" +
+ "singleQuote</span>\r\n");
+ bufferOut.append(" <span class=\"" + numericLiteralStyle + "\">" +
+ "numericLiteral</span>\r\n");
+ bufferOut.append(" <span class=\"" + primitiveLiteralStyle + "\">" +
+ "primitiveLiteral</span>\r\n");
+ bufferOut.append(" </div>\r\n");
+ bufferOut.append(" </div>\r\n");
+ bufferOut.append(" <hr />\r\n");
+ }
+ bufferOut.append(" <div class=\"" + sourceCodeStyle + "\">\r\n");
+ if (hasLineModulusCodeBlocks)
+ {
+ bufferOut.append("<pre class=\"modulusBlockPREStyle\">\r\n");
+ }
+ else
+ {
+ bufferOut.append("<pre>\r\n");
+ }
+ // process the input Java code Stringbuffer
+ // subtract 2 from the bufferIn.length() to get EOF marker
+ while (presentIndex++ < (bufferIn.length() - 2))
+ {
+ for (int i = 0; i < extraIndentation; i++)
+ {
+ bufferOut.append(" ");
+ }
+ if ((hasLineNumbers || hasLineModulusCodeBlocks) && isNewLine)
+ {
+ // add line numbers if desired
+ // line numbers are 1 - 9999 then rotate line numbers
+ codeLineNumber = (++codeLineNumber)%10000;
+ if ((lineModulus > 0) && hasLineModulusCodeBlocks &&
+ (codeLineNumber%lineModulus == 1))
+ {
+ if (isNewBlock)
+ {
+ if ((State.TRADITIONAL_COMMENT == presentState) ||
+ (State.JAVADOC == presentState))
+ {
+ bufferOut.insert((bufferOut.length() -
+ ("\r\n").length()),
+ "</span>");
+ }
+ bufferOut.append("</pre>\r\n");
+ bufferOut.append(" <div class=");
+ bufferOut.append("\"modulusBlockStyle\">");
+ bufferOut.append("\r\n<pre class=\"");
+ bufferOut.append("modulusBlockPREStyle\">\r\n");
+ if (State.TRADITIONAL_COMMENT == presentState)
+ {
+ bufferOut.append("<span class=" +
+ "\"" + traditionalCommentStyle + "\">");
+ }
+ if (State.JAVADOC == presentState)
+ {
+ bufferOut.append("<span class=" +
+ "\"" + javadocCommentStyle + "\">");
+ }
+ }
+ isNewBlock = !isNewBlock;
+ }
+ // make straight columns of line numbers
+ if (codeLineNumber < 1000)
+ {
+ bufferOut.append(" ");
+ }
+ if (codeLineNumber < 100)
+ {
+ bufferOut.append(" ");
+ }
+ if (codeLineNumber < 10)
+ {
+ bufferOut.append(" ");
+ }
+ bufferOut.append("<a name=\"line.");
+ bufferOut.append(codeLineNumber);
+ bufferOut.append("\">");
+
+ if (hasLineNumbers)
+ {
+ if ((lineModulus > 0) && (codeLineNumber%lineModulus == 0))
+ {
+ bufferOut.append("<span class=" +
+ "\"" + modulusLineNumberStyle + "\">");
+ bufferOut.append(codeLineNumber);
+ bufferOut.append(": </span>");
+ if (hasLineModulusDrawnLines)
+ {
+ // compute spaceLength so a line can be drawn
+ while ((presentIndex != (bufferIn.length() - 1)) &&
+ ((Character.isSpaceChar(
+ bufferIn.charAt(presentIndex))) ||
+ (bufferIn.charAt(presentIndex) == '\t')))
+ {
+ // for each tab, insert tabSize spaces
+ if (bufferIn.charAt(presentIndex) == '\t')
+ {
+ for (int i = 0; i < tabSize; i++)
+ {
+ bufferIn.insert(presentIndex + 1, " ");
+ }
+ presentIndex++;
+ continue;
+ }
+ if (' ' == bufferIn.charAt(presentIndex))
+ {
+ // read a space so place a space
+ bufferOut.append(" ");
+ spaceLength += (" ").length();
+ }
+ else
+ {
+ // a white space character was read
+ bufferOut.append(bufferIn.charAt(
+ presentIndex));
+ ++spaceLength;
+ }
+ presentIndex++;
+ }
+ // check if line is empty
+ // (no printable characters on line)
+ if ((presentIndex == (bufferIn.length() - 1)) ||
+ (Character.isWhitespace(bufferIn.charAt(
+ presentIndex))))
+ {
+ spaceLength = 0;
+ }
+ // draw the line
+ if (spaceLength > 1)
+ {
+ bufferOut.insert((bufferOut.length() -
+ spaceLength), "<span class=" +
+ "\"modulusLineStyle\">");
+ bufferOut.insert((bufferOut.length() -
+ (" ").length()), "</span>");
+ }
+ spaceLength = 0;
+ }
+ }
+ else
+ {
+ // line numbers are in lineNumberColor
+ bufferOut.append("<span class=\"" + lineNumberStyle + "\">");
+ bufferOut.append(codeLineNumber);
+ bufferOut.append(":</span> ");
+ }
+ }
+ isNewLine = false;
+
+ bufferOut.append("</a>");
+ }
+ // a state machine
+ presentChar = bufferIn.charAt(presentIndex);
+ if ((Character.isJavaIdentifierPart(presentChar)) ||
+ ((State.IMPORT_NAME == presentState) && (presentChar == '*')))
+ {
+ // this is an identifier
+ bufferOut.append(presentChar);
+ identifierLength++;
+ continue; // keep adding characters until identifier is done
+ }
+ if (identifierLength > 0)
+ {
+ // identifier
+ qualifiedIdentifierLength =
+ qualifiedIdentifierLength + identifierLength;
+ if (bufferIn.charAt(presentIndex) == '.')
+ {
+ // qualified identifier
+ bufferOut.append(presentChar);
+ qualifiedIdentifierLength++;
+ identifierLength = 0;
+ continue; // keep adding characters to qualified identifier
+ }
+ String identifier =
+ bufferOut.substring(bufferOut.length() -
+ identifierLength);
+ if ((State.PARAM_VARIABLE == presentState))
+ {
+ // any identifier after a param in a javadoc is assumed to
+ // be a variable
+ bufferOut.insert(bufferOut.length() -
+ qualifiedIdentifierLength,
+ "<span class=\"" + variableStyle + "\">");
+ bufferOut.append("</span>");
+ presentState = State.JAVADOC;
+ }
+ else if (State.JAVADOC == presentState)
+ {
+ // in javadoc state
+ if ((javadocTagCollection.contains(identifier)) &&
+ (bufferIn.charAt(presentIndex -
+ (identifierLength + 1)) == '@'))
+ {
+ // identifier is a javadocTag
+ bufferOut.insert(bufferOut.length() - identifierLength,
+ "<span class=\"" + javadocTagStyle + "\">");
+ bufferOut.append("</span>");
+ if (("param").equals(identifier))
+ {
+ // any identifier after a param is assumed to
+ // be a variable, get into a state to do this
+ presentState = State.PARAM_VARIABLE;
+ }
+ }
+ }
+ else if (State.IMPORT_NAME == presentState)
+ {
+ // import identifier
+ bufferOut.insert(bufferOut.length() -
+ qualifiedIdentifierLength,
+ "<span class=\"" + importNameStyle + "\">");
+ bufferOut.append("</span>");
+ presentState = State.TEXT;
+ }
+ else if (State.PACKAGE_NAME == presentState)
+ {
+ // package identifier
+ bufferOut.insert(bufferOut.length() -
+ qualifiedIdentifierLength,
+ "<span class=\"" + packageNameStyle + "\">");
+ bufferOut.append("</span>");
+ presentState = State.TEXT;
+ }
+ else if (State.TEXT == presentState)
+ {
+ if (keywordCollection.contains(identifier))
+ {
+ // identifier is a keyword
+ bufferOut.insert(bufferOut.length() -
+ qualifiedIdentifierLength,
+ "<span class=\"" + keywordStyle + "\">");
+ bufferOut.append("</span>");
+ if (("import").equals(identifier))
+ {
+ // anything after an import in text mode must be
+ // an import name, so enter state to process this
+ presentState = State.IMPORT_NAME;
+ }
+ else if (("package").equals(identifier))
+ {
+ // anything after an package in text mode must be
+ // an package name, so enter state to process this
+ presentState = State.PACKAGE_NAME;
+ }
+ }
+ else if (primitiveTypeCollection.contains(identifier))
+ {
+ // identifier is a primitive type
+ bufferOut.insert(bufferOut.length() -
+ qualifiedIdentifierLength,
+ "<span class=\"" + primitiveTypeStyle + "\">");
+ bufferOut.append("</span>");
+ }
+ else if ((identifier.equals(identifier.toUpperCase())) &&
+ (!(Character.isDigit(identifier.charAt(0)))))
+ {
+ // identifier is a constant
+ bufferOut.insert(bufferOut.length() -
+ qualifiedIdentifierLength,
+ "<span class=\"" + constantStyle + "\">");
+ bufferOut.append("</span>");
+ }
+ else if (Character.isUpperCase(identifier.charAt(0)))
+ {
+ // identifier is a constructor or non-primitive type
+ // eat white space
+ saveIndex = presentIndex;
+ while (Character.isWhitespace(
+ bufferIn.charAt(saveIndex++)))
+ {
+ //empty body
+ }
+ if (bufferIn.charAt(--saveIndex) == '(')
+ { // identifier is a constructor
+ bufferOut.insert(bufferOut.length() -
+ qualifiedIdentifierLength,
+ "<span class=" +
+ "\"" + constructorStyle + "\">");
+ bufferOut.append("</span>");
+ }
+ else
+ {
+ // identifier is a non-primitive type
+ bufferOut.insert(bufferOut.length() -
+ qualifiedIdentifierLength,
+ "<span class=" +
+ "\"" + nonPrimitiveTypeStyle + "\">");
+ bufferOut.append("</span>");
+ }
+ }
+ else if (!(Character.isDigit(identifier.charAt(0)) ||
+ primitiveLiteralCollection.contains(identifier)))
+ {
+ // identifier is a method or a variable
+ // eat white space
+ saveIndex = presentIndex;
+ while (Character.isWhitespace(
+ bufferIn.charAt(saveIndex++)))
+ {
+ // empty body
+ }
+ --saveIndex;
+ // identifier is a method
+ if (bufferIn.charAt(saveIndex) == '(')
+ {
+ bufferOut.insert(bufferOut.length() -
+ qualifiedIdentifierLength,
+ "<span class=\"" + methodStyle + "\">");
+ bufferOut.append("</span>");
+ }
+ else if (bufferIn.charAt(saveIndex) == ',')
+ {
+ // comma seperated variables
+ bufferOut.insert(bufferOut.length() -
+ qualifiedIdentifierLength,
+ "<span class=\"" + variableStyle + "\">");
+ bufferOut.append("</span>");
+ }
+ else
+ {
+ // a variable
+ // take care of cases such as array[index].variable
+ if (bufferIn.charAt(presentIndex -
+ (qualifiedIdentifierLength
+ + 1)) == '.')
+ {
+ qualifiedIdentifierLength++;
+ }
+ bufferOut.insert(bufferOut.length() -
+ qualifiedIdentifierLength,
+ "<span class=\"" + variableStyle + "\">");
+ bufferOut.append("</span>");
+ }
+ }
+ else
+ {
+ if (primitiveLiteralCollection.contains(identifier))
+ {
+ // primitiveLiteral (boolean or null)
+ bufferOut.insert(bufferOut.length() -
+ identifierLength, "<span class=" +
+ "\"" + primitiveLiteralStyle + "\">");
+ bufferOut.append("</span>");
+ }
+ // a numeric literal
+ else
+ {
+ if (((presentIndex -
+ (qualifiedIdentifierLength + 1)) > 0) &&
+ (bufferIn.charAt(presentIndex -
+ (qualifiedIdentifierLength + 1)) == '.'))
+ {
+ qualifiedIdentifierLength++;
+ }
+ bufferOut.insert(bufferOut.length() -
+ qualifiedIdentifierLength,
+ "<span class=" +
+ "\"" + numericLiteralStyle + "\">");
+ bufferOut.append("</span>");
+ }
+ }
+ }
+ qualifiedIdentifierLength = 0;
+ identifierLength = 0;
+ }
+ // process characters NOT in identifiers
+ switch (presentChar)
+ {
+ case '&': //ampersand
+ bufferOut.append("&amp;"); // HTMLify character
+ break;
+ case '<': // less than sign
+ bufferOut.append("&lt;"); // HTMLify character
+ break;
+ case '>': // greater than sign
+ bufferOut.append("&gt;"); // HTMLify character
+ break;
+ case '\"': // double quote
+ bufferOut.append("&quot;"); // HTMLify character
+ if (State.TEXT == presentState)
+ {
+ presentState = State.DOUBLE_QUOTE;
+ bufferOut.insert(bufferOut.length()-("&quot;").length(),
+ "<span class=\"" + doubleQuoteStyle + "\">");
+ }
+ else if (State.DOUBLE_QUOTE == presentState)
+ {
+ presentState = State.TEXT;
+ bufferOut.append("</span>");
+ }
+ break;
+ case '\'': // single quote
+ bufferOut.append("\'");
+ if (State.TEXT == presentState)
+ {
+ presentState = State.SINGLE_QUOTE;
+ bufferOut.insert(bufferOut.length() - ("\'").length(),
+ "<span class=\"" + singleQuoteStyle + "\">");
+ }
+ else if (State.SINGLE_QUOTE == presentState)
+ {
+ presentState = State.TEXT;
+ bufferOut.append("</span>");
+ }
+ break;
+ case '\\': // backslash
+ bufferOut.append("\\");
+ if ((State.DOUBLE_QUOTE == presentState) ||
+ (State.SINGLE_QUOTE == presentState))
+ {
+ // treat as a character escape sequence
+ bufferOut.append(bufferIn.charAt(++presentIndex));
+ }
+ break;
+ case '\t': // tab
+ // replace tabs with tabsize number of spaces
+ for (int i = 0; i < tabSize; i++)
+ {
+ bufferOut.append(' ');
+ }
+ break;
+ case '*': // star
+ bufferOut.append("*");
+ if ((State.TEXT == presentState) &&
+ (bufferIn.charAt(presentIndex - 1) == '/'))
+ {
+ if (((bufferIn.length() - 1) > presentIndex) &&
+ (bufferIn.charAt(presentIndex + 1) == '*'))
+ {
+ presentState = State.JAVADOC;
+ bufferOut.insert(bufferOut.length() -
+ ("/*").length(), "<span class=" +
+ "\"" + javadocCommentStyle + "\">");
+ }
+ else
+ {
+ presentState = State.TRADITIONAL_COMMENT;
+ bufferOut.insert(bufferOut.length() -
+ ("/*").length(), "<span class=" +
+ "\"" + traditionalCommentStyle + "\">");
+ }
+ }
+ break;
+ case '/': // foward slash
+ bufferOut.append("/");
+ if (((State.TRADITIONAL_COMMENT == presentState) ||
+ (State.JAVADOC == presentState)) &&
+ (bufferIn.charAt(presentIndex - 1) == '*'))
+ {
+ bufferOut.append("</span>");
+ presentState = State.TEXT;
+ }
+ if ((State.TEXT == presentState) &&
+ (presentIndex > 0) &&
+ (bufferIn.charAt(presentIndex - 1) == '/'))
+ {
+ bufferOut.insert(bufferOut.length() - ("//").length(),
+ "<span class=" +
+ "\"" + singleLineCommentStyle + "\">");
+ presentState = State.LINE_COMMENT;
+ }
+ break;
+ case '\r': // carriage return
+ // fall through
+ case '\n': // line feed
+ // all HTML lines end in \r\n
+ if ((bufferIn.charAt(presentIndex) == '\r') &&
+ ((bufferIn.length() - 1) > presentIndex) &&
+ (bufferIn.charAt(presentIndex + 1) == '\n'))
+ {
+ ++presentIndex;
+ }
+ // end single line comments
+ if (State.LINE_COMMENT == presentState)
+ {
+ bufferOut.append("</span>");
+ presentState = State.TEXT;
+ }
+ // end of block
+ if ((lineModulus > 0) && hasLineModulusCodeBlocks &&
+ ((codeLineNumber%lineModulus == 0) && !isNewBlock))
+ {
+ // end multi-line spanning states
+ if ((State.TRADITIONAL_COMMENT == presentState) ||
+ (State.JAVADOC == presentState))
+ {
+ bufferOut.append("</span>");
+ }
+ bufferOut.append("\r\n");
+ bufferOut.append("</pre>\r\n");
+ bufferOut.append(" </div>\r\n");
+ bufferOut.append("<pre class=\"");
+ bufferOut.append("modulusBlockPREStyle\">\r\n");
+ // restart multi-line spanning states
+ if (State.TRADITIONAL_COMMENT == presentState)
+ {
+ bufferOut.append("<span class=" +
+ "\"" + traditionalCommentStyle + "\">");
+ }
+ if (State.JAVADOC == presentState)
+ {
+ bufferOut.append("<span class=" +
+ "\"" + javadocCommentStyle + "\">");
+ }
+ }
+ else
+ {
+ // div automatically starts new line
+ bufferOut.append("\r\n");
+ }
+ isNewLine = true;
+ break;
+ case 0: // nul character
+ if ((State.LINE_COMMENT == presentState) &&
+ (presentIndex == (bufferIn.length() - 1)))
+ {
+ bufferOut.append("</span>");
+ }
+ break;
+ default: // everything else
+ bufferOut.append(presentChar);
+ }
+ qualifiedIdentifierLength = 0;
+ }
+ if (presentState == State.LINE_COMMENT) {
+ bufferOut.append("</span>\r\n");
+ }
+
+ bufferOut.append("</pre>\r\n");
+ // end block early if no more source code
+ if ((lineModulus > 0) && hasLineModulusCodeBlocks && !isNewBlock &&
+ (codeLineNumber%lineModulus != 0))
+ {
+ bufferOut.append(" </div>\r\n");
+ }
+ bufferOut.append(" </div>\r\n"); // end div of sourceCodeStyle
+ // if code snippet then don't add ending tags of xhtml page
+ if (!isCodeSnippet)
+ {
+ // if footer mode then add a footer
+ if (hasFooter)
+ {
+ bufferOut.append(" <hr />\r\n");
+ bufferOut.append(" <div id=\"footer\">\r\n");
+ if (hasFooterIcons)
+ {
+ if (hasFooterDate)
+ {
+ bufferOut.append(" <script type=\"text/javaScript\"");
+ bufferOut.append(">\r\n");
+ bufferOut.append(" <!-- // <![CDATA[\r\n");
+ bufferOut.append(" document.write(\"Document last");
+ bufferOut.append(" modified on \"");
+ bufferOut.append(" + document.lastModified + ");
+ bufferOut.append("\"<br />\");\r\n");
+ bufferOut.append(" // ]]> -->\r\n");
+ bufferOut.append(" </script>\r\n");
+ }
+ bufferOut.append(" <a href=\"");
+ bufferOut.append("http://validator.w3.org/check/referer");
+ bufferOut.append("\">\r\n");
+ bufferOut.append(" <img class=\"" + iconStyle + "\" src=\"");
+ bufferOut.append("http://www.w3.org/Icons/");
+ if (isXHTML_1_1)
+ {
+ bufferOut.append("valid-xhtml11\"\r\n");
+ bufferOut.append(" alt=\"Valid XHTML 1.1!\"");
+ }
+ else
+ {
+ bufferOut.append("valid-xhtml10\"\r\n");
+ bufferOut.append(" alt=\"Valid XHTML 1.0!\"");
+ }
+ bufferOut.append(" height=\"31\" ");
+ bufferOut.append("width=\"88\" />\r\n");
+ bufferOut.append(" </a>\r\n");
+ bufferOut.append(" &#160;\r\n");
+ bufferOut.append(" <a href=\"");
+ bufferOut.append("http://jigsaw.w3.org");
+ bufferOut.append("/css-validator/check/referer");
+ bufferOut.append("\">\r\n");
+ bufferOut.append(" <img class=\"" + iconStyle + "\" src=\"");
+ bufferOut.append("http://jigsaw.w3.org/");
+ bufferOut.append("css-validator/images/vcss");
+ bufferOut.append("\"\r\n");
+ bufferOut.append(" alt=\"Valid CSS!\"");
+ bufferOut.append(" height=\"31\" width=\"88\" />\r\n");
+ bufferOut.append(" </a>\r\n");
+ }
+ else
+ {
+ bufferOut.append(" This is a valid\r\n");
+ bufferOut.append(" <a href=\"http://");
+ bufferOut.append("validator.w3.org/check/referer");
+ if (isXHTML_1_1)
+ {
+ bufferOut.append("\">XHTML 1.1</a>\r\n");
+ }
+ else
+ {
+ bufferOut.append("\">XHTML 1.0</a>\r\n");
+ }
+ bufferOut.append(" with\r\n");
+ bufferOut.append(" <a href=\"http://");
+ bufferOut.append("jigsaw.w3.org");
+ bufferOut.append("/css-validator/check/referer");
+ bufferOut.append("\">CSS</a>\r\n");
+ bufferOut.append(" document \r\n");
+ if (hasFooterDate)
+ {
+ bufferOut.append(" <script type=\"text/javaScript\"");
+ bufferOut.append(">\r\n");
+ bufferOut.append(" <!-- // <![CDATA[\r\n");
+ bufferOut.append(" document.write(\"last modified");
+ bufferOut.append(" on \" + document.lastModified);");
+ bufferOut.append("\r\n");
+ bufferOut.append(" // ]]> -->\r\n");
+ bufferOut.append(" </script>\r\n");
+ }
+ }
+ bufferOut.append(" </div>\r\n");
+ }
+ bufferOut.append(" </body>\r\n");
+ bufferOut.append("</html>\r\n");
+ }
+ return bufferOut.toString();
+ }
+}
diff --git a/tools/gnu/classpath/tools/taglets/.cvsignore b/tools/gnu/classpath/tools/taglets/.cvsignore
new file mode 100644
index 000000000..74e8a83b2
--- /dev/null
+++ b/tools/gnu/classpath/tools/taglets/.cvsignore
@@ -0,0 +1,4 @@
+.deps
+.dirstamp
+.libs
+*.lo
diff --git a/tools/gnu/classpath/tools/taglets/AuthorTaglet.java b/tools/gnu/classpath/tools/taglets/AuthorTaglet.java
new file mode 100644
index 000000000..d3bb3719b
--- /dev/null
+++ b/tools/gnu/classpath/tools/taglets/AuthorTaglet.java
@@ -0,0 +1,276 @@
+/* gnu.classpath.tools.taglets.AuthorTaglet
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.taglets;
+
+import java.util.Map;
+
+import java.util.regex.Pattern;
+import java.util.regex.Matcher;
+
+import com.sun.tools.doclets.Taglet;
+
+import com.sun.javadoc.Tag;
+
+/**
+ * The default Taglet which handles Author information.
+ *
+ * @author Julian Scheid (julian@sektor37.de)
+ */
+public class AuthorTaglet implements Taglet {
+
+ /**
+ * Enum class which denotes whether and how to replace email
+ * addresses in author tags.
+ */
+ public static class EmailReplacement {
+ private EmailReplacement() {}
+
+ /**
+ * Specifies that email addresses should not be replaced.
+ */
+ public static final EmailReplacement NO_REPLACEMENT = new EmailReplacement();
+
+ /**
+ * Specifies that author tag text matching "Real Name
+ * (user@domain.tld)" is converted to "&lt;a
+ * href="mailto:user@domain.tld"&gt;Real Name&lt;/a&gt;.
+ */
+ public static final EmailReplacement MAILTO_NAME = new EmailReplacement();
+
+ /**
+ * Specifies that author tag text matching "Real Name
+ * (user@domain.tld)" is converted to "Real Name (&lt;a
+ * href="mailto:user@domain.tld"&gt;user@domain.tld&lt;/a&gt;).
+ */
+ public static final EmailReplacement NAME_MAILTO_ADDRESS = new EmailReplacement();
+
+ /**
+ * Specifies that author tag text matching "Real Name
+ * (user@domain.tld)" is converted to "Real Name (user AT
+ * domain DOT tld)", where the "AT" and "DOT" replacement are
+ * specified by AuthorTaglet.emailAtReplacement and
+ * AuthorTaglet.emailDotReplacement.
+ */
+ public static final EmailReplacement NAME_MANGLED_ADDRESS = new EmailReplacement();
+ }
+
+ private static EmailReplacement emailReplacementType = EmailReplacement.NO_REPLACEMENT;
+ private static String atReplacement = " <b>at</b> ";
+ private static String dotReplacement = " <b>dot</b> ";
+
+ private static final String NAME = "author";
+ private static final String SINGLE_HEADER = "Author:";
+ private static final String MULTI_HEADER = "Authors:";
+
+ private static boolean enabled = true;
+
+ /**
+ * Matches <code>.</code> (dot).
+ */
+ private static final Pattern dotPattern = Pattern.compile("[.]");
+
+ /**
+ * Matches <code>@</code> (at sign).
+ */
+ private static final Pattern atPattern = Pattern.compile("[@]");
+
+ /**
+ * Matches <code>Real Name (user@domain.tld)</code>.
+ */
+ private static final Pattern authorEmailPattern
+ = Pattern.compile("^"
+ + "\\s*" // optional whitespace
+ + "(" // group #1 start (real name)
+ + "(?:[^\t\r\n ]|\\()+" // first name
+ + "(?:\\s+(?:[^\t\r\n ]|\\()+)*" // additional names
+ + ")" // group #1 end
+ + "\\s*" // optional whitespace
+ + "[(<]" // opening paren
+ + "\\s*" // optional whitespace
+ + "(" // group #2 start (email address)
+ + "(" // group #3 start (email user)
+ + "[A-z0-9_\\-\\.]+" // username
+ + ")" // group #3 end
+ + "[@]" // at sign
+ + "[A-z0-9_\\-]+(?:[.][A-z0-9_\\-]+)+[A-z]" // domain
+ + ")" // group #2 end
+ + "\\s*" // optional whitespace
+ + "(?:\\)|>)" // closing paren
+ + "$");
+
+ public String getName() {
+ return NAME;
+ }
+
+ public boolean inField() {
+ return true;
+ }
+
+ public boolean inConstructor() {
+ return true;
+ }
+
+ public boolean inMethod() {
+ return true;
+ }
+
+ public boolean inOverview() {
+ return true;
+ }
+
+ public boolean inPackage() {
+ return true;
+ }
+
+ public boolean inType() {
+ return true;
+ }
+
+ public boolean isInlineTag() {
+ return false;
+ }
+
+ public static void register(Map tagletMap) {
+ AuthorTaglet authorTaglet = new AuthorTaglet();
+ tagletMap.put(authorTaglet.getName(), authorTaglet);
+ }
+
+ public String toString(Tag tag) {
+ if (enabled) {
+ return toString(new Tag[] { tag });
+ }
+ else {
+ return null;
+ }
+ }
+
+ public String toString(Tag[] tags) {
+ if (!enabled || tags.length == 0) {
+ return null;
+ }
+ else {
+ boolean haveValidTag = false;
+ for (int i = 0; i < tags.length && !haveValidTag; ++i) {
+ if (tags[i].text().length() > 0) {
+ haveValidTag = true;
+ }
+ }
+
+ if (haveValidTag) {
+ StringBuffer result = new StringBuffer();
+ result.append("<dl class=\"tag list\">");
+ result.append("<dt class=\"tag section header\"><b>");
+ if (tags.length == 1) {
+ result.append(SINGLE_HEADER);
+ }
+ else {
+ result.append(MULTI_HEADER);
+ }
+ result.append("</b></dt>");
+ for (int i = 0; i < tags.length; i++) {
+ result.append("<dd class=\"tag item\">");
+ result.append(replaceEmail(tags[i].text()));
+ result.append("</dd>");
+ }
+ result.append("</dl>");
+ return result.toString();
+ }
+ else {
+ return null;
+ }
+ }
+ }
+
+ /**
+ * Reformat the tag text according to {@link #emailReplacementType}.
+ */
+ private String replaceEmail(String text) {
+
+ if (EmailReplacement.NO_REPLACEMENT == emailReplacementType) {
+ return text;
+ }
+ else {
+ Matcher matcher = authorEmailPattern.matcher(text);
+ if (matcher.matches()) {
+ String realName = matcher.group(1);
+ String emailAddress = matcher.group(2);
+ if (EmailReplacement.MAILTO_NAME == emailReplacementType) {
+ return "<a href=\"mailto:" + emailAddress + "\">" + realName + "</a>";
+ }
+ else if (EmailReplacement.NAME_MAILTO_ADDRESS == emailReplacementType) {
+ return realName + " (<a href=\"mailto:" + emailAddress + "\">" + emailAddress + "</a>)";
+ }
+ else if (EmailReplacement.NAME_MANGLED_ADDRESS == emailReplacementType) {
+ Matcher dotMatcher = dotPattern.matcher(emailAddress);
+ Matcher atMatcher = atPattern.matcher(dotMatcher.replaceAll(dotReplacement));
+ String mangledAddress = atMatcher.replaceAll(atReplacement);
+ return realName + " (" + mangledAddress + ")";
+ }
+ else {
+ // this shouldn't happen
+ return text;
+ }
+ }
+ else {
+ return text;
+ }
+ }
+ }
+
+ /**
+ * Set the email replacement type.
+ */
+ public static void setEmailReplacementType(EmailReplacement emailReplacementType)
+ {
+ if (null == emailReplacementType) {
+ throw new NullPointerException();
+ }
+ AuthorTaglet.emailReplacementType = emailReplacementType;
+ }
+
+ /**
+ * Set the HTML text by which the <code>@</code> (at sign) in email
+ * addresses should be replaced if the email replacement type is
+ * <code>NAME_MANGLED_ADDRESS</code>.
+ */
+ public static void setAtReplacement(String atReplacement)
+ {
+ AuthorTaglet.atReplacement = atReplacement;
+ }
+
+ /**
+ * Set the HTML text by which the <code>.</code> (dot) in email
+ * addresses should be replaced if the email replacement type is
+ * <code>NAME_MANGLED_ADDRESS</code>.
+ */
+ public static void setDotReplacement(String dotReplacement)
+ {
+ AuthorTaglet.dotReplacement = dotReplacement;
+ }
+
+ /**
+ * Enables/disables this taglet.
+ */
+ public static void setTagletEnabled(boolean enabled)
+ {
+ AuthorTaglet.enabled = enabled;
+ }
+}
diff --git a/tools/gnu/classpath/tools/taglets/CodeTaglet.java b/tools/gnu/classpath/tools/taglets/CodeTaglet.java
new file mode 100644
index 000000000..16ed3d5b0
--- /dev/null
+++ b/tools/gnu/classpath/tools/taglets/CodeTaglet.java
@@ -0,0 +1,84 @@
+/* gnu.classpath.tools.taglets.CodeTaglet
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.taglets;
+
+import java.util.Map;
+
+import com.sun.tools.doclets.Taglet;
+
+import com.sun.javadoc.Doc;
+import com.sun.javadoc.Tag;
+import com.sun.javadoc.FieldDoc;
+import com.sun.javadoc.MemberDoc;
+import com.sun.javadoc.SeeTag;
+
+/**
+ * The default Taglet which shows its contents enclosed in a
+ * <code>code</code> tag.
+ *
+ * @author Julian Scheid (julian@sektor37.de)
+ */
+public class CodeTaglet
+ implements Taglet
+{
+ private static final String NAME = "code";
+
+ public String getName() {
+ return NAME;
+ }
+
+ public boolean inField() {
+ return true;
+ }
+
+ public boolean inConstructor() {
+ return true;
+ }
+
+ public boolean inMethod() {
+ return true;
+ }
+
+ public boolean inOverview() {
+ return true;
+ }
+
+ public boolean inPackage() {
+ return true;
+ }
+
+ public boolean inType() {
+ return true;
+ }
+
+ public boolean isInlineTag() {
+ return true;
+ }
+
+ public String toString(Tag tag) {
+ return "<code>" + tag.text() + "</code>";
+ }
+
+ public String toString(Tag[] tag) {
+ return null;
+ }
+
+}
diff --git a/tools/gnu/classpath/tools/taglets/CopyrightTaglet.java b/tools/gnu/classpath/tools/taglets/CopyrightTaglet.java
new file mode 100644
index 000000000..bb0d9a74d
--- /dev/null
+++ b/tools/gnu/classpath/tools/taglets/CopyrightTaglet.java
@@ -0,0 +1,106 @@
+/* gnu.classpath.tools.taglets.CopyrightTaglet
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.taglets;
+
+import java.util.Map;
+
+import com.sun.tools.doclets.Taglet;
+
+import com.sun.javadoc.Tag;
+
+/**
+ * A simple Taglet which handles Copyright information.
+ */
+public class CopyrightTaglet implements Taglet {
+
+ private static final String NAME = "copyright";
+ private static final String HEADER = "Copyright:";
+
+ public String getName() {
+ return NAME;
+ }
+
+ public boolean inField() {
+ return true;
+ }
+
+ public boolean inConstructor() {
+ return true;
+ }
+
+ public boolean inMethod() {
+ return true;
+ }
+
+ public boolean inOverview() {
+ return true;
+ }
+
+ public boolean inPackage() {
+ return true;
+ }
+
+ public boolean inType() {
+ return true;
+ }
+
+ public boolean isInlineTag() {
+ return false;
+ }
+
+ public static void register(Map tagletMap) {
+ CopyrightTaglet copyrightTaglet = new CopyrightTaglet();
+ tagletMap.put(copyrightTaglet.getName(), copyrightTaglet);
+ }
+
+ public String toString(Tag tag) {
+ return toString(new Tag[] { tag });
+ }
+
+ public String toString(Tag[] tags) {
+ if (tags.length == 0) {
+ return null;
+ }
+ else {
+ boolean haveValidTag = false;
+ for (int i = 0; i < tags.length && !haveValidTag; ++i) {
+ if (tags[i].text().length() > 0) {
+ haveValidTag = true;
+ }
+ }
+
+ if (haveValidTag) {
+ StringBuffer result = new StringBuffer();
+ result.append("<dl>");
+ for (int i = 0; i < tags.length; i++) {
+ if (tags[i].text().length() > 0) {
+ result.append("<dt><i>Copyright &#169; " + tags[i].text() + "</i></dt>");
+ }
+ }
+ result.append("</dl>");
+ return result.toString();
+ }
+ else {
+ return null;
+ }
+ }
+ }
+}
diff --git a/tools/gnu/classpath/tools/taglets/DeprecatedTaglet.java b/tools/gnu/classpath/tools/taglets/DeprecatedTaglet.java
new file mode 100644
index 000000000..ba406a6eb
--- /dev/null
+++ b/tools/gnu/classpath/tools/taglets/DeprecatedTaglet.java
@@ -0,0 +1,115 @@
+/* gnu.classpath.tools.taglets.DeprecatedTaglet
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.taglets;
+
+import java.util.Map;
+
+import com.sun.tools.doclets.Taglet;
+
+import com.sun.javadoc.Tag;
+
+/**
+ * The default Taglet which handles deprecated information.
+ *
+ * @author Julian Scheid (julian@sektor37.de)
+ */
+public class DeprecatedTaglet implements Taglet {
+
+ private static final String NAME = "deprecated";
+ private static final String HEADER = "Deprecated:";
+
+ private static boolean enabled = true;
+
+ public String getName() {
+ return NAME;
+ }
+
+ public boolean inField() {
+ return true;
+ }
+
+ public boolean inConstructor() {
+ return true;
+ }
+
+ public boolean inMethod() {
+ return true;
+ }
+
+ public boolean inOverview() {
+ return true;
+ }
+
+ public boolean inPackage() {
+ return true;
+ }
+
+ public boolean inType() {
+ return true;
+ }
+
+ public boolean isInlineTag() {
+ return false;
+ }
+
+ public static void register(Map tagletMap) {
+ DeprecatedTaglet deprecatedTaglet = new DeprecatedTaglet();
+ tagletMap.put(deprecatedTaglet.getName(), deprecatedTaglet);
+ }
+
+ public String toString(Tag tag) {
+ if (enabled) {
+ return toString(new Tag[] { tag });
+ }
+ else {
+ return null;
+ }
+ }
+
+ public String toString(Tag[] tags) {
+ if (!enabled || tags.length == 0) {
+ return null;
+ }
+ else {
+
+ StringBuffer result = new StringBuffer();
+ result.append("<div class=\"classdoc-tag-section-header\">");
+ result.append(HEADER);
+ result.append("</div>");
+ result.append("<dl class=\"classdoc-list\">");
+ for (int i = 0; i < tags.length; i++) {
+ result.append("<dt>");
+ result.append(tags[i].text());
+ result.append("</dt>");
+ }
+ result.append("</dl>");
+ return result.toString();
+ }
+ }
+
+ /**
+ * Enables/disables this taglet.
+ */
+ public static void setTagletEnabled(boolean enabled)
+ {
+ DeprecatedTaglet.enabled = enabled;
+ }
+}
diff --git a/tools/gnu/classpath/tools/taglets/GenericTaglet.java b/tools/gnu/classpath/tools/taglets/GenericTaglet.java
new file mode 100644
index 000000000..7e18cdcac
--- /dev/null
+++ b/tools/gnu/classpath/tools/taglets/GenericTaglet.java
@@ -0,0 +1,140 @@
+/* gnu.classpath.tools.taglets.GenericTaglet
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.taglets;
+
+import java.util.Map;
+
+import com.sun.tools.doclets.Taglet;
+
+import com.sun.javadoc.Tag;
+
+/**
+ * A taglet which can be configured at runtime.
+ *
+ * @author Julian Scheid (julian@sektor37.de)
+ */
+public class GenericTaglet implements Taglet {
+
+ private String name = "since";
+ private String header = "Since:";
+
+ private boolean scopeOverview;
+ private boolean scopePackage;
+ private boolean scopeType;
+ private boolean scopeConstructor;
+ private boolean scopeMethod;
+ private boolean scopeField;
+
+ private boolean enabled = true;
+
+ public GenericTaglet(String name,
+ String header,
+ boolean scopeOverview,
+ boolean scopePackage,
+ boolean scopeType,
+ boolean scopeConstructor,
+ boolean scopeMethod,
+ boolean scopeField)
+ {
+ this.name = name;
+ this.header = header;
+ this.scopeOverview = scopeOverview;
+ this.scopePackage = scopePackage;
+ this.scopeType = scopeType;
+ this.scopeConstructor = scopeConstructor;
+ this.scopeMethod = scopeMethod;
+ this.scopeField = scopeField;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public boolean inField() {
+ return scopeField;
+ }
+
+ public boolean inConstructor() {
+ return scopeConstructor;
+ }
+
+ public boolean inMethod() {
+ return scopeMethod;
+ }
+
+ public boolean inOverview() {
+ return scopeOverview;
+ }
+
+ public boolean inPackage() {
+ return scopePackage;
+ }
+
+ public boolean inType() {
+ return scopeType;
+ }
+
+ public boolean isInlineTag() {
+ return false;
+ }
+
+ public void register(Map tagletMap) {
+ tagletMap.put(getName(), this);
+ }
+
+ public String toString(Tag tag) {
+ if (enabled) {
+ return toString(new Tag[] { tag });
+ }
+ else {
+ return null;
+ }
+ }
+
+ public String toString(Tag[] tags) {
+ if (!enabled || tags.length == 0) {
+ return null;
+ }
+ else {
+
+ StringBuffer result = new StringBuffer();
+ result.append("<div class=\"classdoc-tag-section-header\">");
+ result.append(header);
+ result.append("</div>");
+ result.append("<dl class=\"classdoc-list\">");
+ for (int i = 0; i < tags.length; i++) {
+ result.append("<dt>");
+ result.append(tags[i].text());
+ result.append("</dt>");
+ }
+ result.append("</dl>");
+ return result.toString();
+ }
+ }
+
+ /**
+ * Enables/disables this taglet.
+ */
+ public void setTagletEnabled(boolean enabled)
+ {
+ this.enabled = enabled;
+ }
+}
diff --git a/tools/gnu/classpath/tools/taglets/GnuExtendedTaglet.java b/tools/gnu/classpath/tools/taglets/GnuExtendedTaglet.java
new file mode 100644
index 000000000..2e67d6519
--- /dev/null
+++ b/tools/gnu/classpath/tools/taglets/GnuExtendedTaglet.java
@@ -0,0 +1,31 @@
+/* gnu.classpath.tools.taglets.GnuExtendedTaglet
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.taglets;
+
+import com.sun.javadoc.Tag;
+import com.sun.tools.doclets.Taglet;
+
+public interface GnuExtendedTaglet
+ extends Taglet
+{
+ public String toString(Tag tag, TagletContext context);
+ public String toString(Tag[] tags, TagletContext context);
+}
diff --git a/tools/gnu/classpath/tools/taglets/SinceTaglet.java b/tools/gnu/classpath/tools/taglets/SinceTaglet.java
new file mode 100644
index 000000000..dac68a8c4
--- /dev/null
+++ b/tools/gnu/classpath/tools/taglets/SinceTaglet.java
@@ -0,0 +1,144 @@
+/* gnu.classpath.tools.taglets.SinceTaglet
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.taglets;
+
+import java.util.Map;
+
+import com.sun.tools.doclets.Taglet;
+
+import com.sun.javadoc.Tag;
+
+import gnu.classpath.tools.doclets.InlineTagRenderer;
+
+/**
+ * The default Taglet which handles since information.
+ *
+ * @author Julian Scheid (julian@sektor37.de)
+ */
+public class SinceTaglet implements GnuExtendedTaglet {
+
+ private static final String NAME = "since";
+ private static final String HEADER = "Since:";
+
+ private static boolean enabled = true;
+
+ private InlineTagRenderer inlineTagRenderer;
+
+ public SinceTaglet(InlineTagRenderer inlineTagRenderer)
+ {
+ this.inlineTagRenderer = inlineTagRenderer;
+ }
+
+ public String getName() {
+ return NAME;
+ }
+
+ public boolean inField() {
+ return true;
+ }
+
+ public boolean inConstructor() {
+ return true;
+ }
+
+ public boolean inMethod() {
+ return true;
+ }
+
+ public boolean inOverview() {
+ return true;
+ }
+
+ public boolean inPackage() {
+ return true;
+ }
+
+ public boolean inType() {
+ return true;
+ }
+
+ public boolean isInlineTag() {
+ return false;
+ }
+
+ public String toString(Tag tag) {
+ // should raise assertion
+ if (enabled) {
+ return toString(new Tag[] { tag });
+ }
+ else {
+ return null;
+ }
+ }
+
+ public String toString(Tag[] tags) {
+ // should raise assertion
+ return toString(tags, null);
+ }
+
+ public String toString(Tag tag, TagletContext context)
+ {
+ return null;
+ }
+
+ public String toString(Tag[] tags, TagletContext context)
+ {
+ if (!enabled || tags.length == 0) {
+ return null;
+ }
+ else {
+ boolean haveValidTag = false;
+ for (int i = 0; i < tags.length && !haveValidTag; ++i) {
+ if (tags[i].text().length() > 0) {
+ haveValidTag = true;
+ }
+ }
+
+ if (haveValidTag) {
+ StringBuffer result = new StringBuffer();
+ result.append("<dl class=\"tag list\">");
+ result.append("<dt class=\"tag section header\"><b>");
+ result.append(HEADER);
+ result.append("</b></dt>");
+ for (int i = 0; i < tags.length; ++i) {
+ if (tags[i].text().length() > 0) {
+ result.append("<dd>");
+ result.append(inlineTagRenderer.renderInlineTags(tags[i].inlineTags(), context));
+ result.append("</dd>");
+ }
+ }
+ result.append("</dl>");
+ return result.toString();
+ }
+ else {
+ return null;
+ }
+ }
+ }
+
+ /**
+ * Enables/disables this taglet.
+ */
+ public static void setTagletEnabled(boolean enabled)
+ {
+ SinceTaglet.enabled = enabled;
+ }
+}
diff --git a/tools/gnu/classpath/tools/taglets/TagletContext.java b/tools/gnu/classpath/tools/taglets/TagletContext.java
new file mode 100644
index 000000000..cf706b6a9
--- /dev/null
+++ b/tools/gnu/classpath/tools/taglets/TagletContext.java
@@ -0,0 +1,23 @@
+package gnu.classpath.tools.taglets;
+
+import com.sun.javadoc.Doc;
+
+public class TagletContext
+{
+ protected Doc doc;
+
+ public TagletContext(Doc doc)
+ {
+ this.doc = doc;
+ }
+
+ public Doc getDoc()
+ {
+ return this.doc;
+ }
+
+ public String toString()
+ {
+ return "TagletContext{doc=" + doc + "}";
+ }
+}
diff --git a/tools/gnu/classpath/tools/taglets/ValueTaglet.java b/tools/gnu/classpath/tools/taglets/ValueTaglet.java
new file mode 100644
index 000000000..0f194ae10
--- /dev/null
+++ b/tools/gnu/classpath/tools/taglets/ValueTaglet.java
@@ -0,0 +1,113 @@
+/* gnu.classpath.tools.taglets.ValueTaglet
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.taglets;
+
+import java.util.Map;
+
+import com.sun.tools.doclets.Taglet;
+
+import com.sun.javadoc.Doc;
+import com.sun.javadoc.Tag;
+import com.sun.javadoc.FieldDoc;
+import com.sun.javadoc.MemberDoc;
+import com.sun.javadoc.SeeTag;
+
+/**
+ * The default Taglet which shows final static field values.
+ *
+ * @author Julian Scheid (julian@sektor37.de)
+ */
+public class ValueTaglet
+ implements GnuExtendedTaglet
+{
+ private static final String NAME = "value";
+
+ public String getName() {
+ return NAME;
+ }
+
+ public boolean inField() {
+ return true;
+ }
+
+ public boolean inConstructor() {
+ return true;
+ }
+
+ public boolean inMethod() {
+ return true;
+ }
+
+ public boolean inOverview() {
+ return true;
+ }
+
+ public boolean inPackage() {
+ return true;
+ }
+
+ public boolean inType() {
+ return true;
+ }
+
+ public boolean isInlineTag() {
+ return true;
+ }
+
+ public static void register(Map tagletMap) {
+ ValueTaglet valueTaglet = new ValueTaglet();
+ tagletMap.put(valueTaglet.getName(), valueTaglet);
+ }
+
+ public String toString(Tag tag) {
+ return null;
+ }
+
+ public String toString(Tag tag, TagletContext context) {
+ if (0 == tag.inlineTags().length) {
+ if (context.getDoc().isField()) {
+ FieldDoc fieldDoc = (FieldDoc)context.getDoc();
+ if (fieldDoc.isStatic() && fieldDoc.isFinal()) {
+ return fieldDoc.constantValueExpression();
+ }
+ }
+ }
+ else {
+ MemberDoc referencedMember = ((SeeTag)tag).referencedMember();
+ if (null != referencedMember && referencedMember.isField()) {
+ FieldDoc fieldDoc = (FieldDoc)referencedMember;
+ if (fieldDoc.isStatic() && fieldDoc.isFinal()) {
+ return fieldDoc.constantValueExpression();
+ }
+ }
+ }
+ return "";
+ }
+
+ public String toString(Tag[] tags) {
+ return null;
+ }
+
+ public String toString(Tag[] tags, TagletContext context) {
+ return null;
+ }
+
+}
diff --git a/tools/gnu/classpath/tools/taglets/VersionTaglet.java b/tools/gnu/classpath/tools/taglets/VersionTaglet.java
new file mode 100644
index 000000000..e4eddb822
--- /dev/null
+++ b/tools/gnu/classpath/tools/taglets/VersionTaglet.java
@@ -0,0 +1,136 @@
+/* gnu.classpath.tools.taglets.VersionTaglet
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.taglets;
+
+import java.util.Map;
+
+import com.sun.tools.doclets.Taglet;
+
+import com.sun.javadoc.Tag;
+
+/**
+ * The default Taglet which handles version information.
+ *
+ * @author Julian Scheid (julian@sektor37.de)
+ */
+public class VersionTaglet implements Taglet {
+
+ private static final String NAME = "version";
+ private static final String HEADER = "Version:";
+
+ private static boolean enabled = true;
+
+ public String getName() {
+ return NAME;
+ }
+
+ public boolean inField() {
+ return true;
+ }
+
+ public boolean inConstructor() {
+ return true;
+ }
+
+ public boolean inMethod() {
+ return true;
+ }
+
+ public boolean inOverview() {
+ return true;
+ }
+
+ public boolean inPackage() {
+ return true;
+ }
+
+ public boolean inType() {
+ return true;
+ }
+
+ public boolean isInlineTag() {
+ return false;
+ }
+
+ public static void register(Map tagletMap) {
+ VersionTaglet versionTaglet = new VersionTaglet();
+ tagletMap.put(versionTaglet.getName(), versionTaglet);
+ }
+
+ public String toString(Tag tag) {
+ if (enabled) {
+ return toString(new Tag[] { tag });
+ }
+ else {
+ return null;
+ }
+ }
+
+ public String toString(Tag[] tags) {
+ if (!enabled || tags.length == 0) {
+ return null;
+ }
+ else {
+ boolean haveValidTag = false;
+ for (int i = 0; i < tags.length && !haveValidTag; ++i) {
+ if (tags[i].text().length() > 0) {
+ haveValidTag = true;
+ }
+ }
+
+ if (haveValidTag) {
+
+ StringBuffer result = new StringBuffer();
+ result.append("<dl class=\"tag list\">");
+ result.append("</dl>");
+ result.append("<dt class=\"tag section header\"><b>");
+ result.append(HEADER);
+ result.append("</b></dt><dd>");
+ boolean firstEntry = true;
+ for (int i = 0; i < tags.length; i++) {
+ if (tags[i].text().length() > 0) {
+ if (!firstEntry) {
+ result.append(", ");
+ }
+ else {
+ firstEntry = false;
+ }
+ result.append(tags[i].text());
+ }
+ }
+ result.append("</dd>");
+ result.append("</dl>");
+ return result.toString();
+ }
+ else {
+ return null;
+ }
+ }
+ }
+
+ /**
+ * Enables/disables this taglet.
+ */
+ public static void setTagletEnabled(boolean enabled)
+ {
+ VersionTaglet.enabled = enabled;
+ }
+}
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/gjdoc_common.xsl b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/gjdoc_common.xsl
new file mode 100644
index 000000000..2b5aec105
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/gjdoc_common.xsl
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- gjdoc_common.xsl
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+ -->
+
+<!-- Common templates for HTML generation.
+ -->
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:gjdoc="http://www.gnu.org/software/cp-tools/gjdocxml"
+ xmlns:html="http://www.w3.org/TR/REC-html40"
+ xmlns="http://www.w3.org/TR/REC-html40">
+
+ <xsl:param name="gjdoc.outputfile.info" select="''"/>
+ <xsl:param name="gjdoc.refdocs1" select="''"/>
+ <xsl:param name="gjdoc.pathtoroot" select="''"/>
+ <xsl:param name="gjdoc.xmldoclet.version" select="''"/>
+ <xsl:param name="gjdoc.allowimages" select="0"/>
+ <xsl:param name="gjdoc.option.nonavbar" select="''"/>
+ <xsl:param name="gjdoc.option.noindex" select="''"/>
+ <xsl:param name="gjdoc.option.notree" select="''"/>
+ <xsl:param name="gjdoc.option.nohelp" select="''"/>
+ <xsl:param name="gjdoc.option.nocomment" select="''"/>
+ <xsl:param name="gjdoc.option.splitindex" select="''"/>
+ <xsl:param name="gjdoc.option.linksource" select="''"/>
+ <xsl:param name="gjdoc.option.windowtitle" select="''"/>
+ <xsl:param name="gjdoc.option.helpfile" select="''"/>
+ <xsl:param name="gjdoc.option.stylesheetfile" select="''"/>
+ <xsl:param name="gjdoc.option.header" select="''"/>
+ <xsl:param name="gjdoc.option.footer" select="''"/>
+ <xsl:param name="gjdoc.option.bottom" select="''"/>
+ <xsl:param name="gjdoc.option.doctitle" select="''"/>
+ <xsl:param name="gjdoc.option.nodeprecatedlist" select="''"/>
+ <xsl:param name="gjdoc.option.uses" select="''"/>
+</xsl:stylesheet>
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/about.xsl b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/about.xsl
new file mode 100644
index 000000000..fa78cb309
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/about.xsl
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- about.xsl
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+ -->
+
+<!-- Creates the class descriptor files for HTML documentation.
+ -->
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:gjdoc="http://www.gnu.org/software/cp-tools/gjdocxml"
+ xmlns:html="http://www.w3.org/TR/REC-html40"
+ xmlns="http://www.w3.org/TR/REC-html40">
+
+ <xsl:include href="html_common.xsl"/>
+
+ <xsl:output method="html"
+ encoding="utf-8"
+ doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
+ doctype-system="http://www.w3.org/TR/html4/loose.dtd"
+ indent="no"/>
+
+ <xsl:strip-space elements="*"/>
+
+ <xsl:template match="/">
+ <html>
+ <head>
+ <xsl:call-template name="include_common"/>
+ <xsl:call-template name="output_title">
+ <xsl:with-param name="p_pagetitle" select="'Help'"/>
+ </xsl:call-template>
+ </head>
+ <body class="classdoc" onload="if(parent.contentPageLoaded)parent.contentPageLoaded()">
+
+ <div class="pagebody">
+
+ <!-- Top Navigation Bar -->
+ <xsl:call-template name="output_navbar">
+ <xsl:with-param name="p_show_package" select="0"/>
+ <xsl:with-param name="p_show_package_tree" select="0"/>
+ <xsl:with-param name="p_show_about" select="0"/>
+ <xsl:with-param name="p_curr_about" select="1"/>
+ <xsl:with-param name="p_top" select="1"/>
+ </xsl:call-template>
+
+ <h1 class="classdoc-title">About this API documentation</h1>
+
+ <div class="footer">
+ <xsl:text>Generated on</xsl:text><xsl:value-of select="document('index.xml', /)/gjdoc:rootdoc/gjdoc:created"/><xsl:text> by </xsl:text><a href="http://www.gnu.org/software/cp-tools" target="cptoolsinfo"><xsl:text>GNU Classpath Tools</xsl:text></a><xsl:text> (Gjdoc XmlDoclet </xsl:text><xsl:value-of select="$gjdoc.xmldoclet.version"/><xsl:text>).</xsl:text>
+ </div>
+
+ <!-- Bottom Navigation Bar -->
+ <xsl:call-template name="output_navbar">
+ <xsl:with-param name="p_show_package" select="0"/>
+ <xsl:with-param name="p_show_package_tree" select="0"/>
+ <xsl:with-param name="p_show_about" select="0"/>
+ <xsl:with-param name="p_curr_about" select="1"/>
+ <xsl:with-param name="p_top" select="0"/>
+ </xsl:call-template>
+ </div>
+ </body>
+ </html>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/allclasses.xsl b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/allclasses.xsl
new file mode 100644
index 000000000..8739d197f
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/allclasses.xsl
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- allclasses.xsl
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+ -->
+
+<!-- Creates the allclasses.html file for HTML documentation.
+ -->
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:gjdoc="http://www.gnu.org/software/cp-tools/gjdocxml"
+ xmlns:html="http://www.w3.org/TR/REC-html40"
+ xmlns="http://www.w3.org/TR/REC-html40">
+
+ <xsl:include href="html_common.xsl"/>
+
+ <xsl:output method="xml"
+ encoding="utf-8"
+ indent="no"/>
+
+ <xsl:strip-space elements="*"/>
+
+ <xsl:template match="/">
+ <html>
+ <head>
+ <title>
+ <xsl:value-of select="concat(/gjdoc:rootdoc/gjdoc:title, ' - All Classes')"/>
+ </title>
+ <xsl:call-template name="include_common"/>
+ </head>
+ <body onload="secondaryPageLoaded('classes');" class="menu allclasses">
+ <h3 class="menu-title">All Classes</h3>
+ <xsl:for-each select="gjdoc:rootdoc/gjdoc:classdoc/@name">
+ <xsl:sort select="." order="ascending"/>
+ <xsl:variable name="v_url" select="concat(translate(../gjdoc:containingPackage/@name,'.','/'), '/', ../@name, '.html')"/>
+ <a href="{$v_url}" target="content" class="menu allclasses">
+ <xsl:value-of select="."/>
+ </a>
+ <br/>
+ </xsl:for-each>
+ </body>
+ </html>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/allpackages.xsl b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/allpackages.xsl
new file mode 100644
index 000000000..d4449ef5e
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/allpackages.xsl
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- allpackages.xsl
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+ -->
+
+<!-- Creates the allpackages.html file for HTML documentation.
+ -->
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:gjdoc="http://www.gnu.org/software/cp-tools/gjdocxml"
+ xmlns:html="http://www.w3.org/TR/REC-html40"
+ xmlns="http://www.w3.org/TR/REC-html40">
+
+ <xsl:include href="html_common.xsl"/>
+
+ <xsl:output method="xml"
+ encoding="utf-8"
+ indent="no"/>
+
+ <xsl:strip-space elements="*"/>
+
+ <xsl:template match="/">
+ <html>
+ <head>
+ <title>
+ <xsl:if test="document('index.xml',/)/gjdoc:rootdoc/gjdoc:title">
+ <xsl:value-of select="document('index.xml',/)/gjdoc:rootdoc/gjdoc:title"/>
+ <xsl:text> - </xsl:text>
+ </xsl:if>
+ <xsl:text>Packages</xsl:text>
+ <xsl:value-of select="@name"/>
+ </title>
+ <xsl:call-template name="include_common"/>
+ </head>
+ <body class="menu allpackages">
+ <h3 class="menu-title">
+ <a href="index_noframes.html" target="content">
+ <xsl:choose>
+ <xsl:when test="document('index.xml',/)/gjdoc:rootdoc/gjdoc:title">
+ <xsl:value-of select="document('index.xml',/)/gjdoc:rootdoc/gjdoc:title"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>Packages</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </a>
+ </h3>
+ <a href="allclasses.html" target="classes" class="menu allpackages">All Classes</a><br/><br/>
+ <xsl:for-each select="gjdoc:rootdoc/gjdoc:specifiedpackage/@name">
+ <xsl:sort select="." order="ascending"/>
+ <a href="{concat(translate(., '.','/'), '/classes.html')}" target="classes" class="menu allpackages">
+ <xsl:value-of select="."/>
+ </a>
+ <br/>
+ </xsl:for-each>
+ </body>
+ </html>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/alphaindex.xsl b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/alphaindex.xsl
new file mode 100644
index 000000000..5aa915cd8
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/alphaindex.xsl
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- alphaindex.xsl
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+ -->
+
+<!-- Creates the alphaindex.html file for HTML documentation.
+ -->
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:gjdoc="http://www.gnu.org/software/cp-tools/gjdocxml"
+ xmlns:html="http://www.w3.org/TR/REC-html40"
+ xmlns="http://www.w3.org/TR/REC-html40">
+
+ <xsl:include href="html_common.xsl"/>
+
+ <xsl:output method="xml"
+ encoding="utf-8"
+ indent="no"/>
+
+ <xsl:strip-space elements="*"/>
+
+ <xsl:template match="/">
+
+ <html>
+ <head>
+ <xsl:call-template name="output_title">
+ <xsl:with-param name="p_pagetitle" select="'Alphabetical Index'"/>
+ </xsl:call-template>
+ <xsl:call-template name="include_common"/>
+ </head>
+ <body class="classdoc" onload="if(parent.contentPageLoaded)parent.contentPageLoaded(document.title)">
+
+ <!-- Top Navigation Bar -->
+ <xsl:call-template name="output_navbar">
+ <xsl:with-param name="p_show_frames" select="1"/>
+ <xsl:with-param name="p_show_noframes" select="1"/>
+ <xsl:with-param name="p_show_package" select="0"/>
+ <xsl:with-param name="p_show_package_tree" select="0"/>
+ <xsl:with-param name="p_show_full_tree" select="1"/>
+ <xsl:with-param name="p_show_index" select="0"/>
+ <xsl:with-param name="p_curr_index" select="1"/>
+ <xsl:with-param name="p_show_help" select="1"/>
+ <xsl:with-param name="p_top" select="1"/>
+ </xsl:call-template>
+
+ <div class="pagebody">
+ <h1 class="classdoc-title">
+ Alphabetical Index
+ </h1>
+
+ <div class="index-categories">
+ <xsl:for-each select="document('alphaindex.xml',/)/gjdoc:alphaindex/gjdoc:category">
+ <xsl:choose>
+ <xsl:when test="@letter=$gjdoc.outputfile.info">
+ <span class="index-category-current"><xsl:value-of select="@letter"/></span>
+ </xsl:when>
+ <xsl:otherwise>
+ <a href="{concat('#category_', @letter)}" class="index-category-link"><xsl:value-of select="@letter"/></a>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </div>
+
+ <xsl:for-each select="document('alphaindex.xml',/)/gjdoc:alphaindex/gjdoc:category">
+ <a name="{concat('category_', @letter)}" class="classdoc"><h3 class="ignore"> </h3></a>
+ <h2><xsl:value-of select="@letter"/></h2>
+ <xsl:call-template name="output_alphaindex_category"/>
+ </xsl:for-each>
+
+ <!-- Bottom Navigation Bar -->
+ <xsl:call-template name="output_navbar">
+ <xsl:with-param name="p_show_frames" select="1"/>
+ <xsl:with-param name="p_show_noframes" select="1"/>
+ <xsl:with-param name="p_show_package" select="0"/>
+ <xsl:with-param name="p_show_package_tree" select="0"/>
+ <xsl:with-param name="p_show_full_tree" select="1"/>
+ <xsl:with-param name="p_show_index" select="0"/>
+ <xsl:with-param name="p_curr_index" select="1"/>
+ <xsl:with-param name="p_show_help" select="1"/>
+ <xsl:with-param name="p_top" select="0"/>
+ </xsl:call-template>
+ </div>
+ </body>
+ </html>
+
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/alphaindex_chunked.xsl b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/alphaindex_chunked.xsl
new file mode 100644
index 000000000..e1847385b
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/alphaindex_chunked.xsl
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- alphaindex.xsl
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+ -->
+
+<!-- Creates the alphaindex.html file for HTML documentation.
+ -->
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:gjdoc="http://www.gnu.org/software/cp-tools/gjdocxml"
+ xmlns:html="http://www.w3.org/TR/REC-html40"
+ xmlns="http://www.w3.org/TR/REC-html40">
+
+ <xsl:include href="html_common.xsl"/>
+
+ <xsl:output method="xml"
+ encoding="utf-8"
+ indent="no"/>
+
+ <xsl:strip-space elements="*"/>
+
+ <xsl:template match="/">
+
+ <html>
+ <head>
+ <xsl:call-template name="output_title">
+ <xsl:with-param name="p_pagetitle" select="concat('Alphabetical Index: ', $gjdoc.outputfile.info)"/>
+ </xsl:call-template>
+ <xsl:call-template name="include_common"/>
+ </head>
+ <body class="classdoc" onload="if(parent.contentPageLoaded)parent.contentPageLoaded(document.title)">
+ <div class="pagebody">
+ <!-- Top Navigation Bar -->
+ <xsl:call-template name="output_navbar">
+ <xsl:with-param name="p_show_frames" select="1"/>
+ <xsl:with-param name="p_show_noframes" select="1"/>
+ <xsl:with-param name="p_show_package" select="0"/>
+ <xsl:with-param name="p_show_package_tree" select="0"/>
+ <xsl:with-param name="p_show_full_tree" select="1"/>
+ <xsl:with-param name="p_show_index" select="0"/>
+ <xsl:with-param name="p_curr_index" select="1"/>
+ <xsl:with-param name="p_show_help" select="1"/>
+ <xsl:with-param name="p_top" select="1"/>
+ </xsl:call-template>
+
+ <h1 class="classdoc-title">
+ Alphabetical Index
+ <xsl:if test="$gjdoc.outputfile.info">
+ -
+ <xsl:value-of select="$gjdoc.outputfile.info"/>
+ </xsl:if>
+ </h1>
+
+ <div class="index-categories">
+ <xsl:for-each select="document('alphaindex.xml',/)/gjdoc:alphaindex/gjdoc:category">
+ <xsl:choose>
+ <xsl:when test="@letter=$gjdoc.outputfile.info">
+ <span class="index-category-current"><xsl:value-of select="@letter"/></span>
+ </xsl:when>
+ <xsl:otherwise>
+ <a href="{concat('alphaindex_', @letter, '.html') class="index-category-link"}"><xsl:value-of select="@letter"/></a>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </div>
+
+ <xsl:if test="$gjdoc.outputfile.info">
+ <xsl:for-each select="document('alphaindex.xml',/)/gjdoc:alphaindex/gjdoc:category[@letter=$gjdoc.outputfile.info]">
+ <h2><xsl:value-of select="@letter"/></h2>
+ <xsl:call-template name="output_alphaindex_category"/>
+ </xsl:for-each>
+
+ </xsl:if>
+
+ <!-- Bottom Navigation Bar -->
+ <xsl:call-template name="output_navbar">
+ <xsl:with-param name="p_show_frames" select="1"/>
+ <xsl:with-param name="p_show_noframes" select="1"/>
+ <xsl:with-param name="p_show_package" select="0"/>
+ <xsl:with-param name="p_show_package_tree" select="0"/>
+ <xsl:with-param name="p_show_full_tree" select="1"/>
+ <xsl:with-param name="p_show_index" select="0"/>
+ <xsl:with-param name="p_curr_index" select="1"/>
+ <xsl:with-param name="p_show_help" select="1"/>
+ <xsl:with-param name="p_top" select="0"/>
+ </xsl:call-template>
+ </div>
+ </body>
+ </html>
+
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/classdoc-source.xsl b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/classdoc-source.xsl
new file mode 100644
index 000000000..a6405e40c
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/classdoc-source.xsl
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- classdoc-source.xsl
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+ -->
+
+<!-- Outputs an HTML file showing the source code for the class
+ designated by $gjdoc.outputfile.info.
+ -->
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:gjdoc="http://www.gnu.org/software/cp-tools/gjdocxml"
+ xmlns:html="http://www.w3.org/TR/REC-html40"
+ xmlns="http://www.w3.org/TR/REC-html40">
+
+ <xsl:include href="html_common.xsl"/>
+
+ <xsl:output method="html"
+ encoding="utf-8"
+ doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
+ doctype-system="http://www.w3.org/TR/html4/loose.dtd"
+ indent="no"/>
+
+ <xsl:strip-space elements="*"/>
+
+ <xsl:template match="/">
+ <xsl:for-each select="document(concat($gjdoc.outputfile.info, '.xml'),/gjdoc:rootdoc)/gjdoc:classdoc/gjdoc:source">
+ <html>
+ <head>
+ <xsl:call-template name="include_common"/>
+ <xsl:call-template name="output_title">
+ <xsl:with-param name="p_pagetitle" select="concat(ancestor::gjdoc:classdoc/@name, '.java')"/>
+ </xsl:call-template>
+ </head>
+ <body>
+ <xsl:copy-of select="."/>
+ </body>
+ </html>
+ </xsl:for-each>
+
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/classdoc-uses.xsl b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/classdoc-uses.xsl
new file mode 100644
index 000000000..17f9b3f7f
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/classdoc-uses.xsl
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- classdoc-uses.xsl
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+ -->
+
+<!-- Outputs an HTML file showing the source code for the class
+ designated by $gjdoc.outputfile.info.
+ -->
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:gjdoc="http://www.gnu.org/software/cp-tools/gjdocxml"
+ xmlns:html="http://www.w3.org/TR/REC-html40"
+ xmlns="http://www.w3.org/TR/REC-html40">
+
+ <xsl:include href="html_common.xsl"/>
+
+ <xsl:output method="html"
+ encoding="utf-8"
+ doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
+ doctype-system="http://www.w3.org/TR/html4/loose.dtd"
+ indent="no"/>
+
+ <xsl:strip-space elements="*"/>
+
+ <xsl:template match="gjdoc:referencing-package">
+ <h2 class="classdoc-header">
+ Uses in package
+ <xsl:value-of select="@name"/>
+ </h2>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="gjdoc:user">
+ <dt>
+ <xsl:choose>
+ <xsl:when test="@field">
+ <a href="{concat($gjdoc.pathtoroot, translate(ancestor::gjdoc:referencing-package/@name, '.', '/'), '/', @class, '.html#', @field)}">
+ <xsl:value-of select="concat(@class, '.', @field)"/>
+ </a>
+ </xsl:when>
+ <xsl:when test="@method">
+ <a href="{concat($gjdoc.pathtoroot, translate(ancestor::gjdoc:referencing-package/@name, '.', '/'), '/', @class, '.html#', @method, @signature)}">
+ <xsl:value-of select="concat(@class, '.', @method, @flatSignature)"/>
+ </a>
+ </xsl:when>
+ <xsl:when test="@class">
+ <a href="{concat($gjdoc.pathtoroot, translate(ancestor::gjdoc:referencing-package/@name, '.', '/'), '/', @class, '.html')}">
+ <xsl:value-of select="@class"/>
+ </a>
+ </xsl:when>
+ </xsl:choose>
+ </dt>
+ </xsl:template>
+
+ <xsl:template match="gjdoc:usage-type">
+
+ <h3 class="classdoc-header">
+ <xsl:variable name="v_qualifiedtypename"
+ select="ancestor::gjdoc:classdoc/@qualifiedtypename"/>
+ <xsl:variable name="v_packagename"
+ select="../@name"/>
+ <xsl:choose>
+ <xsl:when test="@id='class-derived-from'">
+ <xsl:text>Classes in </xsl:text><xsl:value-of select="$v_packagename"/><xsl:text> derived from </xsl:text><xsl:value-of select="$v_qualifiedtypename"/>
+ </xsl:when>
+ <xsl:when test="@id='field-of-type'">
+ <xsl:text>Fields in </xsl:text><xsl:value-of select="$v_packagename"/><xsl:text> of type </xsl:text><xsl:value-of select="$v_qualifiedtypename"/>
+ </xsl:when>
+ <xsl:when test="@id='method-with-return-type'">
+ <xsl:text>Methods in </xsl:text><xsl:value-of select="$v_packagename"/><xsl:text> returning </xsl:text><xsl:value-of select="$v_qualifiedtypename"/>
+ </xsl:when>
+ <xsl:when test="@id='method-with-parameter-type'">
+ <xsl:text>Methods in </xsl:text><xsl:value-of select="$v_packagename"/><xsl:text> accepting parameters of type </xsl:text><xsl:value-of select="$v_qualifiedtypename"/>
+ </xsl:when>
+ <xsl:when test="@id='method-with-thrown-type'">
+ <xsl:text>Methods in </xsl:text><xsl:value-of select="$v_packagename"/><xsl:text> throwing </xsl:text><xsl:value-of select="$v_qualifiedtypename"/>
+ </xsl:when>
+ <xsl:when test="@id='constructor-with-parameter-type'">
+ <xsl:text>Constructors in </xsl:text><xsl:value-of select="$v_packagename"/><xsl:text> accepting parameters of type </xsl:text><xsl:value-of select="$v_qualifiedtypename"/>
+ </xsl:when>
+ <xsl:when test="@id='constructor-with-thrown-type'">
+ <xsl:text>Constructors in </xsl:text><xsl:value-of select="$v_packagename"/><xsl:text> throwing </xsl:text><xsl:value-of select="$v_qualifiedtypename"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>Unknown ID </xsl:text><xsl:value-of select="@id"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </h3>
+ <dl>
+ <xsl:apply-templates/>
+ </dl>
+ </xsl:template>
+
+ <xsl:template match="/">
+ <html>
+ <head>
+ <xsl:call-template name="include_common"/>
+ <xsl:call-template name="output_title">
+ <xsl:with-param name="p_pagetitle" select="concat(ancestor::gjdoc:classdoc/@name, ' Class Usage')"/>
+ </xsl:call-template>
+ </head>
+ <body>
+ <div class="pagebody">
+
+ <!-- Top Navigation Bar -->
+ <xsl:call-template name="output_navbar">
+ <xsl:with-param name="p_show_frames" select="1"/>
+ <xsl:with-param name="p_show_noframes" select="1"/>
+ <xsl:with-param name="p_show_package" select="1"/>
+ <xsl:with-param name="p_show_package_tree" select="1"/>
+ <xsl:with-param name="p_show_full_tree" select="1"/>
+ <xsl:with-param name="p_show_index" select="1"/>
+ <xsl:with-param name="p_show_help" select="1"/>
+ <xsl:with-param name="p_top" select="1"/>
+ <xsl:with-param name="p_show_source" select="concat($gjdoc.pathtoroot, 'src-html/', translate(gjdoc:containingPackage/@name, '.', '/'), '/', @name, '.html')"/>
+ <xsl:with-param name="p_show_class" select="concat($gjdoc.pathtoroot, translate(gjdoc:containingPackage/@name, '.', '/'), '/', @name, '.html')"/>
+ <xsl:with-param name="p_curr_uses" select="1"/>
+ </xsl:call-template>
+
+ <xsl:for-each select="document(concat($gjdoc.outputfile.info, '.xml'),/gjdoc:rootdoc)/gjdoc:classdoc/gjdoc:references">
+
+ <h1 class="classdoc-header">
+ Uses of class
+ <xsl:value-of select="ancestor::gjdoc:classdoc/@qualifiedtypename"/>
+ <xsl:apply-templates/>
+ </h1>
+ </xsl:for-each>
+
+ <!-- Bottom Navigation Bar -->
+ <xsl:call-template name="output_navbar">
+ <xsl:with-param name="p_show_frames" select="1"/>
+ <xsl:with-param name="p_show_noframes" select="1"/>
+ <xsl:with-param name="p_show_package" select="1"/>
+ <xsl:with-param name="p_show_package_tree" select="1"/>
+ <xsl:with-param name="p_show_full_tree" select="1"/>
+ <xsl:with-param name="p_show_index" select="1"/>
+ <xsl:with-param name="p_show_help" select="1"/>
+ <xsl:with-param name="p_top" select="0"/>
+ <xsl:with-param name="p_show_source" select="concat($gjdoc.pathtoroot, 'src-html/', translate(gjdoc:containingPackage/@name, '.', '/'), '/', @name, '.html')"/>
+ <xsl:with-param name="p_show_class" select="concat($gjdoc.pathtoroot, translate(gjdoc:containingPackage/@name, '.', '/'), '/', @name, '.html')"/>
+ <xsl:with-param name="p_curr_uses" select="1"/>
+ </xsl:call-template>
+
+ </div>
+ </body>
+ </html>
+
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/classdoc.xsl b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/classdoc.xsl
new file mode 100644
index 000000000..e54e5fb12
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/classdoc.xsl
@@ -0,0 +1,1070 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- classdoc.xsl
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+ -->
+
+<!-- Creates the class descriptor files for HTML documentation.
+ -->
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:gjdoc="http://www.gnu.org/software/cp-tools/gjdocxml"
+ xmlns:html="http://www.w3.org/TR/REC-html40"
+ xmlns="http://www.w3.org/TR/REC-html40">
+
+ <xsl:include href="html_common.xsl"/>
+
+ <xsl:output method="html"
+ encoding="utf-8"
+ doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
+ doctype-system="http://www.w3.org/TR/html4/loose.dtd"
+ indent="no"/>
+
+ <xsl:strip-space elements="*"/>
+
+ <xsl:template match="gjdoc:tag[attribute::kind='@see'][attribute::name='@link']">
+ <xsl:call-template name="output_link_tag"/>
+ </xsl:template>
+
+ <xsl:template mode="pre" match="*">
+ <xsl:choose>
+ <xsl:when test="'pre'=local-name(.)">
+ <xsl:apply-templates mode="pre"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:copy-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template mode="pre" match="text()[position()=last()]">
+ <xsl:call-template name="strip_trailing_ws">
+ <xsl:with-param name="p_content" select="."/>
+ </xsl:call-template>
+ </xsl:template>
+
+ <xsl:template name="strip_trailing_ws">
+ <xsl:param name="p_content"/>
+
+ <xsl:if test="normalize-space($p_content)!=''">
+ <xsl:choose>
+ <xsl:when test="normalize-space(substring($p_content, string-length($p_content), 1))=''">
+ <xsl:call-template name="strip_trailing_ws">
+ <xsl:with-param name="p_content">
+ <xsl:value-of select="substring($p_content, 1, string-length($p_content)-1)"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:copy-of select="$p_content"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="*">
+ <xsl:element name="{name()}">
+ <xsl:for-each select="attribute::*">
+ <xsl:attribute name="{name()}">
+ <xsl:value-of select="."/>
+ </xsl:attribute>
+ </xsl:for-each>
+ <xsl:choose>
+ <xsl:when test="name()='pre'">
+ <xsl:apply-templates select="." mode="pre"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="/">
+
+ <xsl:for-each select="document(concat($gjdoc.outputfile.info, '.xml'),/gjdoc:rootdoc)/gjdoc:classdoc">
+ <xsl:call-template name="create_classdoc"/>
+ </xsl:for-each>
+
+ </xsl:template>
+
+ <!-- For every classdoc node found in the source XML, create a corresponding -->
+ <!-- class rootdoc HTML file. -->
+
+ <xsl:template name="create_classdoc">
+
+ <xsl:variable name="v_sub_xml_filename">
+ <xsl:value-of select="concat(@qualifiedtypename,'.xml')"/>
+ </xsl:variable>
+
+ <html>
+ <head>
+ <xsl:call-template name="output_title">
+ <xsl:with-param name="p_pagetitle" select="@name"/>
+ </xsl:call-template>
+ <xsl:call-template name="include_common"/>
+ </head>
+ <body class="classdoc" onload="if(parent.contentPageLoaded)parent.contentPageLoaded(document.title)">
+
+ <div class="pagebody">
+
+ <xsl:call-template name="classdoc_header"/>
+ <xsl:call-template name="classdoc_all_field_summary">
+ <xsl:with-param name="v_sub_xml_filename">
+ <xsl:value-of select="$v_sub_xml_filename"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ <xsl:call-template name="classdoc_all_constructor_summary">
+ <xsl:with-param name="v_sub_xml_filename">
+ <xsl:value-of select="$v_sub_xml_filename"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ <xsl:call-template name="classdoc_all_method_summary">
+ <xsl:with-param name="v_sub_xml_filename">
+ <xsl:value-of select="$v_sub_xml_filename"/>
+ </xsl:with-param>
+ </xsl:call-template>
+
+ <xsl:if test="gjdoc:fielddoc">
+ <h1 class="classdoc-header">Field Details</h1>
+
+ <xsl:for-each select="gjdoc:fielddoc">
+ <xsl:sort select="@name" order="ascending"/>
+ <xsl:call-template name="classdoc_field_details"/>
+ </xsl:for-each>
+ </xsl:if>
+
+ <xsl:if test="gjdoc:constructordoc">
+ <h1 class="classdoc-header">Constructor Details</h1>
+
+ <xsl:for-each select="gjdoc:constructordoc">
+ <xsl:sort select="gjdoc:signature/@full" order="ascending"/>
+ <xsl:call-template name="classdoc_method_details"/>
+ </xsl:for-each>
+ </xsl:if>
+
+ <xsl:if test="gjdoc:methoddoc">
+ <h1 class="classdoc-header">Method Details</h1>
+
+ <xsl:for-each select="gjdoc:methoddoc">
+ <xsl:sort select="@name" order="ascending"/>
+ <xsl:sort select="gjdoc:signature/@full" order="ascending"/>
+ <xsl:call-template name="classdoc_method_details"/>
+ </xsl:for-each>
+ </xsl:if>
+
+ <!-- Bottom Navigation Bar -->
+ <xsl:call-template name="output_navbar">
+ <xsl:with-param name="p_show_frames" select="1"/>
+ <xsl:with-param name="p_show_noframes" select="1"/>
+ <xsl:with-param name="p_show_package" select="1"/>
+ <xsl:with-param name="p_show_package_tree" select="1"/>
+ <xsl:with-param name="p_show_full_tree" select="1"/>
+ <xsl:with-param name="p_show_index" select="1"/>
+ <xsl:with-param name="p_show_help" select="1"/>
+ <xsl:with-param name="p_top" select="0"/>
+ <xsl:with-param name="p_show_source" select="concat($gjdoc.pathtoroot, 'src-html/', translate(gjdoc:containingPackage/@name, '.', '/'), '/', @name, '.html')"/>
+ <xsl:with-param name="p_show_use" select="concat($gjdoc.pathtoroot, 'class-use/', translate(gjdoc:containingPackage/@name, '.', '/'), '/', @name, '.html')"/>
+ <xsl:with-param name="p_curr_class" select="1"/>
+ </xsl:call-template>
+
+ </div>
+ </body>
+ </html>
+ </xsl:template>
+
+ <!-- Output header for Class documentation -->
+
+ <xsl:template name="classdoc_header">
+
+ <!-- Top Navigation Bar -->
+ <xsl:call-template name="output_navbar">
+ <xsl:with-param name="p_show_frames" select="1"/>
+ <xsl:with-param name="p_show_noframes" select="1"/>
+ <xsl:with-param name="p_show_package" select="1"/>
+ <xsl:with-param name="p_show_package_tree" select="1"/>
+ <xsl:with-param name="p_show_full_tree" select="1"/>
+ <xsl:with-param name="p_show_index" select="1"/>
+ <xsl:with-param name="p_show_help" select="1"/>
+ <xsl:with-param name="p_top" select="1"/>
+ <xsl:with-param name="p_show_source" select="concat($gjdoc.pathtoroot, 'src-html/', translate(gjdoc:containingPackage/@name, '.', '/'), '/', @name, '.html')"/>
+ <xsl:with-param name="p_show_use" select="concat($gjdoc.pathtoroot, 'class-use/', translate(gjdoc:containingPackage/@name, '.', '/'), '/', @name, '.html')"/>
+ <xsl:with-param name="p_curr_class" select="1"/>
+ </xsl:call-template>
+
+ <div class="classdoc-head">
+
+ <div class="classdoc-head-packagename classdoc-subtitle">
+ <xsl:value-of select="gjdoc:containingPackage/@name"/>
+ </div>
+
+ <h1 class="classdoc-head-classname classdoc-title">
+ <xsl:choose>
+ <xsl:when test="gjdoc:isInterface">
+ <xsl:text>Interface </xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>Class </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:value-of select="@name"/>
+ </h1>
+
+ </div>
+
+ <xsl:if test="gjdoc:isClass">
+ <xsl:call-template name="classdoc_heritage_tree"/>
+ </xsl:if>
+
+ <xsl:if test="gjdoc:containingClass">
+ <xsl:variable name="v_qualifiedtypename" select="attribute::qualifiedtypename"/>
+ <b>Enclosing Class:</b><br/>
+ <xsl:call-template name="link_to_class">
+ <xsl:with-param name="p_name" select="gjdoc:containingClass/@typename"/>
+ <xsl:with-param name="p_qualifiedname" select="gjdoc:containingClass/@qualifiedtypename"/>
+ </xsl:call-template>
+ </xsl:if>
+
+ <xsl:if test="gjdoc:implements">
+ <p/>
+ <b>
+ <xsl:choose>
+ <xsl:when test="gjdoc:isInterface">
+ <xsl:text>All Superinterfaces:</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>All Implemented Interfaces:</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </b>
+ <br/>
+ <xsl:for-each select="gjdoc:implements|gjdoc:superimplements">
+ <xsl:sort select="@qualifiedtypename" order="ascending"/>
+ <xsl:call-template name="link_to_class">
+ <xsl:with-param name="p_name" select="@typename"/>
+ <xsl:with-param name="p_qualifiedname" select="@qualifiedtypename"/>
+ </xsl:call-template>
+ <xsl:if test="position() != last()">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:if>
+ <p/>
+
+ <xsl:if test="gjdoc:isInterface">
+ <xsl:variable name="v_qualifiedtypename" select="attribute::qualifiedtypename"/>
+ <xsl:variable name="v_implementors" select="document('index.xml', /)/gjdoc:rootdoc/gjdoc:classdoc[child::gjdoc:isInterface]/gjdoc:implements[attribute::qualifiedtypename=$v_qualifiedtypename]"/>
+ <xsl:if test="$v_implementors">
+ <b>All Known Direct Subinterfaces:</b><br/>
+ <xsl:for-each select="$v_implementors">
+ <xsl:sort select="../@qualifiedtypename" order="ascending"/>
+ <xsl:call-template name="link_to_class">
+ <xsl:with-param name="p_name" select="../@name"/>
+ <xsl:with-param name="p_qualifiedname" select="../@qualifiedtypename"/>
+ </xsl:call-template>
+ <xsl:if test="position() != last()">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:if>
+
+ <xsl:if test="gjdoc:isInterface">
+ <xsl:variable name="v_qualifiedtypename" select="attribute::qualifiedtypename"/>
+ <xsl:variable name="v_implementors" select="document('index.xml', /)/gjdoc:rootdoc/gjdoc:classdoc[child::gjdoc:isClass]/gjdoc:implements[attribute::qualifiedtypename=$v_qualifiedtypename]"/>
+ <xsl:if test="$v_implementors">
+ <b>Known Implementing Classes:</b><br/>
+ <xsl:for-each select="$v_implementors">
+ <xsl:sort select="../@qualifiedtypename" order="ascending"/>
+ <xsl:call-template name="link_to_class">
+ <xsl:with-param name="p_name" select="../@name"/>
+ <xsl:with-param name="p_qualifiedname" select="../@qualifiedtypename"/>
+ </xsl:call-template>
+ <xsl:if test="position() != last()">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:if>
+
+ <xsl:if test="gjdoc:isClass">
+ <xsl:variable name="v_qualifiedtypename" select="attribute::qualifiedtypename"/>
+ <xsl:variable name="v_implementors" select="document('index.xml', /)/gjdoc:rootdoc/gjdoc:classdoc[not(child::gjdoc:isInterface)]/gjdoc:superclass[attribute::qualifiedtypename=$v_qualifiedtypename]"/>
+ <xsl:if test="$v_implementors">
+ <b>Known Direct Subclasses:</b><br/>
+ <xsl:for-each select="$v_implementors">
+ <xsl:sort select="../@qualifiedtypename" order="ascending"/>
+ <xsl:call-template name="link_to_class">
+ <xsl:with-param name="p_name" select="../@name"/>
+ <xsl:with-param name="p_qualifiedname" select="../@qualifiedtypename"/>
+ </xsl:call-template>
+ <xsl:if test="position() != last()">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:if>
+
+ <hr/>
+
+ <div class="classdoc-prototype">
+
+ <!-- 'public final class Byte' -->
+
+ <xsl:value-of select="gjdoc:access/@scope"/><xsl:text> </xsl:text>
+ <xsl:if test="gjdoc:isStatic"><xsl:text>static </xsl:text></xsl:if>
+ <xsl:if test="gjdoc:isFinal"><xsl:text>final </xsl:text></xsl:if>
+ <xsl:choose>
+ <xsl:when test="gjdoc:isInterface">
+ <xsl:text>interface </xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="gjdoc:isAbstract"><xsl:text>abstract </xsl:text></xsl:if>
+ <xsl:text>class </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:call-template name="link_to_class_source"/><br/>
+
+ <!-- 'extends Number' -->
+
+ <xsl:if test="gjdoc:isClass and @qualifiedtypename!='java.lang.Object'">
+ <xsl:text>extends </xsl:text>
+ <xsl:call-template name="link_to_class">
+ <xsl:with-param name="p_qualifiedname">
+ <xsl:value-of select="gjdoc:superclass/@qualifiedtypename"/>
+ </xsl:with-param>
+ <xsl:with-param name="p_name">
+ <xsl:value-of select="gjdoc:superclass/@typename"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ <br/>
+ </xsl:if>
+
+ <!-- 'implements Comparable' -->
+
+ <xsl:if test="gjdoc:implements">
+ <xsl:text>implements </xsl:text>
+ </xsl:if>
+ <xsl:for-each select="gjdoc:implements">
+ <xsl:call-template name="link_to_class">
+ <xsl:with-param name="p_qualifiedname">
+ <xsl:value-of select="@qualifiedtypename"/>
+ </xsl:with-param>
+ <xsl:with-param name="p_name">
+ <xsl:value-of select="@typename"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ <xsl:if test="position() != last()">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+
+ </div>
+
+ <!-- Documentation -->
+
+ <p/>
+
+ <xsl:if test="gjdoc:inlineTags">
+ <div class="classdoc-class-comment-body">
+ <xsl:for-each select="gjdoc:inlineTags/node()">
+ <xsl:apply-templates select="."/>
+ </xsl:for-each>
+ </div>
+ </xsl:if>
+
+ <xsl:call-template name="output_see_tags"/>
+ <xsl:call-template name="output_taglet_tags"/>
+
+ </xsl:template>
+
+ <xsl:template name="output_taglet_tags">
+
+ <xsl:for-each select="gjdoc:tags/gjdoc:tag">
+ <xsl:choose>
+ <xsl:when test="@name='@deprecated'">
+ <div class="classdoc-tag-section-header">
+ <xsl:value-of select="'Deprecated:'"/>
+ </div>
+ <dl class="classdoc-list">
+ <xsl:for-each select="gjdoc:inlineTags">
+ <xsl:apply-templates/>
+ </xsl:for-each>
+ </dl>
+ </xsl:when>
+ <xsl:when test="@taglet-generated">
+ <xsl:copy-of select="./*"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+
+ </xsl:template>
+
+ <!-- Output summary of all fields in this class -->
+
+ <xsl:template name="classdoc_all_field_summary">
+
+ <xsl:if test=".//gjdoc:fielddoc">
+
+ <table border="1" cellspacing="0" class="classdoc-table">
+ <tr><td class="section-header" colspan="2"><div class="section-header">Field Summary</div></td></tr>
+ <xsl:for-each select="gjdoc:fielddoc">
+ <xsl:sort select="@name" order="ascending"/>
+ <xsl:call-template name="classdoc_field_summary_tr"/>
+ </xsl:for-each>
+ </table>
+
+ <xsl:for-each select="gjdoc:superclass">
+ <xsl:call-template name="output_superclass_fields"/>
+ </xsl:for-each>
+ </xsl:if>
+
+ </xsl:template>
+
+ <!-- Output summary of all methods in this class -->
+
+ <xsl:template name="classdoc_all_method_summary">
+
+ <xsl:if test=".//gjdoc:methoddoc">
+ <table border="1" cellspacing="0" class="classdoc-table">
+ <tr><td class="section-header" colspan="2"><div class="section-header">Method Summary</div></td></tr>
+ <xsl:for-each select="gjdoc:methoddoc">
+ <xsl:sort select="@name" order="ascending"/>
+ <xsl:call-template name="classdoc_method_summary_tr"/>
+ </xsl:for-each>
+ </table>
+
+ <xsl:for-each select="gjdoc:superclass">
+ <xsl:call-template name="output_superclass_methods"/>
+ </xsl:for-each>
+ </xsl:if>
+
+ </xsl:template>
+
+ <!-- Output summary of all constructors in this class -->
+
+ <xsl:template name="classdoc_all_constructor_summary">
+
+ <xsl:if test=".//gjdoc:constructordoc">
+ <!--
+ <h1 class="classdoc-header">Constructor Summary</h1>
+-->
+
+ <table class="classdoc-table">
+ <tr><td class="section-header" colspan="2"><div class="section-header">Constructor Summary</div></td></tr>
+ <xsl:for-each select="gjdoc:constructordoc">
+ <xsl:sort select="@name" order="ascending"/>
+ <xsl:call-template name="classdoc_method_summary_tr"/>
+ </xsl:for-each>
+ </table>
+ </xsl:if>
+
+ </xsl:template>
+
+ <!-- Output summary of a single field -->
+
+ <xsl:template name="classdoc_field_summary_tr">
+
+ <tr valign="top">
+
+ <!-- Left table cell: Modifiers and Return Type -->
+
+ <td valign="top" class="member-summary field modifiers">
+ <code class="member-summary field modifiers">
+ <xsl:call-template name="output_modifiers_summary"/>
+ <xsl:call-template name="link_to_class">
+ <xsl:with-param name="p_name">
+ <xsl:value-of select="gjdoc:type/@typename"/>
+ </xsl:with-param>
+ <xsl:with-param name="p_qualifiedname">
+ <xsl:value-of select="gjdoc:type/@qualifiedtypename"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ <xsl:value-of select="gjdoc:type/@dimension"/>
+ </code>
+ </td>
+
+ <!-- Right table cell: name and short description -->
+
+ <td class="member-summary field name">
+ <!-- Method signature -->
+
+ <!-- Link to field definition -->
+
+ <code class="member-summary field name">
+ <a href="{concat('#',@name)}" class="field name"><xsl:value-of select="@name"/></a>
+ </code>
+
+ <!-- Brief description of field -->
+
+ <blockquote class="member-summary field comment">
+ <xsl:for-each select="gjdoc:firstSentenceTags/node()">
+ <xsl:value-of select="." disable-output-escaping="yes"/>
+ </xsl:for-each>
+ </blockquote>
+ </td>
+
+ </tr>
+
+ </xsl:template>
+
+ <xsl:template name="output_modifiers">
+ <xsl:if test="gjdoc:isNative">
+ <xsl:text>native </xsl:text>
+ </xsl:if>
+ <xsl:if test="gjdoc:isStatic">
+ <xsl:text>static </xsl:text>
+ </xsl:if>
+ <xsl:if test="gjdoc:isFinal">
+ <xsl:text>final </xsl:text>
+ </xsl:if>
+ <xsl:if test="gjdoc:isAbstract">
+ <xsl:text>abstract </xsl:text>
+ </xsl:if>
+ <xsl:if test="gjdoc:isTransient">
+ <xsl:text>transient </xsl:text>
+ </xsl:if>
+ <xsl:if test="gjdoc:isVolatile">
+ <xsl:text>volatile </xsl:text>
+ </xsl:if>
+ <xsl:if test="gjdoc:isSynchronized">
+ <xsl:text>synchronized </xsl:text>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="output_modifiers_summary">
+ <xsl:if test="gjdoc:isStatic">
+ <xsl:text>static </xsl:text>
+ </xsl:if>
+ <xsl:if test="gjdoc:isAbstract">
+ <xsl:text>abstract </xsl:text>
+ </xsl:if>
+ <xsl:if test="gjdoc:isTransient">
+ <xsl:text>transient </xsl:text>
+ </xsl:if>
+ <xsl:if test="gjdoc:isVolatile">
+ <xsl:text>volatile </xsl:text>
+ </xsl:if>
+ <xsl:if test="gjdoc:isSynchronized">
+ <xsl:text>synchronized </xsl:text>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- Output summary of a single method or constructor -->
+
+ <xsl:template name="classdoc_method_summary_tr">
+
+ <tr valign="top">
+
+ <!-- Left table cell: Modifiers and Return Type -->
+
+ <xsl:if test="gjdoc:isMethod">
+ <td valign="top" class="member-summary method modifiers">
+ <code class="member-summary method modifiers">
+ <xsl:call-template name="output_modifiers_summary"/>
+ <xsl:text> </xsl:text>
+ <xsl:call-template name="link_to_class">
+ <xsl:with-param name="p_qualifiedname" select="gjdoc:returns/@qualifiedtypename"/>
+ <xsl:with-param name="p_name" select="gjdoc:returns/@typename"/>
+ </xsl:call-template>
+ <xsl:value-of select="gjdoc:returns/@dimension"/>
+ </code>
+ </td>
+ </xsl:if>
+
+ <!-- Right table cell: signature and short description -->
+
+ <td align="left" valign="top" class="member-summary method name">
+
+ <!-- Method signature -->
+
+ <code class="member-summary method signature">
+
+ <!-- Link to method definition -->
+
+ <a href="{concat('#',@name,gjdoc:signature/@full)}" class="member-summary method name"><xsl:value-of select="@name"/></a>
+
+ <!-- Parameter List -->
+
+ <xsl:text>(</xsl:text>
+ <xsl:call-template name="list_parameters"/>
+ <xsl:text>)</xsl:text>
+ </code>
+
+ <!-- Brief description of Method -->
+
+ <blockquote class="member-summary method comment">
+ <xsl:choose>
+ <xsl:when test="gjdoc:tags/gjdoc:tag[@kind='@deprecated']">
+ <i>
+ <b>Deprecated. </b>
+ <xsl:for-each select="gjdoc:tags/gjdoc:tag[@kind='@deprecated']/gjdoc:firstSentenceTags">
+ <xsl:apply-templates/>
+ </xsl:for-each>
+ </i>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="gjdoc:firstSentenceTags/node()">
+ <xsl:value-of disable-output-escaping="yes" select="."/>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </blockquote>
+ </td>
+ </tr>
+
+ </xsl:template>
+
+ <!-- Output a list of all parameters of the current methoddoc -->
+ <xsl:template name="list_parameters">
+ <xsl:for-each select="gjdoc:parameter">
+ <span class="parameter">
+ <xsl:call-template name="link_to_class">
+ <xsl:with-param name="p_qualifiedname">
+ <xsl:value-of select="@qualifiedtypename"/>
+ </xsl:with-param>
+ <xsl:with-param name="p_name">
+ <xsl:value-of select="@typename"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ <xsl:value-of select="@dimension"/>
+ <xsl:text disable-output-escaping="no">&#160;</xsl:text>
+ <xsl:value-of select="@name"/>
+ <xsl:if test="position() != last()">
+ <xsl:text>,</xsl:text>
+ </xsl:if>
+ </span>
+ <xsl:if test="position() != last()">
+ <xsl:text> </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="list_parameter_details">
+ <dl class="classdoc-list">
+ <xsl:for-each select="gjdoc:parameter">
+ <dt>
+ <span class="prototype-name">
+ <xsl:value-of select="@name"/>
+ </span>
+ <xsl:variable name="param_position" select="position()"/>
+
+ <xsl:if test="../gjdoc:tags/gjdoc:tag[attribute::kind='@param' and position()=$param_position]">
+ <xsl:text> - </xsl:text>
+ <xsl:for-each select="../gjdoc:tags/gjdoc:tag[attribute::kind='@param' and position()=$param_position]/gjdoc:inlineTags/node()">
+ <xsl:copy-of select="."/>
+ </xsl:for-each>
+ </xsl:if>
+ </dt>
+ </xsl:for-each>
+ </dl>
+ </xsl:template>
+
+ <xsl:template name="output_see_tags">
+ <xsl:if test="gjdoc:tags/gjdoc:tag[attribute::kind='@see']">
+ <div class="classdoc-tag-section-header"><b>See Also:</b></div>
+
+ <dl class="classdoc-list">
+ <xsl:for-each select="gjdoc:tags/gjdoc:tag[attribute::kind='@see']">
+ <!--
+ <xsl:variable name="v_see" select="normalize-space(.)"/>
+ -->
+ <dt>
+ <code>
+ <xsl:call-template name="output_link_tag"/>
+ </code>
+ </dt>
+ </xsl:for-each>
+ </dl>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- Output details of all fields in this class -->
+
+ <xsl:template name="classdoc_field_details">
+
+ <a name="{@name}" class="classdoc"> </a>
+ <div class="before-details"> </div>
+
+ <h3><xsl:value-of select="@name"/></h3>
+
+ <p class="prototype"><code>
+ <xsl:value-of select="gjdoc:access/@scope"/>
+ <xsl:text> </xsl:text>
+ <xsl:call-template name="output_modifiers"/>
+ <xsl:value-of select="gjdoc:type/@typename"/>
+ <xsl:value-of select="gjdoc:type/@dimension"/>
+ <xsl:text> </xsl:text>
+ <xsl:call-template name="link_to_member_source"/>
+ </code></p>
+
+ <p/>
+
+ <!-- Full comment text -->
+
+ <xsl:if test="gjdoc:inlineTags">
+ <div class="classdoc-comment-body">
+ <xsl:for-each select="gjdoc:inlineTags/node()">
+ <xsl:apply-templates select="."/>
+ </xsl:for-each>
+ </div>
+ </xsl:if>
+
+ <p/>
+
+ <xsl:call-template name="output_taglet_tags"/>
+
+ <!-- See Also -->
+
+ <xsl:call-template name="output_see_tags"/>
+
+ <xsl:if test="position()!=last()">
+ <hr/>
+ </xsl:if>
+
+ </xsl:template>
+
+
+ <!-- Output details of all methods in this class -->
+
+ <xsl:template name="classdoc_method_details">
+
+ <a name="{concat(@name,gjdoc:signature/@full)}" class="classdoc"> </a>
+ <div class="before-details"> </div>
+
+ <h3><xsl:value-of select="@name"/></h3>
+
+ <p class="prototype"><code>
+ <xsl:value-of select="gjdoc:access/@scope"/>
+ <xsl:text> </xsl:text>
+ <xsl:call-template name="output_modifiers"/>
+ <xsl:value-of select="gjdoc:returns/@typename"/><xsl:value-of select="gjdoc:returns/@dimension"/>
+ <xsl:text> </xsl:text>
+ <xsl:call-template name="link_to_member_source"/>
+ <xsl:text>(</xsl:text>
+ <xsl:call-template name="list_parameters"/>
+ <xsl:text>)</xsl:text>
+ </code></p>
+
+ <!-- Full comment text -->
+
+ <xsl:if test="gjdoc:inlineTags">
+ <div class="classdoc-comment-body">
+ <xsl:for-each select="gjdoc:inlineTags/node()">
+ <xsl:apply-templates select="."/>
+ </xsl:for-each>
+ </div>
+ </xsl:if>
+
+ <p/>
+
+ <xsl:call-template name="output_taglet_tags"/>
+
+ <xsl:if test="gjdoc:parameter">
+ <div class="classdoc-tag-section-header"><b>Parameters:</b></div>
+ <xsl:call-template name="list_parameter_details"/>
+ </xsl:if>
+
+ <xsl:if test="gjdoc:tags/gjdoc:tag[attribute::kind='@return']">
+ <div class="classdoc-tag-section-header"><b>Returns:</b></div>
+ <dl class="classdoc-list">
+ <dt>
+ <xsl:for-each select="gjdoc:tags/gjdoc:tag[attribute::kind='@return']">
+ <xsl:value-of select="." disable-output-escaping="yes"/>
+ </xsl:for-each>
+ </dt>
+ </dl>
+ </xsl:if>
+
+ <xsl:if test="gjdoc:tags/gjdoc:tag[attribute::kind='@throws']">
+ <div class="classdoc-tag-section-header"><b>Throws:</b></div>
+ <dl class="classdoc-list">
+ <xsl:for-each select="gjdoc:tags/gjdoc:tag[attribute::kind='@throws']">
+ <dt>
+ <code>
+ <xsl:call-template name="link_to_class">
+ <xsl:with-param name="p_qualifiedname">
+ <xsl:value-of select="gjdoc:exception/@qualifiedtypename"/>
+ </xsl:with-param>
+ <xsl:with-param name="p_name">
+ <xsl:value-of select="gjdoc:exception/@typename"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </code>
+ <xsl:text> - </xsl:text>
+ <xsl:for-each select="gjdoc:inlineTags/node()">
+ <xsl:copy-of select="."/>
+ </xsl:for-each>
+ </dt>
+ </xsl:for-each>
+ </dl>
+ </xsl:if>
+
+ <xsl:call-template name="output_see_tags"/>
+
+ <xsl:if test="position()!=last()">
+ <hr/>
+ </xsl:if>
+
+ </xsl:template>
+
+ <!-- Recursively create the tree showing the heritage of the -->
+ <!-- given class -->
+
+ <xsl:template name="create_tree">
+ <xsl:param name="p_superclass"/>
+ <xsl:param name="p_indent"/>
+ <xsl:param name="p_final" select="0"/>
+
+ <xsl:for-each select="/gjdoc:rootdoc/gjdoc:classdoc[attribute::qualifiedtypename=$p_superclass]">
+
+ <xsl:if test="gjdoc:superclass">
+ <xsl:call-template name="create_tree">
+ <xsl:with-param name="p_indent" select="$p_indent+-1"/>
+ <xsl:with-param name="p_superclass" select="gjdoc:superclass/@qualifiedtypename"/>
+ </xsl:call-template>
+
+ <xsl:call-template name="tree_indentation_text_empty">
+ <xsl:with-param name="p_indent" select="$p_indent"/>
+ </xsl:call-template>
+ <xsl:text>|
+</xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+
+ <xsl:if test="$p_indent>0">
+ <xsl:call-template name="tree_indentation">
+ <xsl:with-param name="p_indent" select="$p_indent"/>
+ </xsl:call-template>
+ </xsl:if>
+
+ <xsl:choose>
+ <xsl:when test="$p_final=1">
+ <xsl:value-of select="$p_superclass"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="link_to_class_full">
+ <xsl:with-param name="p_qualifiedname">
+ <xsl:value-of select="$p_superclass"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>
+</xsl:text>
+ </xsl:template>
+
+ <!-- Recursively create the tree showing the heritage of the -->
+ <!-- given class, use bitmaps -->
+
+ <xsl:template name="create_tree_gfx">
+ <xsl:param name="p_superclass"/>
+ <xsl:param name="p_indent"/>
+ <xsl:param name="p_final" select="0"/>
+ <xsl:if test="/gjdoc:rootdoc/gjdoc:classdoc[attribute::qualifiedtypename=$p_superclass]/gjdoc:superclass">
+ <xsl:call-template name="create_tree">
+ <xsl:with-param name="p_indent" select="$p_indent+-1"/>
+ <xsl:with-param name="p_superclass" select="/gjdoc:rootdoc/gjdoc:classdoc[attribute::qualifiedtypename=$p_superclass]/gjdoc:superclass/@qualifiedtypename"/>
+ </xsl:call-template>
+ </xsl:if>
+ <tr><td>
+ <table cellspacing="0" cellpadding="0" border="0">
+ <tr>
+ <xsl:variable name="imagename">
+ <xsl:choose>
+ <xsl:when test="$p_final=1">
+ <xsl:text>images/tree-final-node.png</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>images/tree-node.png</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <td>
+ <xsl:if test="$p_indent>0">
+ <xsl:call-template name="tree_indentation">
+ <xsl:with-param name="p_indent"><xsl:value-of select="$p_indent"/></xsl:with-param>
+ </xsl:call-template>
+ </xsl:if>
+ <img width="10" height="21" class="classdoc-tree-image" src="{$imagename}"/>
+ </td>
+
+ <xsl:choose>
+ <xsl:when test="$p_final=1">
+ <td class="classdoc-tree-label"><xsl:value-of select="$p_superclass"/></td>
+ </xsl:when>
+ <xsl:otherwise>
+ <td class="classdoc-tree-label">
+ <xsl:call-template name="link_to_class_full">
+ <xsl:with-param name="p_qualifiedname">
+ <xsl:value-of select="$p_superclass"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </td>
+ </xsl:otherwise>
+ </xsl:choose>
+ </tr></table>
+ </td></tr>
+ </xsl:template>
+
+ <!-- Recursively output one character for each superclass found for the given -->
+ <!-- class. The length of the resulting string tells how many levels of -->
+ <!-- indentation are required for creating the heritage tree. -->
+
+ <xsl:template name="output_base_markers">
+ <xsl:param name="p_superclass"/>
+
+ <xsl:for-each select="/gjdoc:rootdoc/gjdoc:classdoc[attribute::qualifiedtypename=$p_superclass]">
+ <xsl:if test="gjdoc:superclass">
+ <xsl:call-template name="output_base_markers">
+ <xsl:with-param name="p_superclass" select="gjdoc:superclass/@qualifiedtypename"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+
+ <xsl:text>*</xsl:text>
+ </xsl:template>
+
+ <!-- Heritage Tree -->
+
+ <xsl:template name="classdoc_heritage_tree">
+
+ <xsl:variable name="p_qualifiedtypename" select="@qualifiedtypename"/>
+
+ <xsl:for-each select="document('index.xml', /)/gjdoc:rootdoc/gjdoc:classdoc[@qualifiedtypename=$p_qualifiedtypename]">
+
+ <xsl:variable name="superclass_markers">
+ <xsl:call-template name="output_base_markers">
+ <xsl:with-param name="p_superclass" select="gjdoc:superclass/@qualifiedtypename"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="$gjdoc.allowimages=1">
+ <table border="0" cellpadding="0" cellspacing="0" style="margin:0px; padding:0px; line-height:1px">
+ <xsl:call-template name="create_tree_gfx">
+ <xsl:with-param name="p_indent" select="string-length($superclass_markers)"/>
+ <xsl:with-param name="p_superclass" select="$p_qualifiedtypename"/>
+ <xsl:with-param name="p_final" select="1"/>
+ </xsl:call-template>
+ </table>
+ </xsl:when>
+ <xsl:otherwise>
+ <pre class="inheritance-tree">
+ <xsl:call-template name="create_tree">
+ <xsl:with-param name="p_indent" select="string-length($superclass_markers)"/>
+ <xsl:with-param name="p_superclass" select="$p_qualifiedtypename"/>
+ <xsl:with-param name="p_final" select="1"/>
+ </xsl:call-template>
+ </pre>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="tree_indentation_text_empty">
+ <xsl:param name="p_indent"/>
+ <xsl:choose>
+ <xsl:when test="$p_indent&gt;1">
+ <xsl:text> </xsl:text>
+ <xsl:call-template name="tree_indentation_text_empty">
+ <xsl:with-param name="p_indent"><xsl:value-of select="$p_indent+-1"/></xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- Recursively insert indentation for heritage tree. -->
+ <!-- This one uses images for nice, visual indentation. -->
+ <!-- p_indent selects level of indentation. -->
+
+ <xsl:template name="tree_indentation">
+ <xsl:param name="p_indent"/>
+ <xsl:choose>
+ <xsl:when test="$p_indent&gt;1">
+ <xsl:choose>
+ <xsl:when test="$gjdoc.allowimages=1">
+ <img width="26" height="21" border="0" src="images/tree-empty.png" class="classdoc-tree-image"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text> </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:call-template name="tree_indentation">
+ <xsl:with-param name="p_indent"><xsl:value-of select="$p_indent+-1"/></xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$gjdoc.allowimages=1">
+ <img width="26" height="21" border="0" src="images/tree-branch.png" class="classdoc-tree-image"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>+--</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="output_superclass_methods">
+ <xsl:if test="gjdoc:methoddoc">
+ <table class="classdoc-table">
+ <tr>
+ <td class="sub-section-header">
+ <div class="sub-section-header">Methods inherited from class <xsl:value-of select="@qualifiedtypename"/></div>
+ </td>
+ </tr>
+ <tr>
+ <td class="member-summary super method">
+ <xsl:for-each select="gjdoc:methoddoc">
+ <code class="member-summary super method"><a href="{concat($gjdoc.pathtoroot, translate(../gjdoc:containingPackage/@name, '.', '/'), '/', ../@typename, '.html#', @name, gjdoc:signature/@full)}" class="member-summary super method"><xsl:value-of select="@name"/></a><xsl:if test="position() != last()">, </xsl:if></code>
+ </xsl:for-each>
+ </td>
+ </tr>
+ </table>
+ </xsl:if>
+ </xsl:template>
+
+
+ <xsl:template name="output_superclass_fields">
+ <xsl:if test="gjdoc:fielddoc">
+ <table class="classdoc-table">
+ <tr>
+ <td class="sub-section-header">
+ <div class="sub-section-header">Fields inherited from class <xsl:value-of select="@qualifiedtypename"/></div>
+ </td>
+ </tr>
+ <tr>
+ <td class="member-summary super field">
+ <xsl:for-each select="gjdoc:fielddoc">
+ <code class="member-summary super field"><a href="{concat($gjdoc.pathtoroot, translate(../gjdoc:containingPackage/@name, '.', '/'), '/', ../@typename, '.html#', @name)}" class="member-summary super field"><xsl:value-of select="@name"/></a><xsl:if test="position() != last()">, </xsl:if></code>
+ </xsl:for-each>
+ </td>
+ </tr>
+ </table>
+ </xsl:if>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/deprecated.xsl b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/deprecated.xsl
new file mode 100644
index 000000000..4fc9dfdfd
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/deprecated.xsl
@@ -0,0 +1,261 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- deprecated.xsl
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+ -->
+
+<!-- Creates the deprecation information page for HTML documentation.
+ -->
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:gjdoc="http://www.gnu.org/software/cp-tools/gjdocxml"
+ xmlns:html="http://www.w3.org/TR/REC-html40"
+ xmlns="http://www.w3.org/TR/REC-html40">
+
+ <xsl:include href="html_common.xsl"/>
+
+ <xsl:output method="xml"
+ encoding="utf-8"
+ doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
+ doctype-system="http://www.w3.org/TR/html4/loose.dtd"
+ indent="no"/>
+
+ <xsl:strip-space elements="*"/>
+
+ <xsl:template match="gjdoc:tag[attribute::kind='@see'][attribute::name='@link']">
+ <xsl:call-template name="output_link_tag">
+ <xsl:with-param name="p_contexturl"
+ select="concat(translate(ancestor::gjdoc:classdoc/gjdoc:containingPackage/@name, '.', '/'), '/', ancestor::gjdoc:classdoc/@name,'.html')"/>
+ </xsl:call-template>
+ </xsl:template>
+
+ <xsl:template match="/">
+ <html>
+ <head>
+ <xsl:call-template name="output_title">
+ <xsl:with-param name="p_pagetitle" select="'Deprecated List'"/>
+ </xsl:call-template>
+ <xsl:call-template name="include_common"/>
+ </head>
+ <body class="classdoc" onload="if(parent.contentPageLoaded)parent.contentPageLoaded(document.title)">
+
+ <!-- Top Navigation Bar -->
+ <xsl:call-template name="output_navbar">
+ <xsl:with-param name="p_show_frames" select="1"/>
+ <xsl:with-param name="p_show_noframes" select="1"/>
+ <xsl:with-param name="p_show_package" select="0"/>
+ <xsl:with-param name="p_show_package_tree" select="0"/>
+ <xsl:with-param name="p_show_full_tree" select="1"/>
+ <xsl:with-param name="p_show_index" select="1"/>
+ <xsl:with-param name="p_show_help" select="1"/>
+ <xsl:with-param name="p_show_deprecated" select="0"/>
+ <xsl:with-param name="p_curr_deprecated" select="1"/>
+ <xsl:with-param name="p_top" select="1"/>
+ </xsl:call-template>
+
+ <div class="pagebody">
+
+ <h1 class="classdoc-title">Deprecated API</h1>
+
+ <xsl:choose>
+ <xsl:when test="gjdoc:rootdoc/gjdoc:hasDeprecatedInterfaces or gjdoc:rootdoc/gjdoc:hasDeprecatedClasses or gjdoc:rootdoc/gjdoc:hasDeprecatedExceptions or gjdoc:rootdoc/gjdoc:hasDeprecatedErrors or gjdoc:rootdoc/gjdoc:rootdoc/gjdoc:hasDeprecatedMethods or gjdoc:rootdoc/gjdoc:hasDeprecatedFields">
+ <div class="classdoc-tag-section-header">Contents:</div>
+ <dl class="classdoc-list">
+ <xsl:if test="gjdoc:rootdoc/gjdoc:hasDeprecatedInterfaces">
+ <dt><a href="#interfaces">Deprecated Interfaces</a></dt>
+ </xsl:if>
+ <xsl:if test="gjdoc:rootdoc/gjdoc:hasDeprecatedClasses">
+ <dt><a href="#classes">Deprecated Classes</a></dt>
+ </xsl:if>
+ <xsl:if test="gjdoc:rootdoc/gjdoc:hasDeprecatedExceptions">
+ <dt><a href="#exceptions">Deprecated Exceptions</a></dt>
+ </xsl:if>
+ <xsl:if test="gjdoc:rootdoc/gjdoc:hasDeprecatedErrors">
+ <dt><a href="#errors">Deprecated Errors</a></dt>
+ </xsl:if>
+ <xsl:if test="gjdoc:rootdoc/gjdoc:hasDeprecatedFields">
+ <dt><a href="#fields">Deprecated Fields</a></dt>
+ </xsl:if>
+ <xsl:if test="gjdoc:rootdoc/gjdoc:hasDeprecatedMethods">
+ <dt><a href="#methods">Deprecated Methods</a></dt>
+ </xsl:if>
+ <xsl:if test="gjdoc:rootdoc/gjdoc:hasDeprecatedConstructors">
+ <dt><a href="#constructors">Deprecated Constructors</a></dt>
+ </xsl:if>
+ </dl>
+ </xsl:when>
+ <xsl:otherwise>
+ <p>No parts of this API are deprecated.</p>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:if test="gjdoc:rootdoc/gjdoc:hasDeprecatedInterfaces">
+ <a name="interfaces"/>
+ <h1 class="classdoc-header">Deprecated Interfaces</h1>
+
+ <xsl:for-each select="gjdoc:rootdoc/gjdoc:classdoc/@qualifiedtypename">
+ <xsl:variable name="v_currentclass" select="."/>
+ <xsl:variable name="v_sub_xml_filename" select="concat(.,'.xml')"/>
+ <xsl:for-each select="document($v_sub_xml_filename,/gjdoc:rootdoc)//gjdoc:classdoc[@qualifiedtypename=$v_currentclass]/@qualifiedtypename/..">
+ <xsl:if test="gjdoc:isInterface">
+ <xsl:call-template name="output-deprecated-class"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:if>
+
+ <xsl:if test="gjdoc:rootdoc/gjdoc:hasDeprecatedClasses">
+ <a name="classes"/>
+ <h1 class="classdoc-header">Deprecated Classes</h1>
+
+ <xsl:for-each select="gjdoc:rootdoc/gjdoc:classdoc/@qualifiedtypename">
+ <xsl:variable name="v_currentclass" select="."/>
+ <xsl:variable name="v_sub_xml_filename" select="concat(.,'.xml')"/>
+ <xsl:for-each select="document($v_sub_xml_filename,/gjdoc:rootdoc)//gjdoc:classdoc[@qualifiedtypename=$v_currentclass]/@qualifiedtypename/..">
+ <xsl:if test="gjdoc:isOrdinaryClass">
+ <xsl:call-template name="output-deprecated-class"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:if>
+
+ <xsl:if test="gjdoc:rootdoc/gjdoc:hasDeprecatedExceptions">
+ <a name="exceptions"/>
+ <h1 class="classdoc-header">Deprecated Exceptions</h1>
+
+ <xsl:for-each select="gjdoc:rootdoc/gjdoc:classdoc/@qualifiedtypename">
+ <xsl:variable name="v_currentclass" select="."/>
+ <xsl:variable name="v_sub_xml_filename" select="concat(.,'.xml')"/>
+ <xsl:for-each select="document($v_sub_xml_filename,/gjdoc:rootdoc)//gjdoc:classdoc[@qualifiedtypename=$v_currentclass]/.">
+ <xsl:if test="gjdoc:isException">
+ <xsl:call-template name="output-deprecated-class"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:if>
+
+ <xsl:if test="gjdoc:rootdoc/gjdoc:hasDeprecatedErrors">
+ <a name="errors"/>
+ <h1 class="classdoc-header">Deprecated Errors</h1>
+
+ <xsl:for-each select="gjdoc:rootdoc/gjdoc:classdoc/@qualifiedtypename">
+ <xsl:variable name="v_currentclass" select="."/>
+ <xsl:variable name="v_sub_xml_filename" select="concat(.,'.xml')"/>
+ <xsl:for-each select="document($v_sub_xml_filename,/gjdoc:rootdoc)//gjdoc:classdoc[@qualifiedtypename=$v_currentclass]/.">
+ <xsl:if test="gjdoc:isError">
+ <xsl:call-template name="output-deprecated-class"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:if>
+
+ <xsl:if test="gjdoc:rootdoc/gjdoc:hasDeprecatedFields">
+ <a name="fields"/>
+ <h1 class="classdoc-header">Deprecated Fields</h1>
+
+ <xsl:for-each select="gjdoc:rootdoc/gjdoc:classdoc/@qualifiedtypename">
+ <xsl:variable name="v_currentclass" select="."/>
+ <xsl:variable name="v_sub_xml_filename" select="concat(.,'.xml')"/>
+ <xsl:for-each select="document($v_sub_xml_filename,/gjdoc:rootdoc)//gjdoc:classdoc[@qualifiedtypename=$v_currentclass]/gjdoc:fielddoc/@name">
+ <xsl:call-template name="output-deprecated-member"/>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:if>
+
+ <xsl:if test="gjdoc:rootdoc/gjdoc:hasDeprecatedMethods">
+ <a name="methods"/>
+ <h1 class="classdoc-header">Deprecated Methods</h1>
+
+ <xsl:for-each select="gjdoc:rootdoc/gjdoc:classdoc/@qualifiedtypename">
+ <xsl:variable name="v_currentclass" select="."/>
+ <xsl:variable name="v_sub_xml_filename" select="concat(.,'.xml')"/>
+ <xsl:for-each select="document($v_sub_xml_filename,/gjdoc:rootdoc)//gjdoc:classdoc[@qualifiedtypename=$v_currentclass]/gjdoc:methoddoc/@name">
+ <xsl:call-template name="output-deprecated-member"/>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:if>
+
+ <xsl:if test="gjdoc:rootdoc/gjdoc:hasDeprecatedConstructors">
+ <a name="constructors"/>
+ <h1 class="classdoc-header">Deprecated Constructors</h1>
+
+ <xsl:for-each select="gjdoc:rootdoc/gjdoc:classdoc/@qualifiedtypename">
+ <xsl:variable name="v_currentclass" select="."/>
+ <xsl:variable name="v_sub_xml_filename" select="concat(.,'.xml')"/>
+ <xsl:for-each select="document($v_sub_xml_filename,/gjdoc:rootdoc)//gjdoc:classdoc[@qualifiedtypename=$v_currentclass]/gjdoc:constructordoc/@name">
+ <xsl:call-template name="output-deprecated-member"/>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:if>
+ <!-- Bottom Navigation Bar -->
+ <xsl:call-template name="output_navbar">
+ <xsl:with-param name="p_show_frames" select="1"/>
+ <xsl:with-param name="p_show_noframes" select="1"/>
+ <xsl:with-param name="p_show_package" select="0"/>
+ <xsl:with-param name="p_show_package_tree" select="0"/>
+ <xsl:with-param name="p_show_full_tree" select="1"/>
+ <xsl:with-param name="p_show_index" select="1"/>
+ <xsl:with-param name="p_show_help" select="1"/>
+ <xsl:with-param name="p_show_deprecated" select="0"/>
+ <xsl:with-param name="p_curr_deprecated" select="1"/>
+ <xsl:with-param name="p_top" select="0"/>
+ </xsl:call-template>
+
+ </div>
+ </body>
+ </html>
+ </xsl:template>
+
+ <xsl:template name="output-deprecated-member">
+
+ <xsl:if test="../gjdoc:tags/gjdoc:tag[@kind='@deprecated']">
+ <dl>
+ <dt>
+ <a href="{concat($gjdoc.pathtoroot, translate(ancestor::gjdoc:classdoc/gjdoc:containingPackage/@name, '.', '/'), '/', ancestor::gjdoc:classdoc/@name, '.html#', ., ../gjdoc:signature/@full)}">
+ <xsl:value-of select="concat(ancestor::gjdoc:classdoc/@qualifiedtypename, '.', ., ../gjdoc:signature/@flat)"/>
+ </a>
+ </dt>
+ <dd>
+ <xsl:for-each select="../gjdoc:tags/gjdoc:tag[@kind='@deprecated']/gjdoc:firstSentenceTags/node()">
+ <xsl:apply-templates select="."/>
+ </xsl:for-each>
+ </dd>
+ </dl>
+ </xsl:if>
+
+ </xsl:template>
+
+ <xsl:template name="output-deprecated-class">
+ <xsl:if test="gjdoc:tags/gjdoc:tag[@kind='@deprecated']">
+ <dl>
+ <dt>
+ <a href="{concat($gjdoc.pathtoroot, translate(gjdoc:containingPackage/@name, '.', '/'), '/', @name, '.html')}"><xsl:value-of select="@qualifiedtypename"/></a>
+ </dt>
+ <dd>
+ <xsl:for-each select="gjdoc:tags/gjdoc:tag[@kind='@deprecated']/gjdoc:firstSentenceTags/node()">
+ <xsl:apply-templates select="."/>
+ </xsl:for-each>
+ </dd>
+ </dl>
+ </xsl:if>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/descriptor.xsl b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/descriptor.xsl
new file mode 100644
index 000000000..5cdb3325d
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/descriptor.xsl
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- descriptor.xsl
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+ -->
+
+<!-- Creates the index.html file for HTML documentation. This is only
+ a simple frameset.
+ -->
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:gjdoc="http://www.gnu.org/software/cp-tools/gjdocxml"
+ xmlns:html="http://www.w3.org/TR/REC-html40"
+ xmlns="http://www.w3.org/TR/REC-html40">
+
+ <xsl:include href="html_common.xsl"/>
+
+ <xsl:output method="xml"
+ encoding="utf-8"
+ indent="no"/>
+
+ <xsl:strip-space elements="*"/>
+
+ <xsl:template match="/">
+ <gjdoc:descriptor>
+ <gjdoc:about>
+ This file was generated by Gjdoc <xsl:value-of select="$gjdoc.xmldoclet.version"/>
+ on <xsl:value-of select="document('index.xml', /)/gjdoc:rootdoc/gjdoc:created"/>.
+
+ <xsl:copy-of select="document('index.xml', /)/gjdoc:rootdoc/gjdoc:bottomnote"/>
+ </gjdoc:about>
+ <xsl:for-each select="/gjdoc:rootdoc/gjdoc:packagedoc">
+ <gjdoc:package name="{@name}"/>
+ </xsl:for-each>
+ <xsl:for-each select="/gjdoc:rootdoc/gjdoc:classdoc">
+ <gjdoc:class name="{@name}" qualifiedtypename="{@qualifiedtypename}"/>
+ </xsl:for-each>
+ </gjdoc:descriptor>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/doctranslet.xsl b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/doctranslet.xsl
new file mode 100644
index 000000000..7008f73a3
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/doctranslet.xsl
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- outputfiles.xsl
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+ -->
+
+<!-- Returns a list of files generated by this stylesheet complex.
+ -->
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:gjdoc="http://www.gnu.org/software/cp-tools/gjdocxml"
+ xmlns:html="http://www.w3.org/TR/REC-html40"
+ xmlns="http://www.gnu.org/software/cp-tools/gjdocxslfiles">
+
+ <xsl:output method="xml"
+ encoding="utf-8"
+ indent="no"/>
+
+ <xsl:strip-space elements="*"/>
+
+ <xsl:template match="/">
+ <doctranslet>
+
+ <name>GNU Gjdoc HTML DocTranslet</name>
+
+ <version>0.6.1</version>
+
+ <outputtype>
+ <name>HTML</name>
+ </outputtype>
+
+ <outputfile>
+ <name><xsl:text>index.html</xsl:text></name>
+ <type><xsl:text>index</xsl:text></type>
+ <sheet><xsl:text>index.xsl</xsl:text></sheet>
+ <comment><xsl:text>HTML Index file</xsl:text></comment>
+ </outputfile>
+
+ <outputfile>
+ <name><xsl:text>index_noframes.html</xsl:text></name>
+ <type><xsl:text>index_noframes</xsl:text></type>
+ <sheet><xsl:text>index_noframes.xsl</xsl:text></sheet>
+ <comment><xsl:text>HTML Index file (No Frames)</xsl:text></comment>
+ </outputfile>
+
+ <outputfile>
+ <name><xsl:text>descriptor.xml</xsl:text></name>
+ <type><xsl:text>descriptor</xsl:text></type>
+ <sheet><xsl:text>descriptor.xsl</xsl:text></sheet>
+ <comment><xsl:text>HTML Descriptor file</xsl:text></comment>
+ </outputfile>
+
+ <outputfile>
+ <name><xsl:text>allclasses.html</xsl:text></name>
+ <type><xsl:text>allclasses</xsl:text></type>
+ <sheet><xsl:text>allclasses.xsl</xsl:text></sheet>
+ <comment><xsl:text>HTML All Classes file</xsl:text></comment>
+ </outputfile>
+
+ <outputfile>
+ <name><xsl:text>allpackages.html</xsl:text></name>
+ <type><xsl:text>allpackages</xsl:text></type>
+ <sheet><xsl:text>allpackages.xsl</xsl:text></sheet>
+ <comment><xsl:text>HTML All Packages file</xsl:text></comment>
+ </outputfile>
+
+ <outputfile>
+ <name><xsl:text>fulltree.html</xsl:text></name>
+ <type><xsl:text>fulltree</xsl:text></type>
+ <sheet><xsl:text>fulltree.xsl</xsl:text></sheet>
+ <comment><xsl:text>HTML Tree file</xsl:text></comment>
+ </outputfile>
+
+ <xsl:for-each select="gjdoc:rootdoc/gjdoc:packagedoc">
+ <outputfile>
+ <name><xsl:value-of select="concat(translate(@name,'.','/'),'/package-summary.html')"/></name>
+ <type><xsl:text>package</xsl:text></type>
+ <info><xsl:value-of select="@name"/></info>
+ <sheet><xsl:text>packagedoc.xsl</xsl:text></sheet>
+ <comment><xsl:text>HTML Documentation for package </xsl:text><xsl:value-of select="@name"/></comment>
+ </outputfile>
+ </xsl:for-each>
+
+ <xsl:for-each select="gjdoc:rootdoc/gjdoc:classdoc">
+ <outputfile>
+ <name><xsl:value-of select="concat(translate(gjdoc:containingPackage/@name,'.','/'),'/',@name,'.html')"/></name>
+ <type><xsl:text>class</xsl:text></type>
+ <info><xsl:value-of select="@qualifiedtypename"/></info>
+ <sheet><xsl:text>classdoc.xsl</xsl:text></sheet>
+ <comment><xsl:text>HTML Documentation for </xsl:text><xsl:value-of select="@qualifiedtypename"/></comment>
+ </outputfile>
+ </xsl:for-each>
+
+ </doctranslet>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/fulltree.xsl b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/fulltree.xsl
new file mode 100644
index 000000000..3d60bbba2
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/fulltree.xsl
@@ -0,0 +1,201 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- fulltree.xsl
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+ -->
+
+<!-- Creates the fulltree.html file for HTML documentation.
+ -->
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:gjdoc="http://www.gnu.org/software/cp-tools/gjdocxml"
+ xmlns:html="http://www.w3.org/TR/REC-html40"
+ xmlns="http://www.w3.org/TR/REC-html40">
+
+ <xsl:include href="html_common.xsl"/>
+
+ <xsl:output method="xml"
+ encoding="utf-8"
+ indent="no"/>
+
+ <xsl:strip-space elements="*"/>
+
+ <xsl:template name="output_tree_recursive">
+ <xsl:param name="p_level" select="0"/>
+
+ <xsl:value-of select="gjdoc:containingPackage/@name"/><xsl:text>.</xsl:text><a class="tree-class-link" href="{concat($gjdoc.pathtoroot,translate(gjdoc:containingPackage/@name,'.','/'),'/',@name,'.html')}"><xsl:value-of select="@name"/></a>
+ <xsl:if test="gjdoc:implements">
+ <xsl:text> (implements </xsl:text>
+ <xsl:for-each select="gjdoc:implements">
+ <xsl:sort select="@qualifiedtypename" order="ascending"/>
+ <xsl:choose>
+ <xsl:when test="string-length($gjdoc.outputfile.info)=0">
+ <xsl:call-template name="link_to_class_full">
+ <xsl:with-param name="p_name" select="@typename"/>
+ <xsl:with-param name="p_qualifiedname" select="@qualifiedtypename"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="gjdoc:containingPackage/@name=$gjdoc.outputfile.info">
+ <xsl:call-template name="link_to_class">
+ <xsl:with-param name="p_name" select="@typename"/>
+ <xsl:with-param name="p_qualifiedname" select="@qualifiedtypename"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="link_to_class_full">
+ <xsl:with-param name="p_name" select="@typename"/>
+ <xsl:with-param name="p_qualifiedname" select="@qualifiedtypename"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="position() != last()">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:text>)</xsl:text>
+ </xsl:if>
+
+ <xsl:variable name="v_qualifiedname">
+ <xsl:value-of select="@qualifiedtypename"/>
+ </xsl:variable>
+ <xsl:variable name="v_result">
+ <xsl:for-each select="/gjdoc:rootdoc/gjdoc:classdoc[gjdoc:superclass/@qualifiedtypename=$v_qualifiedname]">
+ <xsl:sort select="@qualifiedtypename" order="ascending"/>
+ <xsl:variable name="v_is_used">
+ <xsl:choose>
+ <xsl:when test="string-length($gjdoc.outputfile.info)=0">
+ <xsl:value-of select="true()"/>
+ </xsl:when>
+ <xsl:when test="gjdoc:containingPackage/@name=$gjdoc.outputfile.info">
+ <xsl:value-of select="true()"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="is_class_parent_of_package_class">
+ <xsl:with-param name="p_package" select="$gjdoc.outputfile.info"/>
+ <xsl:with-param name="p_qualifiedtypename" select="@qualifiedtypename"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="string-length($v_is_used)>0">
+ <li class="tree">
+ <xsl:call-template name="output_tree_recursive">
+ <xsl:with-param name="p_level"><xsl:value-of select="$p_level+1"/></xsl:with-param>
+ </xsl:call-template>
+ </li>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:if test="string-length($v_result)>0">
+ <ul><xsl:copy-of select="$v_result"/></ul>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="is_class_parent_of_package_class">
+ <xsl:param name="p_package"/>
+ <xsl:param name="p_qualifiedtypename"/>
+
+ <xsl:choose>
+
+ <xsl:when test="/gjdoc:rootdoc/gjdoc:classdoc[gjdoc:superclass/@qualifiedtypename=$p_qualifiedtypename and gjdoc:containingPackage/@name=$p_package]">
+ <xsl:value-of select="true()"/>
+ </xsl:when>
+
+ <xsl:otherwise>
+ <xsl:for-each select="/gjdoc:rootdoc/gjdoc:classdoc[gjdoc:superclass/@qualifiedtypename=$p_qualifiedtypename]">
+ <xsl:call-template name="is_class_parent_of_package_class">
+ <xsl:with-param name="p_package" select="$p_package"/>
+ <xsl:with-param name="p_qualifiedtypename" select="@qualifiedtypename"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="/">
+
+ <html>
+ <head>
+ <xsl:call-template name="output_title">
+ <xsl:with-param name="p_pagetitle" select="'Full Tree'"/>
+ </xsl:call-template>
+ <xsl:call-template name="include_common"/>
+ </head>
+ <body class="classdoc" onload="if(parent.contentPageLoaded)parent.contentPageLoaded(document.title)">
+ <div class="pagebody">
+
+ <!-- Top Navigation Bar -->
+ <xsl:call-template name="output_navbar">
+ <xsl:with-param name="p_show_frames" select="1"/>
+ <xsl:with-param name="p_show_noframes" select="1"/>
+ <xsl:with-param name="p_show_package" select="string-length($gjdoc.outputfile.info)&gt;0"/>
+ <xsl:with-param name="p_show_package_tree" select="0"/>
+ <xsl:with-param name="p_curr_package_tree" select="string-length($gjdoc.outputfile.info)&gt;0"/>
+ <xsl:with-param name="p_show_full_tree" select="string-length($gjdoc.outputfile.info)&gt;0"/>
+ <xsl:with-param name="p_curr_full_tree" select="string-length($gjdoc.outputfile.info)&lt;=0"/>
+ <xsl:with-param name="p_show_index" select="1"/>
+ <xsl:with-param name="p_show_help" select="1"/>
+ <xsl:with-param name="p_top" select="1"/>
+ </xsl:call-template>
+
+ <h1 class="classdoc-title">
+ <xsl:choose>
+ <xsl:when test="string-length($gjdoc.outputfile.info)=0">
+ Full Class Tree
+ <xsl:if test="/gjdoc:rootdoc/gjdoc:title">
+ <xsl:text> for </xsl:text>
+ <xsl:value-of select="/gjdoc:rootdoc/gjdoc:title"/>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ Class Hierarchy for Package <xsl:value-of select="$gjdoc.outputfile.info"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </h1>
+
+ <xsl:for-each select="/gjdoc:rootdoc/gjdoc:classdoc[@qualifiedtypename='java.lang.Object']">
+ <ul class="tree">
+ <li class="tree">
+ <xsl:call-template name="output_tree_recursive"/>
+ </li>
+ </ul>
+ </xsl:for-each>
+
+
+ <!-- Bottom Navigation Bar -->
+ <xsl:call-template name="output_navbar">
+ <xsl:with-param name="p_show_frames" select="1"/>
+ <xsl:with-param name="p_show_noframes" select="1"/>
+ <xsl:with-param name="p_show_package" select="string-length($gjdoc.outputfile.info)&lt;=0"/>
+ <xsl:with-param name="p_show_package_tree" select="0"/>
+ <xsl:with-param name="p_curr_package_tree" select="string-length($gjdoc.outputfile.info)&gt;0"/>
+ <xsl:with-param name="p_show_full_tree" select="string-length($gjdoc.outputfile.info)&gt;0"/>
+ <xsl:with-param name="p_curr_full_tree" select="string-length($gjdoc.outputfile.info)&lt;=0"/>
+ <xsl:with-param name="p_show_index" select="1"/>
+ <xsl:with-param name="p_show_help" select="1"/>
+ <xsl:with-param name="p_top" select="0"/>
+ </xsl:call-template>
+ </div>
+ </body>
+ </html>
+
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/gjdoc.xsl b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/gjdoc.xsl
new file mode 100644
index 000000000..74558abf4
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/gjdoc.xsl
@@ -0,0 +1,240 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- outputfiles.xsl
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+ -->
+
+<!-- Returns a list of files generated by this stylesheet complex.
+ -->
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:gjdoc="http://www.gnu.org/software/cp-tools/gjdocxml"
+ xmlns:html="http://www.w3.org/TR/REC-html40"
+ xmlns="http://www.gnu.org/software/cp-tools/gjdocxslfiles">
+
+ <xsl:include href="../gjdoc_common.xsl"/>
+
+ <xsl:output method="xml"
+ encoding="utf-8"
+ indent="no"/>
+
+ <xsl:strip-space elements="*"/>
+
+ <xsl:template match="/">
+ <gjdocoutput>
+
+ <comment><xsl:text>GNU Gjdoc HTML Documentation</xsl:text></comment>
+
+ <outputfile>
+ <name><xsl:text>index.html</xsl:text></name>
+ <sheet><xsl:text>index.xsl</xsl:text></sheet>
+ <comment><xsl:text>HTML Index file</xsl:text></comment>
+ </outputfile>
+
+ <outputfile>
+ <name><xsl:text>index_noframes.html</xsl:text></name>
+ <sheet><xsl:text>index_noframes.xsl</xsl:text></sheet>
+ <comment><xsl:text>HTML Index file (No Frames)</xsl:text></comment>
+ </outputfile>
+
+ <outputfile>
+ <name><xsl:text>descriptor.xml</xsl:text></name>
+ <sheet><xsl:text>descriptor.xsl</xsl:text></sheet>
+ <comment><xsl:text>HTML Descriptor file</xsl:text></comment>
+ </outputfile>
+
+ <outputfile>
+ <name><xsl:text>allclasses.html</xsl:text></name>
+ <sheet><xsl:text>allclasses.xsl</xsl:text></sheet>
+ <comment><xsl:text>HTML All Classes file</xsl:text></comment>
+ </outputfile>
+
+ <xsl:if test="count(gjdoc:rootdoc/gjdoc:packagedoc) > 1">
+ <outputfile>
+ <name><xsl:text>allpackages.html</xsl:text></name>
+ <sheet><xsl:text>allpackages.xsl</xsl:text></sheet>
+ <comment><xsl:text>HTML All Packages file</xsl:text></comment>
+ </outputfile>
+ </xsl:if>
+
+ <xsl:if test="not($gjdoc.option.notree)">
+ <outputfile>
+ <name><xsl:text>fulltree.html</xsl:text></name>
+ <sheet><xsl:text>fulltree.xsl</xsl:text></sheet>
+ <comment><xsl:text>HTML Tree file</xsl:text></comment>
+ </outputfile>
+ </xsl:if>
+
+ <xsl:if test="not($gjdoc.option.noindex)">
+ <xsl:choose>
+ <xsl:when test="$gjdoc.option.splitindex">
+
+ <outputfile>
+ <name><xsl:text>alphaindex.html</xsl:text></name>
+ <info/>
+ <sheet><xsl:text>alphaindex_chunked.xsl</xsl:text></sheet>
+ <comment><xsl:text>HTML Alphabetical Index (Overview)</xsl:text></comment>
+ </outputfile>
+
+ <xsl:for-each select="document('alphaindex.xml',/)/gjdoc:alphaindex/gjdoc:category">
+ <outputfile>
+ <name><xsl:value-of select="concat('alphaindex_', @letter, '.html')"/></name>
+ <info><xsl:value-of select="@letter"/></info>
+ <sheet><xsl:text>alphaindex_chunked.xsl</xsl:text></sheet>
+ <comment><xsl:value-of select="concat('HTML Alphabetical Index (Letter ', @letter, ')')"/></comment>
+ </outputfile>
+ </xsl:for-each>
+
+ </xsl:when>
+ <xsl:otherwise>
+ <outputfile>
+ <name><xsl:text>alphaindex.html</xsl:text></name>
+ <sheet><xsl:text>alphaindex.xsl</xsl:text></sheet>
+ <comment><xsl:text>HTML Alphabetical Index</xsl:text></comment>
+ </outputfile>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+
+ <xsl:for-each select="gjdoc:rootdoc/gjdoc:packagedoc">
+ <outputfile>
+ <name><xsl:value-of select="concat(translate(@name,'.','/'),'/package-summary.html')"/></name>
+ <info><xsl:value-of select="@name"/></info>
+ <sheet><xsl:text>packagedoc.xsl</xsl:text></sheet>
+ <comment><xsl:text>HTML Documentation for package </xsl:text><xsl:value-of select="@name"/></comment>
+ </outputfile>
+ <outputfile>
+ <name><xsl:value-of select="concat(translate(@name,'.','/'),'/classes.html')"/></name>
+ <info><xsl:value-of select="@name"/></info>
+ <sheet><xsl:text>packageclasses.xsl</xsl:text></sheet>
+ <comment><xsl:text>HTML Class list for package </xsl:text><xsl:value-of select="@name"/></comment>
+ </outputfile>
+
+ <xsl:if test="not($gjdoc.option.notree)">
+ <outputfile>
+ <name><xsl:value-of select="concat(translate(@name,'.','/'),'/package-tree.html')"/></name>
+ <info><xsl:value-of select="@name"/></info>
+ <sheet><xsl:text>fulltree.xsl</xsl:text></sheet>
+ <comment><xsl:text>HTML Hierarchy for package </xsl:text><xsl:value-of select="@name"/></comment>
+ </outputfile>
+ </xsl:if>
+ </xsl:for-each>
+
+ <xsl:for-each select="gjdoc:rootdoc/gjdoc:classdoc">
+ <xsl:sort select="@qualifiedtypename" order="ascending"/>
+ <outputfile>
+ <name><xsl:value-of select="concat(translate(gjdoc:containingPackage/@name,'.','/'),'/',@name,'.html')"/></name>
+ <info><xsl:value-of select="@qualifiedtypename"/></info>
+ <sheet><xsl:text>classdoc.xsl</xsl:text></sheet>
+ <comment><xsl:text>HTML Documentation for </xsl:text><xsl:value-of select="@qualifiedtypename"/></comment>
+ </outputfile>
+
+ <xsl:if test="$gjdoc.option.linksource">
+ <outputfile>
+ <name><xsl:text>src-html/</xsl:text><xsl:value-of select="concat(translate(gjdoc:containingPackage/@name,'.','/'),'/',@name,'.html')"/></name>
+ <info><xsl:value-of select="@qualifiedtypename"/></info>
+ <sheet><xsl:text>classdoc-source.xsl</xsl:text></sheet>
+ <comment><xsl:text>HTML Source for </xsl:text><xsl:value-of select="@qualifiedtypename"/></comment>
+ </outputfile>
+ </xsl:if>
+
+ <xsl:if test="$gjdoc.option.uses">
+ <outputfile>
+ <name><xsl:text>class-use/</xsl:text><xsl:value-of select="concat(translate(gjdoc:containingPackage/@name,'.','/'),'/',@name,'.html')"/></name>
+ <info><xsl:value-of select="@qualifiedtypename"/></info>
+ <sheet><xsl:text>classdoc-uses.xsl</xsl:text></sheet>
+ <comment><xsl:text>usage information for </xsl:text><xsl:value-of select="@qualifiedtypename"/></comment>
+ </outputfile>
+ </xsl:if>
+
+ </xsl:for-each>
+
+ <xsl:choose>
+ <xsl:when test="$gjdoc.option.stylesheetfile">
+ <outputfile>
+ <name><xsl:text>user.css</xsl:text></name>
+ <source><xsl:value-of select="$gjdoc.option.stylesheetfile"/></source>
+ <comment><xsl:text>user-supplied CSS stylesheet</xsl:text></comment>
+ </outputfile>
+ </xsl:when>
+ <xsl:otherwise>
+ <outputfile>
+ <name><xsl:text>gjdochtml.css</xsl:text></name>
+ <source><xsl:text>res/gjdochtml.css</xsl:text></source>
+ <comment><xsl:text>CSS base stylesheet</xsl:text></comment>
+ </outputfile>
+ <outputfile>
+ <name><xsl:text>gjdochtml-clean.css</xsl:text></name>
+ <source><xsl:text>res/gjdochtml-clean.css</xsl:text></source>
+ <comment><xsl:text>CSS stylesheet 'Clean'</xsl:text></comment>
+ </outputfile>
+ <outputfile>
+ <name><xsl:text>gjdochtml-sclara.css</xsl:text></name>
+ <source><xsl:text>res/gjdochtml-sclara.css</xsl:text></source>
+ <comment><xsl:text>CSS stylesheet 'Santa Clara'</xsl:text></comment>
+ </outputfile>
+ <outputfile>
+ <name><xsl:text>gjdochtml-fixed.css</xsl:text></name>
+ <source><xsl:text>res/gjdochtml-fixed.css</xsl:text></source>
+ <comment><xsl:text>CSS stylesheet 'Fixed'</xsl:text></comment>
+ </outputfile>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <outputfile>
+ <name><xsl:text>gjdoc.js</xsl:text></name>
+ <source><xsl:text>res/gjdoc.js</xsl:text></source>
+ <comment><xsl:text>JavaScript helper file</xsl:text></comment>
+ </outputfile>
+
+ <xsl:if test="not($gjdoc.option.nohelp)">
+ <outputfile>
+ <name><xsl:text>help.html</xsl:text></name>
+ <sheet><xsl:text>help.xsl</xsl:text></sheet>
+ <comment><xsl:text>help file</xsl:text></comment>
+ </outputfile>
+ </xsl:if>
+
+ <outputfile>
+ <name><xsl:text>about.html</xsl:text></name>
+ <sheet><xsl:text>about.xsl</xsl:text></sheet>
+ <comment><xsl:text>about file</xsl:text></comment>
+ </outputfile>
+
+ <xsl:if test="not($gjdoc.option.nodeprecatedlist)">
+ <outputfile>
+ <name><xsl:text>deprecated.html</xsl:text></name>
+ <sheet><xsl:text>deprecated.xsl</xsl:text></sheet>
+ <comment><xsl:text>deprecated list</xsl:text></comment>
+ </outputfile>
+ </xsl:if>
+
+ <outputfile>
+ <name><xsl:text>serialized.html</xsl:text></name>
+ <sheet><xsl:text>serialized.xsl</xsl:text></sheet>
+ <comment><xsl:text>serialization information</xsl:text></comment>
+ </outputfile>
+
+ </gjdocoutput>
+ </xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/help.xsl b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/help.xsl
new file mode 100644
index 000000000..45af6a644
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/help.xsl
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- help.xsl
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+ -->
+
+<!-- Creates the class descriptor files for HTML documentation.
+ -->
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:gjdoc="http://www.gnu.org/software/cp-tools/gjdocxml"
+ xmlns:html="http://www.w3.org/TR/REC-html40"
+ xmlns="http://www.w3.org/TR/REC-html40">
+
+ <xsl:include href="html_common.xsl"/>
+
+ <xsl:output method="html"
+ encoding="utf-8"
+ doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
+ doctype-system="http://www.w3.org/TR/html4/loose.dtd"
+ indent="no"/>
+
+ <xsl:strip-space elements="*"/>
+
+ <xsl:template match="/">
+ <html>
+ <head>
+ <xsl:call-template name="output_title">
+ <xsl:with-param name="p_pagetitle" select="'Help'"/>
+ </xsl:call-template>
+ <xsl:call-template name="include_common"/>
+ </head>
+ <body class="classdoc" onload="if(parent.contentPageLoaded)parent.contentPageLoaded(document.title)">
+ <!-- Top Navigation Bar -->
+ <xsl:call-template name="output_navbar">
+ <xsl:with-param name="p_show_frames" select="1"/>
+ <xsl:with-param name="p_show_noframes" select="1"/>
+ <xsl:with-param name="p_show_package" select="0"/>
+ <xsl:with-param name="p_show_package_tree" select="0"/>
+ <xsl:with-param name="p_show_full_tree" select="1"/>
+ <xsl:with-param name="p_show_index" select="1"/>
+ <xsl:with-param name="p_show_help" select="0"/>
+ <xsl:with-param name="p_curr_help" select="1"/>
+ <xsl:with-param name="p_top" select="1"/>
+ </xsl:call-template>
+
+ <div class="pagebody">
+
+ <xsl:choose>
+ <xsl:when test="$gjdoc.option.helpfile">
+ <xsl:copy-of select="document($gjdoc.option.helpfile)//body"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:copy-of select="document('res/default_help_en.html')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <!-- Bottom Navigation Bar -->
+ <xsl:call-template name="output_navbar">
+ <xsl:with-param name="p_show_frames" select="1"/>
+ <xsl:with-param name="p_show_noframes" select="1"/>
+ <xsl:with-param name="p_show_package" select="0"/>
+ <xsl:with-param name="p_show_package_tree" select="0"/>
+ <xsl:with-param name="p_show_full_tree" select="1"/>
+ <xsl:with-param name="p_show_index" select="1"/>
+ <xsl:with-param name="p_show_help" select="0"/>
+ <xsl:with-param name="p_curr_help" select="1"/>
+ <xsl:with-param name="p_top" select="0"/>
+ </xsl:call-template>
+ </div>
+ </body>
+ </html>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/html_common.xsl b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/html_common.xsl
new file mode 100644
index 000000000..4e648d272
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/html_common.xsl
@@ -0,0 +1,584 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- html_common.xsl
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+ -->
+
+<!-- Common templates for HTML generation.
+ -->
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:gjdoc="http://www.gnu.org/software/cp-tools/gjdocxml"
+ xmlns:html="http://www.w3.org/TR/REC-html40"
+ xmlns="http://www.w3.org/TR/REC-html40">
+
+ <xsl:include href="../gjdoc_common.xsl"/>
+
+ <!-- HTML head directives to be included in all generated HTML files. -->
+
+ <xsl:template name="include_common">
+ <script src="{concat($gjdoc.pathtoroot, 'gjdoc.js')}" type="text/javascript"><xsl:comment>this comment required for konqueror 3.2.2</xsl:comment>
+ </script>
+ <xsl:choose>
+ <xsl:when test="$gjdoc.option.stylesheetfile">
+ <link rel="stylesheet" type="text/css"
+ href="{concat($gjdoc.pathtoroot, 'user.css')}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <link rel="stylesheet" type="text/css"
+ href="{concat($gjdoc.pathtoroot, 'gjdochtml.css')}" title="GNU Clean"/>
+ <link rel="stylesheet" type="text/css"
+ href="{concat($gjdoc.pathtoroot, 'gjdochtml-clean.css')}" title="GNU Clean"/>
+ <link rel="alternate stylesheet" type="text/css"
+ href="{concat($gjdoc.pathtoroot, 'gjdochtml.css')}" title="Santa Clara"/>
+ <link rel="alternate stylesheet" type="text/css"
+ href="{concat($gjdoc.pathtoroot, 'gjdochtml-sclara.css')}" title="Santa Clara"/>
+ <link rel="alternate stylesheet" type="text/css"
+ href="{concat($gjdoc.pathtoroot, 'gjdochtml.css')}" title="Fixed Fruit"/>
+ <link rel="alternate stylesheet" type="text/css"
+ href="{concat($gjdoc.pathtoroot, 'gjdochtml-fixed.css')}" title="Fixed Fruit"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="output_copyright_footer">
+ <xsl:copy-of select="document('index.xml', /)/gjdoc:rootdoc/gjdoc:bottomnote"/>
+ <hr class="footer"/>
+ <div class="footer">
+ <xsl:text>Generated on</xsl:text><xsl:value-of select="document('index.xml', /)/gjdoc:rootdoc/gjdoc:created"/><xsl:text> by </xsl:text><a href="http://www.gnu.org/software/cp-tools" target="cptoolsinfo"><xsl:text>GNU Classpath Tools</xsl:text></a><xsl:text> (Gjdoc XmlDoclet </xsl:text><xsl:value-of select="$gjdoc.xmldoclet.version"/><xsl:text>).</xsl:text>
+ </div>
+ </xsl:template>
+
+ <!-- If the given class is also included, create a link to it. -->
+ <!-- Otherwise output the qualified name in plain text. -->
+
+ <xsl:template name="link_to_class_full">
+ <xsl:param name="p_qualifiedname" select="@qualifiedtypename"/>
+ <xsl:variable name="p_classdoc" select="document('index.xml', /)/gjdoc:rootdoc/gjdoc:classdoc[attribute::qualifiedtypename=$p_qualifiedname]"/>
+ <xsl:choose>
+ <xsl:when test="$p_classdoc">
+ <a href="{concat($gjdoc.pathtoroot, translate($p_classdoc/gjdoc:containingPackage/@name, '.', '/'), '/', $p_classdoc/@name, '.html')}">
+ <xsl:value-of select="$p_qualifiedname"/>
+ </a>
+ </xsl:when>
+ <xsl:when test="$gjdoc.refdocs1 and document(concat($gjdoc.refdocs1, '/descriptor.xml'), /)//gjdoc:class[attribute::qualifiedtypename=$p_qualifiedname]">
+ <a href="{concat($gjdoc.refdocs1, '/', $p_qualifiedname, '.html')}">
+ <xsl:value-of select="$p_qualifiedname"/>
+ </a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$p_qualifiedname"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- If the given class is also included, create a link to it. -->
+ <!-- Otherwise output the qualified name in plain text. -->
+
+ <xsl:template name="link_to_class">
+ <xsl:param name="p_qualifiedname" select="@qualifiedtypename"/>
+ <xsl:param name="p_name" select="@name"/>
+ <xsl:variable name="p_classdoc" select="document('index.xml', /)/gjdoc:rootdoc/gjdoc:classdoc[attribute::qualifiedtypename=$p_qualifiedname]"/>
+ <xsl:choose>
+ <xsl:when test="$p_classdoc">
+ <a href="{concat($gjdoc.pathtoroot, translate($p_classdoc/gjdoc:containingPackage/@name, '.', '/'), '/', $p_classdoc/@name, '.html')}"><xsl:value-of select="$p_name"/></a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$p_qualifiedname"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="output_alphaindex_category">
+ <dl>
+ <xsl:for-each select="gjdoc:entry">
+ <dt>
+ <xsl:element name="a">
+ <xsl:attribute name="href">
+ <xsl:choose>
+ <xsl:when test="gjdoc:isPackage">
+ <xsl:value-of select="concat(translate(@name, '.', '/'), '/package-summary.html')"/>
+ </xsl:when>
+ <xsl:when test="gjdoc:isClass and gjdoc:containingClass">
+ <xsl:value-of select="concat(translate(gjdoc:containingPackage/@name, '.', '/'), '/', gjdoc:containingClass/@name, '.', @name, '.html')"/>
+ </xsl:when>
+ <xsl:when test="gjdoc:isClass">
+ <xsl:value-of select="concat(translate(gjdoc:containingPackage/@name, '.', '/'), '/', @name, '.html')"/>
+ </xsl:when>
+ <xsl:when test="gjdoc:isMethod">
+ <xsl:value-of select="concat(translate(gjdoc:containingPackage/@name, '.', '/'), '/', gjdoc:containingClass/@name, '.html#', gjdoc:method/@name, gjdoc:signature/@full)"/>
+ </xsl:when>
+ <xsl:when test="gjdoc:isField">
+ <xsl:value-of select="concat(translate(gjdoc:containingPackage/@name, '.', '/'), '/', gjdoc:containingClass/@name, '.html#', @name)"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:value-of select="@name"/>
+ </xsl:element>
+ -
+ <xsl:choose>
+ <xsl:when test="gjdoc:isPackage">
+ Package
+ </xsl:when>
+ <xsl:when test="gjdoc:isOrdinaryClass and gjdoc:containingClass">
+ Nested class in class
+ <xsl:value-of select="gjdoc:containingClass/@name"/>
+ </xsl:when>
+ <xsl:when test="gjdoc:isException and gjdoc:containingClass">
+ Nested exception in class
+ <xsl:value-of select="gjdoc:containingClass/@name"/>
+ </xsl:when>
+ <xsl:when test="gjdoc:isError and gjdoc:containingClass">
+ Nested error in class
+ <xsl:value-of select="gjdoc:containingClass/@name"/>
+ </xsl:when>
+ <xsl:when test="gjdoc:isInterface and gjdoc:containingClass">
+ Nested interface in class
+ <xsl:value-of select="gjdoc:containingClass/@name"/>
+ </xsl:when>
+ <xsl:when test="gjdoc:isOrdinaryClass">
+ Class in package
+ <xsl:value-of select="gjdoc:containingPackage/@name"/>
+ </xsl:when>
+ <xsl:when test="gjdoc:isException">
+ Exception in package
+ <xsl:value-of select="gjdoc:containingPackage/@name"/>
+ </xsl:when>
+ <xsl:when test="gjdoc:isError">
+ Error in package
+ <xsl:value-of select="gjdoc:containingPackage/@name"/>
+ </xsl:when>
+ <xsl:when test="gjdoc:isInterface">
+ Interface in package
+ <xsl:value-of select="gjdoc:containingPackage/@name"/>
+ </xsl:when>
+ <xsl:when test="gjdoc:isMethod">
+ Method in class
+ <xsl:value-of select="gjdoc:containingClass/@name"/>
+ </xsl:when>
+ <xsl:when test="gjdoc:isField">
+ Field in class
+ <xsl:value-of select="gjdoc:containingClass/@name"/>
+ </xsl:when>
+ </xsl:choose>
+ </dt>
+ <dd>
+ <xsl:for-each select="gjdoc:firstSentenceTags/node()">
+ <xsl:copy-of select="."/>
+ </xsl:for-each>
+ </dd>
+ </xsl:for-each>
+ </dl>
+
+ </xsl:template>
+
+ <xsl:template name="output_navlink">
+ <xsl:param name="p_href"/>
+ <xsl:param name="p_label"/>
+ <xsl:param name="p_target" select="'_self'"/>
+ <xsl:param name="p_enabled"/>
+ <xsl:param name="p_current"/>
+ <xsl:param name="p_onclick"/>
+ <xsl:param name="p_last" select="0"/>
+ <xsl:param name="p_css_class"/>
+ <xsl:param name="p_title"/>
+
+ <xsl:choose>
+ <xsl:when test="$p_enabled">
+ <span class="navi-button link"><a href="{$p_href}" target="{$p_target}" class="navi-button" title="{$p_title}" onClick="{$p_onclick}"><span class="{concat('navi-link ', $p_css_class)}"><xsl:value-of select="$p_label" disable-output-escaping="yes"/></span></a></span>
+ </xsl:when>
+ <xsl:when test="$p_current">
+ <span class="navi-button current"><xsl:value-of select="$p_label" disable-output-escaping="yes"/></span>
+ </xsl:when>
+ <xsl:otherwise>
+ <span class="navi-button unavailable"><xsl:value-of select="$p_label" disable-output-escaping="yes"/></span>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="not($p_last)"><span class="navsep"><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></span></xsl:if>
+ </xsl:template>
+
+ <xsl:template name="output_navbar">
+ <xsl:param name="p_show_frames" select="1"/>
+ <xsl:param name="p_curr_frames"/>
+
+ <xsl:param name="p_show_noframes" select="1"/>
+ <xsl:param name="p_curr_noframes"/>
+
+ <xsl:param name="p_show_package" select="1"/>
+ <xsl:param name="p_curr_package"/>
+
+ <xsl:param name="p_show_package_tree" select="1"/>
+ <xsl:param name="p_curr_package_tree"/>
+
+ <xsl:param name="p_show_full_tree" select="1"/>
+ <xsl:param name="p_curr_full_tree"/>
+
+ <xsl:param name="p_show_index" select="1"/>
+ <xsl:param name="p_curr_index"/>
+
+ <xsl:param name="p_show_help" select="1"/>
+ <xsl:param name="p_curr_help"/>
+
+ <xsl:param name="p_show_about" select="1"/>
+ <xsl:param name="p_curr_about"/>
+
+ <xsl:param name="p_show_source" select="1"/>
+ <xsl:param name="p_curr_source"/>
+
+ <xsl:param name="p_show_class"/>
+ <xsl:param name="p_curr_class"/>
+
+ <xsl:param name="p_show_use"/>
+ <xsl:param name="p_curr_use"/>
+
+ <xsl:param name="p_show_deprecated" select="1"/>
+ <xsl:param name="p_curr_deprecated"/>
+
+ <xsl:param name="p_top"/>
+
+ <xsl:variable name="v_navbar_class">
+ <xsl:choose>
+ <xsl:when test="$p_top">
+ <xsl:value-of select="'navbar top'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'navbar bottom'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:if test="not($gjdoc.option.nonavbar)">
+ <div class="{$v_navbar_class}">
+ <table border="1" cellspacing="0" class="{$v_navbar_class}">
+ <tr class="{$v_navbar_class}">
+ <td class="{$v_navbar_class}">
+ <div class="navbar-first-row">
+ <xsl:call-template name="output_navlink">
+ <xsl:with-param name="p_href" select="concat($gjdoc.pathtoroot, 'index_noframes.html')"/>
+ <xsl:with-param name="p_label" select="'Overview'"/>
+ <xsl:with-param name="p_enabled" select="$p_show_noframes"/>
+ <xsl:with-param name="p_current" select="$p_curr_noframes"/>
+ </xsl:call-template>
+ <xsl:call-template name="output_navlink">
+ <xsl:with-param name="p_href" select="'package-summary.html'"/>
+ <xsl:with-param name="p_label" select="'Package'"/>
+ <xsl:with-param name="p_enabled" select="$p_show_package"/>
+ <xsl:with-param name="p_current" select="$p_curr_package"/>
+ </xsl:call-template>
+ <xsl:call-template name="output_navlink">
+ <xsl:with-param name="p_href" select="$p_show_class"/>
+ <xsl:with-param name="p_label" select="'Class'"/>
+ <xsl:with-param name="p_enabled" select="$p_show_class"/>
+ <xsl:with-param name="p_current" select="$p_curr_class"/>
+ </xsl:call-template>
+ <xsl:if test="$gjdoc.option.linksource">
+ <xsl:call-template name="output_navlink">
+ <xsl:with-param name="p_href" select="$p_show_source"/>
+ <xsl:with-param name="p_label" select="'Source'"/>
+ <xsl:with-param name="p_enabled" select="$p_show_source"/>
+ <xsl:with-param name="p_current" select="$p_curr_source"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$gjdoc.option.uses">
+ <xsl:call-template name="output_navlink">
+ <xsl:with-param name="p_href" select="$p_show_use"/>
+ <xsl:with-param name="p_label" select="'Use'"/>
+ <xsl:with-param name="p_enabled" select="$p_show_use"/>
+ <xsl:with-param name="p_current" select="$p_curr_use"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:call-template name="output_navlink">
+ <xsl:with-param name="p_href" select="'package-tree.html'"/>
+ <xsl:with-param name="p_label" select="'Tree'"/>
+ <xsl:with-param name="p_enabled" select="$p_show_package_tree"/>
+ <xsl:with-param name="p_current" select="$p_curr_package_tree"/>
+ </xsl:call-template>
+ <xsl:if test="not($gjdoc.option.noindex)">
+ <xsl:call-template name="output_navlink">
+ <xsl:with-param name="p_href" select="concat($gjdoc.pathtoroot, 'alphaindex.html')"/>
+ <xsl:with-param name="p_label" select="'Index'"/>
+ <xsl:with-param name="p_enabled" select="$p_show_index"/>
+ <xsl:with-param name="p_current" select="$p_curr_index"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="not($gjdoc.option.notree)">
+ <xsl:call-template name="output_navlink">
+ <xsl:with-param name="p_href" select="concat($gjdoc.pathtoroot, 'fulltree.html')"/>
+ <xsl:with-param name="p_label" select="'Full&amp;nbsp;Tree'"/>
+ <xsl:with-param name="p_enabled" select="$p_show_full_tree"/>
+ <xsl:with-param name="p_current" select="$p_curr_full_tree"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="not($gjdoc.option.nodeprecatedlist)">
+ <xsl:call-template name="output_navlink">
+ <xsl:with-param name="p_href" select="concat($gjdoc.pathtoroot, 'deprecated.html')"/>
+ <xsl:with-param name="p_label" select="'Deprecated'"/>
+ <xsl:with-param name="p_enabled" select="$p_show_deprecated"/>
+ <xsl:with-param name="p_current" select="$p_curr_deprecated"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="not($gjdoc.option.nohelp)">
+ <xsl:call-template name="output_navlink">
+ <xsl:with-param name="p_href" select="concat($gjdoc.pathtoroot, 'help.html')"/>
+ <xsl:with-param name="p_label" select="'Help'"/>
+ <xsl:with-param name="p_enabled" select="$p_show_help"/>
+ <xsl:with-param name="p_current" select="$p_curr_help"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:call-template name="output_navlink">
+ <xsl:with-param name="p_href" select="concat($gjdoc.pathtoroot, 'about.html')"/>
+ <xsl:with-param name="p_label" select="'About'"/>
+ <xsl:with-param name="p_enabled" select="$p_show_about"/>
+ <xsl:with-param name="p_current" select="$p_curr_about"/>
+ <xsl:with-param name="p_last" select="1"/>
+ </xsl:call-template>
+ </div>
+ <div class="navbar-second-row">
+ <xsl:call-template name="output_navlink">
+ <xsl:with-param name="p_href" select="concat($gjdoc.pathtoroot, 'index.html')"/>
+ <xsl:with-param name="p_label" select="'Frames'"/>
+ <xsl:with-param name="p_enabled" select="1"/>
+ <xsl:with-param name="p_target" select="'_top'"/>
+ </xsl:call-template>
+ <xsl:call-template name="output_navlink">
+ <xsl:with-param name="p_href" select="concat($gjdoc.pathtoroot, 'index_noframes.html')"/>
+ <xsl:with-param name="p_label" select="'No&amp;nbsp;Frames'"/>
+ <xsl:with-param name="p_enabled" select="1"/>
+ <xsl:with-param name="p_target" select="'_top'"/>
+ <xsl:with-param name="p_last" select="0"/>
+ </xsl:call-template>
+ <xsl:call-template name="output_navlink">
+ <xsl:with-param name="p_onclick" select="'return setStyleSheet(&quot;GNU Clean&quot;);'"/>
+ <xsl:with-param name="p_title" select="'GNU Clean Style'"/>
+ <xsl:with-param name="p_label" select="'GNU Clean'"/>
+ <xsl:with-param name="p_enabled" select="1"/>
+ <xsl:with-param name="p_last" select="0"/>
+ </xsl:call-template>
+ <xsl:call-template name="output_navlink">
+ <xsl:with-param name="p_onclick" select="'return setStyleSheet(&quot;Santa Clara&quot;);'"/>
+ <xsl:with-param name="p_title" select="'Santa Clara Style'"/>
+ <xsl:with-param name="p_label" select="'Santa Clara'"/>
+ <xsl:with-param name="p_enabled" select="1"/>
+ <xsl:with-param name="p_last" select="0"/>
+ </xsl:call-template>
+ <xsl:call-template name="output_navlink">
+ <xsl:with-param name="p_onclick" select="'return setStyleSheet(&quot;Fixed Fruit&quot;);'"/>
+ <xsl:with-param name="p_title" select="'Fixed Fruit Style'"/>
+ <xsl:with-param name="p_label" select="'Fixed Fruit'"/>
+ <xsl:with-param name="p_enabled" select="1"/>
+ <xsl:with-param name="p_last" select="0"/>
+ </xsl:call-template>
+ <xsl:call-template name="output_navlink">
+ <xsl:with-param name="p_onclick" select="'return setStyleSheet(&quot;Vanilla&quot;);'"/>
+ <xsl:with-param name="p_title" select="'Vanilla Style'"/>
+ <xsl:with-param name="p_label" select="'Vanilla'"/>
+ <xsl:with-param name="p_enabled" select="1"/>
+ <xsl:with-param name="p_last" select="0"/>
+ </xsl:call-template>
+
+ </div>
+ </td>
+ <xsl:choose>
+ <xsl:when test="$p_top">
+ <xsl:if test="$gjdoc.option.header">
+ <td class="{$v_navbar_class} navbar-header">
+ <xsl:value-of select="$gjdoc.option.header"/>
+ </td>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="$gjdoc.option.footer">
+ <td class="{$v_navbar_class} navbar-footer">
+ <xsl:value-of select="$gjdoc.option.footer"/>
+ </td>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </tr>
+ </table>
+
+ </div>
+ <xsl:if test="not($p_top) and $gjdoc.option.bottom">
+ <hr/>
+ <xsl:value-of select="$gjdoc.option.bottom"/>
+ </xsl:if>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="link_to_class_source">
+ <xsl:choose>
+ <xsl:when test="$gjdoc.option.linksource">
+ <a href="{concat($gjdoc.pathtoroot, 'src-html/', translate(gjdoc:containingPackage/@name, '.', '/'), '/', @name, '.html')}"><b><xsl:value-of select="@name"/></b></a>
+ </xsl:when>
+ <xsl:otherwise>
+ <b><xsl:value-of select="@name"/></b>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="link_to_member_source">
+ <xsl:choose>
+ <xsl:when test="$gjdoc.option.linksource">
+ <a href="{concat($gjdoc.pathtoroot, 'src-html/', translate(gjdoc:containingPackage/@name, '.', '/'), '/', gjdoc:containingClass/@typename, '.html#line.', gjdoc:position/@line)}"><b><xsl:value-of select="@name"/></b></a>
+ </xsl:when>
+ <xsl:otherwise>
+ <b><xsl:value-of select="@name"/></b>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="output_title">
+ <xsl:param name="p_pagetitle"/>
+ <xsl:variable name="v_title">
+ <xsl:value-of select="$p_pagetitle"/>
+ <xsl:if test="$gjdoc.option.windowtitle">
+ <xsl:text> (</xsl:text>
+ <xsl:value-of select="$gjdoc.option.windowtitle"/>
+ <xsl:text>)</xsl:text>
+ </xsl:if>
+ </xsl:variable>
+ <title>
+ <xsl:value-of select="$v_title"/>
+ </title>
+ </xsl:template>
+
+ <xsl:template name="get_qualified_type">
+ <xsl:param name="p_typename"/>
+ <xsl:variable name="v_plaintype">
+ <xsl:choose>
+ <xsl:when test="contains($p_typename,'[')">
+ <xsl:value-of select="normalize-space(substring-before($p_typename, '['))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$p_typename"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="v_containingpackage">
+ <xsl:value-of select="ancestor-or-self::gjdoc:classdoc/gjdoc:containingPackage/attribute::name"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="document('index.xml', /)/gjdoc:rootdoc/gjdoc:classdoc[attribute::name=$v_plaintype]/gjdoc:containingPackage[attribute::name=$v_containingpackage]">
+ <xsl:value-of select="$v_containingpackage"/>
+ <xsl:text>.</xsl:text>
+ </xsl:when>
+ <xsl:when test="document('index.xml', /)/gjdoc:rootdoc/gjdoc:classdoc[attribute::name=$v_plaintype]/gjdoc:containingPackage[attribute::name='java.lang']">
+ <xsl:text>java.lang.</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:value-of select="$p_typename"/>
+ </xsl:template>
+
+
+ <xsl:template name="output_link_tag">
+ <xsl:param name="p_contexturl"/>
+ <xsl:variable name="v_see">
+ <xsl:choose>
+ <xsl:when test="contains(., '(')">
+ <xsl:value-of select="normalize-space(substring-before(., '('))"/>
+ <xsl:text>(</xsl:text>
+ <xsl:call-template name="resolve_parameter_list">
+ <xsl:with-param name="p_anchor">
+ <xsl:value-of select="normalize-space(substring-before(substring-after(., '('), ')'))"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ <xsl:text>)</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="v_class">
+ <xsl:choose>
+ <xsl:when test="contains(., '#')">
+ <xsl:value-of select="normalize-space(substring-before(., '#'))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="normalize-space(.)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="v_anchor" select="normalize-space(substring-after(., '#'))"/>
+ <xsl:variable name="v_seeanchor">
+ <xsl:if test="contains($v_see, '#')">
+ <xsl:value-of select="concat('#', normalize-space(substring-after($v_see, '#')))"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="v_classname" select="document('index.xml', /)/gjdoc:rootdoc/gjdoc:classdoc[attribute::name=$v_class]/attribute::qualifiedtypename"/>
+ <xsl:variable name="v_classnamefq" select="document('index.xml', /)/gjdoc:rootdoc/gjdoc:classdoc[attribute::qualifiedtypename=$v_class]/attribute::qualifiedtypename"/>
+ <xsl:choose>
+ <xsl:when test="starts-with(., '#')">
+ <xsl:choose>
+ <xsl:when test="$p_contexturl">
+ <a href="{concat($p_contexturl, translate($v_see,' ',''))}"><xsl:value-of select="$v_anchor"/></a>
+ </xsl:when>
+ <xsl:otherwise>
+ <a href="{translate($v_see,' ','')}"><xsl:value-of select="$v_anchor"/></a>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$v_classname">
+ <a href="{translate(concat($gjdoc.pathtoroot, translate($v_classname, '.', '/'), '.html', $v_seeanchor),' ','')}"><xsl:value-of select="translate($v_see,'#','.')"/></a>
+ </xsl:when>
+ <xsl:when test="$v_classnamefq">
+ <a href="{translate(concat($gjdoc.pathtoroot, translate($v_classnamefq, '.', '/'), '.html', $v_seeanchor),' ','')}"><xsl:value-of select="translate($v_see,'#','.')"/></a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate(., '#', '.')" disable-output-escaping="yes"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="resolve_parameter_list">
+ <xsl:param name="p_anchor"/>
+ <xsl:variable name="v_parameter">
+ <xsl:value-of select="normalize-space(substring-before($p_anchor, ','))"/>
+ </xsl:variable>
+ <xsl:variable name="v_remainder">
+ <xsl:value-of select="normalize-space(substring-after($p_anchor, ','))"/>
+ </xsl:variable>
+ <xsl:call-template name="get_qualified_type">
+ <xsl:with-param name="p_typename">
+ <xsl:choose>
+ <xsl:when test="string-length($v_remainder)>0">
+ <xsl:value-of select="$v_parameter"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$p_anchor"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+
+ <xsl:if test="string-length($v_remainder)>0">
+ <xsl:text>,</xsl:text>
+ <xsl:call-template name="resolve_parameter_list">
+ <xsl:with-param name="p_anchor">
+ <xsl:value-of select="$v_remainder"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/index.xsl b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/index.xsl
new file mode 100644
index 000000000..da4ff6260
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/index.xsl
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- index.xsl
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+ -->
+
+<!-- Creates the index.html file for HTML documentation. This is only
+ a simple frameset.
+ -->
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:gjdoc="http://www.gnu.org/software/cp-tools/gjdocxml"
+ xmlns:html="http://www.w3.org/TR/REC-html40"
+ xmlns="http://www.w3.org/TR/REC-html40">
+
+ <xsl:include href="html_common.xsl"/>
+
+ <xsl:output method="html"
+ encoding="utf-8"
+ doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
+ doctype-system="http://www.w3.org/TR/html4/loose.dtd"
+ indent="no"/>
+
+ <xsl:strip-space elements="*"/>
+
+ <xsl:template match="/">
+ <html>
+ <head>
+ <xsl:call-template name="include_common"/>
+ </head>
+ <frameset cols="20%,80%">
+ <xsl:choose>
+ <xsl:when test="count(/gjdoc:rootdoc/gjdoc:packagedoc) > 1">
+ <frameset rows="25%,75%">
+ <frame src="allpackages.html" name="packages"/>
+ <frame src="allclasses.html" name="classes"/>
+ </frameset>
+ <frame src="index_noframes.html" name="content"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <frame src="allclasses.html" name="classes"/>
+ <frame src="{concat(translate(/gjdoc:rootdoc/gjdoc:packagedoc[position()=1]/@name, '.', '/'), '/package-summary.html')}" name="content"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </frameset>
+ </html>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/index_noframes.xsl b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/index_noframes.xsl
new file mode 100644
index 000000000..ab4510231
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/index_noframes.xsl
@@ -0,0 +1,146 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- index_noframes.xsl
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+ -->
+
+<!-- Creates the index.html file for HTML documentation. This is only
+ a simple frameset.
+ -->
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:gjdoc="http://www.gnu.org/software/cp-tools/gjdocxml"
+ xmlns:html="http://www.w3.org/TR/REC-html40"
+ xmlns="http://www.w3.org/TR/REC-html40">
+
+ <xsl:include href="html_common.xsl"/>
+
+ <xsl:output method="xml"
+ encoding="utf-8"
+ doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
+ doctype-system="http://www.w3.org/TR/html4/loose.dtd"
+ indent="no"/>
+
+ <xsl:strip-space elements="*"/>
+
+ <xsl:template name="output_packagedoc_tr">
+ <tr>
+ <td class="package-link">
+ <a href="{concat(translate(@name,'.','/'), '/package-summary.html')}" class="package-link">
+ <xsl:value-of select="@name"/>
+ </a>
+ </td>
+ <td class="package-summary-description">
+ <xsl:apply-templates select="./gjdoc:firstSentenceTags/node()"/>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="/">
+ <html>
+ <head>
+ <xsl:call-template name="output_title">
+ <xsl:with-param name="p_pagetitle" select="'Overview'"/>
+ </xsl:call-template>
+ <xsl:call-template name="include_common"/>
+ </head>
+ <body class="classdoc" onload="if(parent.contentPageLoaded)parent.contentPageLoaded(document.title)">
+
+ <!-- Top Navigation Bar -->
+ <xsl:call-template name="output_navbar">
+ <xsl:with-param name="p_show_frames" select="1"/>
+ <xsl:with-param name="p_show_noframes" select="0"/>
+ <xsl:with-param name="p_curr_noframes" select="1"/>
+ <xsl:with-param name="p_show_package" select="0"/>
+ <xsl:with-param name="p_show_package_tree" select="0"/>
+ <xsl:with-param name="p_show_full_tree" select="1"/>
+ <xsl:with-param name="p_show_index" select="1"/>
+ <xsl:with-param name="p_show_help" select="1"/>
+ <xsl:with-param name="p_top" select="1"/>
+ </xsl:call-template>
+
+ <div class="pagebody">
+
+ <xsl:if test="$gjdoc.option.doctitle">
+ <h1 class="overview-doctitle"><xsl:value-of select="$gjdoc.option.doctitle"/></h1>
+ </xsl:if>
+ <xsl:if test="/gjdoc:rootdoc/gjdoc:firstSentenceTags">
+ <div class="overview-description-top">
+ <xsl:for-each select="/gjdoc:rootdoc/gjdoc:firstSentenceTags/node()">
+ <xsl:copy-of select="."/>
+ </xsl:for-each>
+ </div>
+ <div class="classdoc-tag-section-header">See Also:</div>
+ <dl class="classdoc-list">
+ <dt><a href="#description">Description</a></dt>
+ </dl>
+ </xsl:if>
+
+ <xsl:choose>
+ <xsl:when test="/gjdoc:rootdoc/gjdoc:packagegroup">
+ <xsl:for-each select="/gjdoc:rootdoc/gjdoc:packagegroup">
+ <h1 class="classdoc-title"><xsl:value-of select="@name"/></h1>
+ <table border="1" cellspacing="0" class="classdoc-table">
+ <xsl:for-each select="gjdoc:package">
+ <xsl:variable name="v_name" select="@name"/>
+ <xsl:for-each select="/gjdoc:rootdoc/gjdoc:packagedoc[@name=$v_name]">
+ <xsl:call-template name="output_packagedoc_tr"/>
+ </xsl:for-each>
+ </xsl:for-each>
+ </table>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <h1 class="classdoc-title">All Packages</h1>
+ <table border="1" cellspacing="0" class="classdoc-table">
+ <xsl:for-each select="/gjdoc:rootdoc/gjdoc:packagedoc">
+ <xsl:call-template name="output_packagedoc_tr"/>
+ </xsl:for-each>
+ </table>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="/gjdoc:rootdoc/gjdoc:inlineTags">
+ <a name="description"/>
+ <div class="overview-description-full">
+ <xsl:for-each select="/gjdoc:rootdoc/gjdoc:inlineTags/node()">
+ <xsl:copy-of select="."/>
+ </xsl:for-each>
+ </div>
+ </xsl:if>
+ </div>
+
+ <!-- Bottom Navigation Bar -->
+ <xsl:call-template name="output_navbar">
+ <xsl:with-param name="p_show_frames" select="1"/>
+ <xsl:with-param name="p_show_noframes" select="0"/>
+ <xsl:with-param name="p_curr_noframes" select="1"/>
+ <xsl:with-param name="p_show_package" select="0"/>
+ <xsl:with-param name="p_show_package_tree" select="0"/>
+ <xsl:with-param name="p_show_full_tree" select="1"/>
+ <xsl:with-param name="p_show_index" select="1"/>
+ <xsl:with-param name="p_show_help" select="1"/>
+ <xsl:with-param name="p_top" select="0"/>
+ </xsl:call-template>
+
+ </body>
+ </html>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/packageclasses.xsl b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/packageclasses.xsl
new file mode 100644
index 000000000..430b94447
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/packageclasses.xsl
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- packageclasses.xsl
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+ -->
+
+<!-- Creates the package descriptor files for HTML documentation.
+ -->
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:gjdoc="http://www.gnu.org/software/cp-tools/gjdocxml"
+ xmlns:html="http://www.w3.org/TR/REC-html40"
+ xmlns="http://www.w3.org/TR/REC-html40">
+
+ <xsl:include href="html_common.xsl"/>
+
+ <xsl:output method="xml"
+ encoding="utf-8"
+ indent="no"/>
+
+ <xsl:strip-space elements="*"/>
+
+ <xsl:template name="add_link_to_class">
+ <a href="{concat(@name, '.html')}" target="content" class="menu packageclasses">
+ <xsl:choose>
+ <xsl:when test="gjdoc:isInterface">
+ <i><xsl:value-of select="@name"/></i>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@name"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </a><br/>
+ </xsl:template>
+
+ <xsl:template match="/">
+
+ <html>
+ <head>
+ <title>
+ <xsl:value-of select="concat(/gjdoc:rootdoc/gjdoc:title, ' - ', 'Classes in ', $gjdoc.outputfile.info)"/>
+ </title>
+ <xsl:call-template name="include_common"/>
+ </head>
+ <body onload="secondaryPageLoaded('classes');" class="menu packageclasses">
+ <h3 class="menu-title"><a href="package-summary.html" target="content"><xsl:value-of select="$gjdoc.outputfile.info"/></a></h3>
+ <xsl:for-each select="/gjdoc:rootdoc/gjdoc:classdoc[gjdoc:containingPackage/@name=$gjdoc.outputfile.info and not(child::gjdoc:isError or child::gjdoc:isException)]">
+ <xsl:sort select="@name" order="ascending"/>
+ <xsl:call-template name="add_link_to_class"/>
+ </xsl:for-each>
+
+ <xsl:if test="/gjdoc:rootdoc/gjdoc:classdoc[gjdoc:containingPackage/@name=$gjdoc.outputfile.info and child::gjdoc:isException]">
+ <h3><xsl:value-of select="$gjdoc.outputfile.info"/> Exceptions</h3>
+ <xsl:for-each select="/gjdoc:rootdoc/gjdoc:classdoc[gjdoc:containingPackage/@name=$gjdoc.outputfile.info and child::gjdoc:isException]">
+ <xsl:sort select="@name" order="ascending"/>
+ <xsl:call-template name="add_link_to_class"/>
+ </xsl:for-each>
+ </xsl:if>
+
+ <xsl:if test="/gjdoc:rootdoc/gjdoc:classdoc[gjdoc:containingPackage/@name=$gjdoc.outputfile.info and child::gjdoc:isError]">
+ <h3><xsl:value-of select="$gjdoc.outputfile.info"/> Errors</h3>
+ <xsl:for-each select="/gjdoc:rootdoc/gjdoc:classdoc[gjdoc:containingPackage/@name=$gjdoc.outputfile.info and child::gjdoc:isError]">
+ <xsl:sort select="@name" order="ascending"/>
+ <xsl:call-template name="add_link_to_class"/>
+ </xsl:for-each>
+ </xsl:if>
+ </body>
+ </html>
+
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/packagedoc.xsl b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/packagedoc.xsl
new file mode 100644
index 000000000..afe6fb77f
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/packagedoc.xsl
@@ -0,0 +1,153 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- packagedoc.xsl
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+ -->
+
+<!-- Creates the package descriptor files for HTML documentation.
+ -->
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:gjdoc="http://www.gnu.org/software/cp-tools/gjdocxml"
+ xmlns:html="http://www.w3.org/TR/REC-html40"
+ xmlns="http://www.w3.org/TR/REC-html40">
+
+ <xsl:include href="html_common.xsl"/>
+
+ <xsl:output method="xml"
+ encoding="utf-8"
+ indent="no"/>
+
+ <xsl:strip-space elements="*"/>
+
+ <xsl:template match="/">
+
+ <html>
+ <head>
+ <xsl:call-template name="output_title">
+ <xsl:with-param name="p_pagetitle" select="$gjdoc.outputfile.info"/>
+ </xsl:call-template>
+ <xsl:call-template name="include_common"/>
+ </head>
+ <body class="classdoc" onload="if(parent.contentPageLoaded)parent.contentPageLoaded(getTitle())">
+
+ <!-- Top Navigation Bar -->
+ <xsl:call-template name="output_navbar">
+ <xsl:with-param name="p_show_package" select="0"/>
+ <xsl:with-param name="p_curr_package" select="1"/>
+ <xsl:with-param name="p_show_package_tree" select="1"/>
+ <xsl:with-param name="p_top" select="1"/>
+ </xsl:call-template>
+
+ <div class="pagebody">
+
+ <h1 class="classdoc-title">Package <xsl:value-of select="$gjdoc.outputfile.info"/></h1>
+
+ <div class="classdoc-package-comment-body">
+ <xsl:apply-templates select="/gjdoc:rootdoc/gjdoc:packagedoc[@name=$gjdoc.outputfile.info]/gjdoc:firstSentenceTags/node()"/>
+ </div>
+
+ <xsl:if test="/gjdoc:rootdoc/gjdoc:classdoc[gjdoc:containingPackage/@name=$gjdoc.outputfile.info][gjdoc:isInterface]">
+ <table border="1" cellspacing="0" width="100%" class="classdoc-table">
+ <tr><td colspan="2" class="section-header"><div class="section-header">Interface Summary</div></td></tr>
+ <xsl:for-each select="/gjdoc:rootdoc/gjdoc:classdoc[gjdoc:containingPackage/@name=$gjdoc.outputfile.info][gjdoc:isInterface]">
+ <xsl:sort select="@name" order="ascending"/>
+ <xsl:call-template name="output-classes-summary"/>
+ </xsl:for-each>
+ </table>
+ </xsl:if>
+
+ <xsl:if test="/gjdoc:rootdoc/gjdoc:classdoc[gjdoc:containingPackage/@name=$gjdoc.outputfile.info][gjdoc:isOrdinaryClass]">
+ <table border="1" cellspacing="0" width="100%" class="classdoc-table">
+ <tr><td colspan="2" class="section-header"><div class="section-header">Class Summary</div></td></tr>
+ <xsl:for-each select="/gjdoc:rootdoc/gjdoc:classdoc[gjdoc:containingPackage/@name=$gjdoc.outputfile.info][gjdoc:isOrdinaryClass]">
+ <xsl:sort select="@name" order="ascending"/>
+ <xsl:call-template name="output-classes-summary"/>
+ </xsl:for-each>
+ </table>
+ </xsl:if>
+
+ <xsl:if test="/gjdoc:rootdoc/gjdoc:classdoc[gjdoc:containingPackage/@name=$gjdoc.outputfile.info][gjdoc:isException]">
+ <table border="1" cellspacing="0" width="100%" class="classdoc-table">
+ <tr><td colspan="2" class="section-header"><div class="section-header">Exception Summary</div></td></tr>
+ <xsl:for-each select="/gjdoc:rootdoc/gjdoc:classdoc[gjdoc:containingPackage/@name=$gjdoc.outputfile.info][gjdoc:isException]">
+ <xsl:sort select="@name" order="ascending"/>
+ <xsl:call-template name="output-classes-summary"/>
+ </xsl:for-each>
+ </table>
+ </xsl:if>
+
+ <xsl:if test="/gjdoc:rootdoc/gjdoc:classdoc[gjdoc:containingPackage/@name=$gjdoc.outputfile.info][gjdoc:isError]">
+ <table border="1" cellspacing="0" width="100%" class="classdoc-table">
+ <tr><td colspan="2" class="section-header"><div class="section-header">Error Summary</div></td></tr>
+ <xsl:for-each select="/gjdoc:rootdoc/gjdoc:classdoc[gjdoc:containingPackage/@name=$gjdoc.outputfile.info][gjdoc:isError]">
+ <xsl:sort select="@name" order="ascending"/>
+ <xsl:call-template name="output-classes-summary"/>
+ </xsl:for-each>
+ </table>
+ </xsl:if>
+
+ <a name="description"><p> </p></a>
+ <h1 class="classdoc-sub-title package-description">Package <xsl:value-of select="$gjdoc.outputfile.info"/> Description</h1>
+
+ <div class="classdoc-package-comment-body">
+ <xsl:apply-templates select="/gjdoc:rootdoc/gjdoc:packagedoc[@name=$gjdoc.outputfile.info]/gjdoc:inlineTags/node()"/>
+ </div>
+
+ </div>
+
+ <!-- Bottom Navigation Bar -->
+ <xsl:call-template name="output_navbar">
+ <xsl:with-param name="p_show_package" select="0"/>
+ <xsl:with-param name="p_curr_package" select="1"/>
+ <xsl:with-param name="p_show_package_tree" select="1"/>
+ <xsl:with-param name="p_top" select="0"/>
+ </xsl:call-template>
+ </body>
+ </html>
+
+ </xsl:template>
+
+ <xsl:template name="output-classes-summary">
+ <xsl:variable name="v_currentclass" select="@qualifiedtypename"/>
+ <xsl:variable name="v_sub_xml_filename" select="concat(@qualifiedtypename,'.xml')"/>
+ <tr>
+ <td class="class-link">
+ <a href="{concat(@name, '.html')}" class="package-link">
+ <xsl:value-of select="@name"/>
+ </a>
+ </td>
+ <td class="class-summary-description">
+ <xsl:variable name="v_docstring" select="document($v_sub_xml_filename,/gjdoc:rootdoc)/gjdoc:classdoc[@qualifiedtypename=$v_currentclass]/gjdoc:firstSentenceTags/node()"/>
+ <xsl:choose>
+ <xsl:when test="$v_docstring">
+ <xsl:for-each select="$v_docstring">
+ <xsl:value-of select="." disable-output-escaping="yes"/>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <i>No description available.</i>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/res/default_help_en.html b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/res/default_help_en.html
new file mode 100644
index 000000000..b59a63c4f
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/res/default_help_en.html
@@ -0,0 +1,7 @@
+ <body>
+ <h1 class="classdoc-title">Using the API Documentation</h1>
+
+ <p>
+ Write me.
+ </p>
+ </body>
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/res/gjdoc.js b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/res/gjdoc.js
new file mode 100644
index 000000000..125f8f687
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/res/gjdoc.js
@@ -0,0 +1,108 @@
+/* gjdoc.js
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/**
+ * Sets a new stylesheet for a single frame.
+ */
+function setStyleSheetForFrame(title, frame_name)
+{
+ var i, num, a, main;
+ f = eval("top.frames." + frame_name);
+ for(i=0; (a = f.document.getElementsByTagName("link")[i]); i++) {
+ if(a.getAttribute("rel").indexOf("style") != -1
+ && a.getAttribute("title")) {
+ a.disabled = true;
+ a.disabled = (a.getAttribute("title") != title);
+ }
+ }
+}
+
+/**
+ * Sets a new stylesheet for a single document.
+ */
+function setStyleSheetForDocument(title)
+{
+ var i, num, a, main;
+ for(i=0; (a = top.document.getElementsByTagName("link")[i]); i++) {
+ if(a.getAttribute("rel").indexOf("style") != -1
+ && a.getAttribute("title")) {
+ a.disabled = true;
+ a.disabled = (a.getAttribute("title") != title);
+ }
+ }
+}
+
+/**
+ * Sets a new stylesheets for all frames.
+ */
+function setStyleSheet(title)
+{
+ var i, num, a, main;
+ num = top.frames.length;
+ if (num > 0) {
+ for (i=0; i<num; i++) {
+ setStyleSheetForFrame(title, top.frames[i].name);
+ }
+ }
+ else {
+ setStyleSheetForDocument(title);
+ }
+ top.selectedSheet = title;
+ return false;
+}
+
+/**
+ * Returns the title of the set of stylesheets that is active in the
+ * given frame.
+ */
+function getActiveStylesheetTitle(frame)
+{
+ for(i=0; (a = frame.document.getElementsByTagName("link")[i]); i++) {
+ if(a.getAttribute("rel").indexOf("style") != -1
+ && a.getAttribute("title")) {
+ if (!a.disabled) {
+ return a.getAttribute("title");
+ }
+ }
+ }
+ return "";
+}
+
+/**
+ * Invoked when a page in the main content frame has been loaded.
+ */
+function contentPageLoaded(title)
+{
+ top.document.title = title;
+ if (top.frames.length > 0)
+ setStyleSheet(getActiveStylesheetTitle(top.frames.packages), "content");
+ else if (top.selectedSheet) {
+ setStyleSheet(top.selectedSheet, "content");
+ }
+}
+
+/**
+ * Invoked when a page in one of the two frames on the left hand has
+ * been loaded.
+ */
+function secondaryPageLoaded(frame_name)
+{
+ setStyleSheet(getActiveStylesheetTitle(top.frames.packages), frame_name);
+}
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/res/gjdochtml-clean.css b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/res/gjdochtml-clean.css
new file mode 100644
index 000000000..0913e7d3e
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/res/gjdochtml-clean.css
@@ -0,0 +1,382 @@
+/* gjdochtml-clean.css
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+body.classdoc {
+ background: white;
+ font-size: 100%;
+ margin: 0.5em 1em 0.5em 1em;
+}
+
+hr {
+ border-style: solid none none none;
+ border-width: thin;
+ height: 1px;
+ color: black;
+}
+
+hr.footer {
+ margin-top: 2em;
+}
+
+table,tr,td {
+ border: solid 1px #aaaaaa !important;
+ border-collapse: collapse !important;
+}
+
+table.classdoc-table {
+ border-width: 1px;
+ border-collapse: collapse;
+}
+
+table.classdoc-table tr {
+ border-width: 1px;
+ border-collapse: collapse;
+}
+
+table.classdoc-table td {
+ border: solid 1px #aaaaaa;
+ border-collapse: collapse;
+}
+
+.header {
+
+ border-style: solid;
+ padding: 0.2em;
+ margin: 0.3em;
+}
+
+ul {
+ padding-top: 0em;
+ margin-top: 0em;
+}
+
+td {
+ padding: 0.3em;
+ vertical-align: top;
+}
+
+td.with-border {
+ border-color: #aaaaaa;
+ border-style: solid;
+ border-top: 0px;
+}
+
+td.no-border-r {
+ border-color: #aaaaaa;
+ border-style: solid;
+ border-right: 0px;
+ border-top: 0px;
+}
+
+td.no-border-b {
+ border-color: #aaaaaa;
+ border-style: solid;
+ border-bottom: 0px;
+}
+
+td.no-border-rb {
+ border-color: #aaaaaa;
+ border-style: solid;
+ border-right: 0px;
+ border-bottom: 0px;
+}
+
+.classdoc-head {
+ border: 1px;
+ border-style: solid;
+ padding: 0.3em 0.7em 0.5em 0.7em;
+ margin: 0.0em;
+}
+
+.classdoc-head-packagename {
+ font-size: 110%;
+ padding: 0.0em;
+ margin: 0.0em;
+}
+
+.classdoc-head-classname {
+ font-size: 180%;
+ padding: 0.0em;
+ margin: 0.0em;
+}
+
+h1.classdoc-header {
+ border-width: 1px;
+ border-style: solid;
+ font-size: 140%;
+ padding: 0.2em 0.5em 0.3em 0.5em;
+ margin-top: 0.0em;
+}
+
+h2.classdoc-header {
+ border-width: 1px;
+ border-style: solid;
+ font-size: 140%;
+ padding: 0.2em 0.5em 0.3em 0.5em;
+ margin-top: 0.0em;
+}
+
+h1.classdoc-header,
+h2.classdoc-header,
+.classdoc-head,
+.classdoc-subheader,
+.section-header,
+.sub-section-header {
+ background: #80B9FF;
+ font-weight: bolder;
+}
+
+table.navbar {
+ background: #BFDCFF;
+}
+
+div[class="navbar top"] {
+ margin-bottom: 1em;
+}
+
+span[class="navi-button current"] {
+ color: white;
+ background: #0055BA;
+}
+
+span[class="navi-button unavailable"] {
+ color: #888888;
+}
+
+h3.classdoc-header {
+ font-size: 110%;
+}
+
+.classdoc-subheader {
+ border-width: 1px;
+ border-style: solid;
+ font-size: 120%;
+ padding: 1.0em;
+}
+
+.classdoc-prototype {
+}
+
+.classdoc-summary-comment {
+ margin-top: 1.0em;
+ margin-bottom: 1.0em;
+ font-size: 100%;
+}
+
+.classdoc-tree-label {
+ font-size: 80%;
+ line-height: 2.0em;
+ padding: 0%;
+ vertical-align: top;
+ height: 2.0em;
+ margin: 0%;
+ padding-left: 1.0em;
+}
+
+.classdoc-comment-body {
+ font-size: 100%;
+}
+
+blockquote.classdoc-summary-comment {
+ margin: 0.4em 0.0em 0.2em 2.0em;
+ padding: 0em;
+}
+
+div.classdoc-comment-body {
+ margin: 0.4em 0.0em 0.2em 2.0em;
+ padding: 0em;
+}
+
+div.classdoc-package-comment-body {
+ margin: 0.4em 0.0em 1.5em 0.0em;
+ padding: 0em;
+}
+
+div.classdoc-class-comment-body {
+ margin: 0.8em 0.0em 1.0em 0.0em;
+ padding: 0.0em;
+}
+
+ul.classdoc-list {
+ margin-top: 0.2em;
+ margin-left: 1.6em;
+}
+
+div.classdoc-tag-section-header {
+ margin-top: 0.5em;
+ font-weight: bold;
+}
+
+ol.classdoc-list {
+ margin-top: 0.2em;
+ margin-left: 1.6em;
+ list-style-type: circle;
+}
+
+dl.classdoc-list {
+ margin-top: 0.2em;
+ margin-left: 1.6em;
+}
+
+.navi-button {
+ padding: 0.0em;
+ margin: 0.0em;
+ padding-left: 0.2em;
+ padding-right: 0.2em;
+}
+
+.header {
+ width: 100%;
+ padding: 0.0em 0.7em 0.5em 0.0em;
+ margin: 0.0em 0.0em 0.9em 0.0em;
+ border: black 1px;
+ border-style: none none solid none;
+}
+
+.navbar-first-row {
+ width: 100%;
+ padding: 0.0em 0.7em 0.0em 0.0em;
+ margin: 0.0em 0.0em 0.4em 0.0em;
+ font-size: 80%;
+}
+
+.navbar-second-row {
+ width: 100%;
+ padding: 0.0em 0.7em 0.0em 0.0em;
+ margin: 0.0em 0.0em 0.0em 0.0em;
+ font-size: 70%;
+}
+
+.prototype {
+ text-indent:-2em;
+ font-family:monospace;
+ padding: 0em 0em 0em 2em;
+ margin: 0em;
+}
+
+.prototype-type {
+ font-family:monospace;
+ padding: 0em;
+ margin: 0em;
+}
+
+.prototype-name {
+ font-family:monospace;
+}
+
+span.parameter {
+ padding: 0em;
+ margin: 0em;
+ white-space: nowrap;
+}
+
+div.footer {
+ margin-bottom: 6cm;
+ font-style: italic;
+ font-size: 0.8em;
+}
+
+pre {
+ margin-left: 1.6em;
+}
+
+pre.inheritance-tree {
+ margin-left: 0.0em;
+}
+
+a.tree-class-link {
+ font-weight: bold;
+}
+
+span.index-category-current {
+ padding: 0.4em;
+ border: 1px black solid;
+}
+
+a.index-category-link {
+ padding: 0.4em;
+}
+
+a.menu {
+ font-size: 90%;
+}
+
+table.navbar {
+ width: 100%;
+ margin: 0px;
+ border: solid 1px #888888;
+ padding: 0px;
+}
+
+tr.navbar, td.navbar {
+ padding: 0.3em;
+ margin: 0px;
+}
+
+
+h1.overview-doctitle {
+ font-size: 170%;
+ text-align: center;
+ padding-bottom: 0.5em;
+}
+
+div.overview-description-top,
+div.overview-description-full {
+ margin-top: 1.5em;
+}
+
+table {
+ margin-top: 0em;
+ margin-bottom: 1em;
+ border-collapse: collapse;
+}
+
+span.navsep {
+}
+
+a[href] {
+ color: #0055BA;
+}
+
+a:visited {
+ color: #003B82;
+}
+
+a:active {
+ color: #80B9FF;
+}
+
+blockquote.member-summary {
+ text-indent: 2em;
+ margin: 0em;
+ margin-top: 0.2em;
+}
+
+table {
+ width: 100%;
+}
+
+td[class="member-summary method modifiers"] {
+ text-align: right;
+}
+
+td[class="member-summary field modifiers"] {
+ text-align: right;
+}
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/res/gjdochtml-fixed.css b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/res/gjdochtml-fixed.css
new file mode 100644
index 000000000..0c96c009a
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/res/gjdochtml-fixed.css
@@ -0,0 +1,286 @@
+/* gjdochtml-fixed.css
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+table {
+ border: none !important;
+ border-top: none !important;
+ border-left: none !important;
+ border-right: none !important;
+ border-bottom: none !important;
+}
+
+td {
+ border: none !important;
+ border-top: none !important;
+ border-left: none !important;
+ border-right: none !important;
+ border-bottom: none !important;
+}
+
+body.classdoc {
+ font-size: 100%;
+ margin: 0em;
+ padding: 0em;
+}
+
+table.navbar {
+ margin: 0em;
+ position: fixed;
+ z-index: 20;
+ left: 0em;
+ top: 0em;
+ width: 100%;
+ background: #0066B3;
+ color: white;
+ padding: 0.3em;
+ border-bottom: 3px solid black !important;
+ height: 5.3em;
+}
+
+table[class="navbar bottom"] {
+ visibility: hidden;
+}
+
+a.navi-button {
+ color: #FFB200;
+}
+
+.navbar-first-row {
+ font-size: 80%;
+ padding-bottom: 0.3em;
+}
+
+.navbar-second-row {
+ font-size: 70%;
+ text-align: right;
+ padding-right: 4.5em;
+}
+
+
+div.pagebody {
+ margin-top: 7em;
+ padding-left: 1em;
+ padding-right: 1em;
+ padding-bottom: 5em;
+ z-index: -100;
+}
+
+span.navsep:before {
+ padding-left: 0.25em;
+ content: "|";
+}
+
+span[class="navi-button current"] {
+ background: #003D6B;
+ color: white;
+}
+
+span[class="navi-button unavailable"] {
+ color: white;
+}
+
+.navi-button {
+ padding-left: 0.1em;
+ padding-right: 0.1em;
+
+}
+
+
+.classdoc-table-xxx {
+ border-color: #aaaaaa;
+ border-style: solid;
+ border-collapse: collapse;
+}
+
+.classdoc-table {
+ border: 0px;
+ border-collapse: collapse;
+}
+
+td {
+ vertical-align: top;
+ padding: 0.2em;
+}
+
+table {
+ margin-top: 1em;
+}
+
+span.index-category-current {
+ padding: 0.4em;
+ border: 1px black solid;
+}
+
+a.index-category-link {
+ width: 5em;
+ min-width: 5em;
+ padding: 0.3em;
+ margin-right: 0.4em;
+ color: #FFB200;
+ border: 1px #FFB200 solid;
+ text-decoration: none;
+}
+
+a[href] {
+ color: #991F00;
+}
+
+.classdoc-subtitle {
+ position: fixed;
+ left: 0.0em;
+ top: 2.7em;
+ font-size: 80%;
+ font-weight: bold;
+ color: #FFD980;
+ z-index: 30;
+ padding-left: 1.0em;
+ padding-top: 0.0em;
+ margin-top: 0.0em;
+}
+
+h1.classdoc-title {
+ position: fixed;
+ left: 0.0em;
+ top: 2.4em;
+ font-size: 130%;
+ z-index: 30;
+ color: #FFD980;
+ padding-left: 0.5em;
+ padding-top: 0.0em;
+ margin-top: 0.0em;
+}
+
+div.index-categories {
+ position: fixed;
+ left: 28em;
+ top: 5.8em;
+ font-size: 60%;
+ padding-top: 0.0em;
+ margin-top: 0.0em;
+}
+
+.before-details {
+}
+
+h3.menu-title {
+ width: 100%;
+ position: fixed;
+ left: 0em;
+ top: 0em;
+ margin-top: 0em;
+ background: #0066B3;
+ color: #FFD980;
+ padding: 0.3em;
+ padding-left: 0.8em;
+ border-bottom: 3px solid black;
+ font-size: 100%;
+}
+
+h3.menu-title > a {
+ color: #FFB200;
+}
+
+body.menu {
+ padding-top: 2em;
+}
+
+a.menu {
+ font-size: 85%;
+}
+
+a.classdoc {
+ position: relative;
+ top: -6em;
+}
+
+
+div.section-header, h1.classdoc-header {
+ background: #FFD980;
+ margin-bottom: 0px;
+ font-size: 130%;
+ font-weight: bolder;
+ padding-left: 2px;
+ margin-top: 1em;
+ padding-top: 4px;
+ padding-bottom: 4px;
+ position: relative;
+ left: -200px;
+ padding-left: 202px;
+ padding-right: 20px;
+ border: 1px solid black;
+ width: 60%;
+}
+
+div.sub-section-header {
+ background: #FFD980;
+ margin-bottom: 0px;
+ font-size: 110%;
+ font-weight: normal;
+ padding-left: 2px;
+ margin-top: 1em;
+ padding-top: 4px;
+ padding-bottom: 4px;
+ position: relative;
+ left: -200px;
+ padding-left: 202px;
+ padding-right: 20px;
+ border: 1px solid black;
+ width: 60%;
+}
+
+table {
+ width: 100%;
+}
+
+dl.classdoc-list {
+ margin-top: 0px;
+ margin-bottom: 0px;
+ margin-left: 2.5em;
+}
+
+blockquote.member-summary {
+ margin: 0px;
+ font-style: oblique;
+ font-size: 90%;
+ margin-top: 0.1em;
+ margin-bottom: 0.2em;
+ margin-left: 1em;
+}
+
+td[class="member-summary method modifiers"] {
+ text-align: right;
+}
+
+div.classdoc-tag-section-header {
+ margin-top: 0.5em;
+ font-weight: bold;
+}
+
+div.navbar-style-selector {
+ position: fixed;
+ right: 1em;
+ top: 2.9em;
+ z-index: 50;
+ padding-right: 0.6em;
+ vertical-align: top;
+}
+
+/* triad @ 225 deg */
+
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/res/gjdochtml-sclara.css b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/res/gjdochtml-sclara.css
new file mode 100644
index 000000000..5c7f119d9
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/res/gjdochtml-sclara.css
@@ -0,0 +1,266 @@
+/* gjdochtml-sclara.css
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+div.section-header,
+h1.classdoc-header {
+ background: #ccccff;
+ border: black ridge 2px;
+ border-collapse: collapse;
+ vertical-align: inherit;
+ text-align: inherit;
+ margin-bottom: 0px;
+ font-size: 155%;
+ font-weight: bold;
+ padding-left: 2px;
+ margin-top: 1em;
+ padding-top: 2px;
+ padding-bottom: 2px;
+}
+
+td.section-header {
+ background: #ccccff;
+ margin-bottom: 0px;
+ font-size: 155%;
+ font-weight: bold;
+ padding-left: 2px;
+ margin-top: 1em;
+ padding-top: 2px;
+ padding-bottom: 2px;
+}
+
+td.sub-section-header {
+ background: #eeeeff;
+ margin-bottom: 0px;
+ font-size: 110%;
+ font-weight: normal;
+ padding-left: 2px;
+ margin-top: 1em;
+ padding-top: 2px;
+ padding-bottom: 2px;
+}
+
+table.classdoc-table {
+ margin-top: 1.5em;
+}
+
+div.navbar-first-row {
+ background: #eeeeff;
+ padding-top: 4px;
+ padding-bottom: 4px;
+ padding-left: 4px;
+ padding-right: 4px;
+ font-size: 100%;
+ color: black;
+ font-family: Arial, sans-serif;
+ font-weight: normal;
+}
+
+div.navbar-second-row {
+ padding-top: 0px;
+ padding-bottom: 9px;
+}
+
+div.navbar-second-row a[href] {
+ text-decoration: underline;
+ font-family: Arial, sans-serif;
+ font-weight: normal;
+ font-size: 60%;
+ text-transform: uppercase;
+ padding-top: 0px;
+ margin-top: 0px;
+ background: white;
+ margin-left: 8px;
+}
+
+div.navbar-second-row span {
+ padding: 0px;
+ margin: 0px;
+}
+
+span.navi-button {
+ padding-left: 0.4em;
+ padding-right: 0.4em;
+}
+
+div.navbar-first-row span[class="navi-button current"] {
+ background: #00008B;
+ color: white;
+ font-weight: bold;
+}
+
+div.navbar-first-row span[class="navi-button unavailable"] {
+ font-weight: normal;
+}
+
+div.navbar-first-row a[href] {
+ padding-bottom: 0px;
+ font-weight: lighter;
+ text-decoration: none;
+ border-bottom: 1px solid blue;
+ position: relative;
+ top: -1px;
+}
+
+div.navbar-first-row a:visited {
+ color: black;
+ font-weight: lighter;
+ text-decoration: none;
+ border-bottom: 1px solid black;
+}
+
+div.navbar-first-row span.navi-link {
+ padding: 0px;
+ margin: 0px;
+ color: black;
+ font-weight: bold;
+ position: relative;
+ top: 1px;
+}
+
+span.navsep {
+ padding-left: 0.15em;
+}
+
+a.menu {
+ font-family: Arial, Sans-Serif;
+ font-size: 90%;
+}
+
+table.navbar[class="navbar top"] {
+ padding-bottom: 4px;
+ border-bottom: inset 1px black;
+}
+
+table {
+ width: 100%;
+ margin: 0px;
+ border: none;
+ padding: 0px;
+ border-collapse: collapse;
+ border-spacing: 0;
+}
+
+tr.navbar {
+ margin: 0px;
+ padding: 0px;
+ border: none;
+}
+
+td.navbar {
+ margin: 0px;
+ padding: 0px;
+ border: none;
+}
+
+a.package-link,
+a.class-link {
+ font-weight: bold;
+}
+
+table,tr,td {
+}
+
+table.classdoc-table {
+}
+
+table.classdoc-table tr {
+}
+
+table.classdoc-table td {
+ border: ridge 2px black;
+ border-collapse: separate;
+}
+
+td {
+ padding: 2px;
+}
+
+h1.classdoc-title,
+h1.classdoc-sub-title {
+ font-size: 150%;
+ font-weight: bold;
+}
+
+div.pagebody {
+ padding-bottom: 1em;
+}
+
+h3.menu-title {
+ font-family: Arial, Sans-Serif;
+ font-weight: normal;
+ font-size: 105%;
+}
+
+p.member-summary {
+ margin: 0px;
+ padding: 0px;
+ font-family: Monospace;
+}
+
+p.modifiers {
+ font-size: 80%;
+}
+
+a.name {
+ font-weight: bold;
+}
+
+blockquote.member-summary {
+ text-indent: 3em;
+ margin: 0px;
+}
+
+td.member-summary {
+ vertical-align: top;
+}
+
+.classdoc-head-packagename {
+ font-weight: bold;
+ padding-top: 2em;
+ padding-bottom: 0em;
+ margin: 0em;
+}
+
+.classdoc-head-classname {
+ padding-top: 0em;
+ margin-top: 0em;
+}
+
+td.super {
+ font-family: Monospace;
+}
+
+.classdoc-tag-section-header {
+ font-weight: bold;
+}
+
+dl.classdoc-list {
+ margin-top: 0px;
+ margin-bottom: 0px;
+ margin-left: 2.5em;
+}
+
+div.section-header,
+div.sub-section-header {
+ border: none;
+ padding: 0px;
+ margin: 0px;
+ font-size: inherit;
+}
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/res/gjdochtml.css b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/res/gjdochtml.css
new file mode 100644
index 000000000..5944c6cdb
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/res/gjdochtml.css
@@ -0,0 +1,29 @@
+/* gjdochtml.css
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+body {
+ background: white;
+ font-size: 100%;
+}
+
+ol.tree,
+li.tree {
+ list-style-type: disc;
+}
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/serialized.xsl b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/serialized.xsl
new file mode 100644
index 000000000..16447f8ee
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/doctranslets/html/serialized.xsl
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- deprecated.xsl
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+ -->
+
+<!-- Creates the deprecation information page for HTML documentation.
+ -->
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:gjdoc="http://www.gnu.org/software/cp-tools/gjdocxml"
+ xmlns:html="http://www.w3.org/TR/REC-html40"
+ xmlns="http://www.w3.org/TR/REC-html40">
+
+ <xsl:include href="html_common.xsl"/>
+
+ <xsl:output method="xml"
+ encoding="utf-8"
+ doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
+ doctype-system="http://www.w3.org/TR/html4/loose.dtd"
+ indent="no"/>
+
+ <xsl:strip-space elements="*"/>
+
+
+ <xsl:template match="/">
+
+ <xsl:for-each select="/gjdoc:rootdoc/gjdoc:specifiedpackage">
+ <xsl:variable name="v_packagename" select="@name"/>
+ <xsl:for-each select="/gjdoc:rootdoc/gjdoc:packagedoc[@name=$v_packagename]">
+ <xsl:if test="not(gjdoc:tags/gjdoc:tag[gjdoc:kind='@serial' and normalize-space(text())='exclude'])">
+ <xsl:if test="../gjdoc:classdoc[gjdoc:containingPackage/@name=$v_packagename and (gjdoc:implements/@qualifiedtypename='java.io.Serializable' or gjdoc:superimplements='java.io.Serializable')]">
+ <h1>Package <xsl:value-of select="$v_packagename"/></h1>
+ <xsl:for-each select="../gjdoc:classdoc[gjdoc:containingPackage/@name=$v_packagename and (gjdoc:implements/@qualifiedtypename='java.io.Serializable' or gjdoc:superimplements='java.io.Serializable')]">
+ <h2>Class <xsl:value-of select="@name"/> extends <xsl:value-of select="gjdoc:superclass/@qualifiedtypename"/></h2>
+ <xsl:variable name="v_sub_xml_filename" select="concat(@qualifiedtypename,'.xml')"/>
+ <xsl:variable name="v_currentclass" select="@qualifiedtypename"/>
+ <xsl:for-each select="document($v_sub_xml_filename,/gjdoc:rootdoc)//gjdoc:classdoc[@qualifiedtypename=$v_currentclass]/@qualifiedtypename/..">
+ <xsl:if test="gjdoc:fielddoc[@name='serialVersionUID' and gjdoc:isFinal and gjdoc:isStatic and gjdoc:type/@typename='long']">
+ <p><b>serialVersionUID: </b>?</p>
+ </xsl:if>
+ <xsl:if test="gjdoc:fielddoc[not(gjdoc:isTransient or gjdoc:isSerialExclude)]">
+ <h3>Serialized Fields</h3>
+ <xsl:for-each select="gjdoc:fielddoc[not(gjdoc:isTransient) and not(gjdoc:isSerialExclude)]">
+ <h4><xsl:value-of select="@name"/></h4>
+
+ <p><code><xsl:value-of select="gjdoc:type/@typename"/><xsl:text> </xsl:text><b><xsl:value-of select="@name"/></b></code></p>
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:for-each>
+
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/dtd/dbcentx.mod b/tools/resource/gnu/classpath/tools/gjdoc/dtd/dbcentx.mod
new file mode 100644
index 000000000..5d11345ac
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/dtd/dbcentx.mod
@@ -0,0 +1,204 @@
+<!-- ...................................................................... -->
+<!-- DocBook XML character entities module V4.1.2 ........................... -->
+<!-- File dbcentx.mod ..................................................... -->
+
+<!-- Copyright 1992-2000 HaL Computer Systems, Inc.,
+ O'Reilly & Associates, Inc., ArborText, Inc., Fujitsu Software
+ Corporation, Norman Walsh, and the Organization for the Advancement
+ of Structured Information Standards (OASIS).
+
+ $Id: dbcentx.mod,v 1.1 2008-05-27 19:26:05 jsumali Exp $
+
+ Permission to use, copy, modify and distribute the DocBook XML DTD
+ 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 make no representation about the suitability of the DTD for
+ any purpose. It is provided "as is" without expressed or implied
+ warranty.
+
+ If you modify the DocBook XML DTD in any way, except for declaring and
+ referencing additional sets of general entities and declaring
+ additional notations, label your DTD as a variant of DocBook. See
+ the maintenance documentation for more information.
+
+ Please direct all questions, bug reports, or suggestions for
+ changes to the docbook@lists.oasis-open.org mailing list. For more
+ information, see http://www.oasis-open.org/docbook/.
+-->
+
+<!-- ...................................................................... -->
+
+<!-- This module contains the entity declarations for the standard ISO
+ entity sets used by DocBook.
+
+ In DTD driver files referring to this module, please use an entity
+ declaration that uses the public identifier shown below:
+
+ <!ENTITY % dbcent PUBLIC
+ "-//OASIS//ENTITIES DocBook XML Character Entities V4.1.2//EN"
+ "dbcentx.mod">
+ %dbcent;
+
+ See the documentation for detailed information on the parameter
+ entity and module scheme used in DocBook, customizing DocBook and
+ planning for interchange, and changes made since the last release
+ of DocBook.
+-->
+
+<!-- ...................................................................... -->
+
+<!ENTITY % ISOamsa.module "INCLUDE">
+<![%ISOamsa.module;[
+<!ENTITY % ISOamsa PUBLIC
+"ISO 8879:1986//ENTITIES Added Math Symbols: Arrow Relations//EN//XML"
+"ent/iso-amsa.ent">
+%ISOamsa;
+<!--end of ISOamsa.module-->]]>
+
+<!ENTITY % ISOamsb.module "INCLUDE">
+<![%ISOamsb.module;[
+<!ENTITY % ISOamsb PUBLIC
+"ISO 8879:1986//ENTITIES Added Math Symbols: Binary Operators//EN//XML"
+"ent/iso-amsb.ent">
+%ISOamsb;
+<!--end of ISOamsb.module-->]]>
+
+<!ENTITY % ISOamsc.module "INCLUDE">
+<![%ISOamsc.module;[
+<!ENTITY % ISOamsc PUBLIC
+"ISO 8879:1986//ENTITIES Added Math Symbols: Delimiters//EN//XML"
+"ent/iso-amsc.ent">
+%ISOamsc;
+<!--end of ISOamsc.module-->]]>
+
+<!ENTITY % ISOamsn.module "INCLUDE">
+<![%ISOamsn.module;[
+<!ENTITY % ISOamsn PUBLIC
+"ISO 8879:1986//ENTITIES Added Math Symbols: Negated Relations//EN//XML"
+"ent/iso-amsn.ent">
+%ISOamsn;
+<!--end of ISOamsn.module-->]]>
+
+<!ENTITY % ISOamso.module "INCLUDE">
+<![%ISOamso.module;[
+<!ENTITY % ISOamso PUBLIC
+"ISO 8879:1986//ENTITIES Added Math Symbols: Ordinary//EN//XML"
+"ent/iso-amso.ent">
+%ISOamso;
+<!--end of ISOamso.module-->]]>
+
+<!ENTITY % ISOamsr.module "INCLUDE">
+<![%ISOamsr.module;[
+<!ENTITY % ISOamsr PUBLIC
+"ISO 8879:1986//ENTITIES Added Math Symbols: Relations//EN//XML"
+"ent/iso-amsr.ent">
+%ISOamsr;
+<!--end of ISOamsr.module-->]]>
+
+<!ENTITY % ISObox.module "INCLUDE">
+<![%ISObox.module;[
+<!ENTITY % ISObox PUBLIC
+"ISO 8879:1986//ENTITIES Box and Line Drawing//EN//XML"
+"ent/iso-box.ent">
+%ISObox;
+<!--end of ISObox.module-->]]>
+
+<!ENTITY % ISOcyr1.module "INCLUDE">
+<![%ISOcyr1.module;[
+<!ENTITY % ISOcyr1 PUBLIC
+"ISO 8879:1986//ENTITIES Russian Cyrillic//EN//XML"
+"ent/iso-cyr1.ent">
+%ISOcyr1;
+<!--end of ISOcyr1.module-->]]>
+
+<!ENTITY % ISOcyr2.module "INCLUDE">
+<![%ISOcyr2.module;[
+<!ENTITY % ISOcyr2 PUBLIC
+"ISO 8879:1986//ENTITIES Non-Russian Cyrillic//EN//XML"
+"ent/iso-cyr2.ent">
+%ISOcyr2;
+<!--end of ISOcyr2.module-->]]>
+
+<!ENTITY % ISOdia.module "INCLUDE">
+<![%ISOdia.module;[
+<!ENTITY % ISOdia PUBLIC
+"ISO 8879:1986//ENTITIES Diacritical Marks//EN//XML"
+"ent/iso-dia.ent">
+%ISOdia;
+<!--end of ISOdia.module-->]]>
+
+<!ENTITY % ISOgrk1.module "INCLUDE">
+<![%ISOgrk1.module;[
+<!ENTITY % ISOgrk1 PUBLIC
+"ISO 8879:1986//ENTITIES Greek Letters//EN//XML"
+"ent/iso-grk1.ent">
+%ISOgrk1;
+<!--end of ISOgrk1.module-->]]>
+
+<!ENTITY % ISOgrk2.module "INCLUDE">
+<![%ISOgrk2.module;[
+<!ENTITY % ISOgrk2 PUBLIC
+"ISO 8879:1986//ENTITIES Monotoniko Greek//EN//XML"
+"ent/iso-grk2.ent">
+%ISOgrk2;
+<!--end of ISOgrk2.module-->]]>
+
+<!ENTITY % ISOgrk3.module "INCLUDE">
+<![%ISOgrk3.module;[
+<!ENTITY % ISOgrk3 PUBLIC
+"ISO 8879:1986//ENTITIES Greek Symbols//EN//XML"
+"ent/iso-grk3.ent">
+%ISOgrk3;
+<!--end of ISOgrk3.module-->]]>
+
+<!ENTITY % ISOgrk4.module "INCLUDE">
+<![%ISOgrk4.module;[
+<!ENTITY % ISOgrk4 PUBLIC
+"ISO 8879:1986//ENTITIES Alternative Greek Symbols//EN//XML"
+"ent/iso-grk4.ent">
+%ISOgrk4;
+<!--end of ISOgrk4.module-->]]>
+
+<!ENTITY % ISOlat1.module "INCLUDE">
+<![%ISOlat1.module;[
+<!ENTITY % ISOlat1 PUBLIC
+"ISO 8879:1986//ENTITIES Added Latin 1//EN//XML"
+"ent/iso-lat1.ent">
+%ISOlat1;
+<!--end of ISOlat1.module-->]]>
+
+<!ENTITY % ISOlat2.module "INCLUDE">
+<![%ISOlat2.module;[
+<!ENTITY % ISOlat2 PUBLIC
+"ISO 8879:1986//ENTITIES Added Latin 2//EN//XML"
+"ent/iso-lat2.ent">
+%ISOlat2;
+<!--end of ISOlat2.module-->]]>
+
+<!ENTITY % ISOnum.module "INCLUDE">
+<![%ISOnum.module;[
+<!ENTITY % ISOnum PUBLIC
+"ISO 8879:1986//ENTITIES Numeric and Special Graphic//EN//XML"
+"ent/iso-num.ent">
+%ISOnum;
+<!--end of ISOnum.module-->]]>
+
+<!ENTITY % ISOpub.module "INCLUDE">
+<![%ISOpub.module;[
+<!ENTITY % ISOpub PUBLIC
+"ISO 8879:1986//ENTITIES Publishing//EN//XML"
+"ent/iso-pub.ent">
+%ISOpub;
+<!--end of ISOpub.module-->]]>
+
+<!ENTITY % ISOtech.module "INCLUDE">
+<![%ISOtech.module;[
+<!ENTITY % ISOtech PUBLIC
+"ISO 8879:1986//ENTITIES General Technical//EN//XML"
+"ent/iso-tech.ent">
+%ISOtech;
+<!--end of ISOtech.module-->]]>
+
+<!-- End of DocBook XML character entity sets module V4.1.2 ................. -->
+<!-- ...................................................................... -->
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-amsa.ent b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-amsa.ent
new file mode 100644
index 000000000..beb34bfda
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-amsa.ent
@@ -0,0 +1,98 @@
+<!-- ...................................................................... -->
+<!-- ISO Added Math Symbols: Arrow Relations Entities V0.3 ................ -->
+<!-- File iso-amsa.ent .................................................... -->
+
+<!-- Copyright (C) 2001, 2002 Organization for the Advancement of Structured
+ Information Standards (OASIS).
+
+ $Id: iso-amsa.ent,v 1.1 2008-05-27 19:26:06 jsumali Exp $
+
+ Permission to use, copy, modify and distribute this entity set
+ 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 make no representation about the suitability of
+ the entities for any purpose. It is provided "as is" without
+ expressed or implied warranty.
+
+ Please direct all questions, bug reports, or suggestions for
+ changes to the docbook@lists.oasis-open.org mailing list. For more
+ information, see http://www.oasis-open.org/docbook/.
+
+ Derived, in part, from:
+
+ * iso-amsa.gml
+
+ Copyright (C) 1986 International Organization for Standardization
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+
+ * http://www.tug.org/applications/jadetex/unicode.xml
+
+ * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MISC/SGML.TXT
+
+ Please use the following formal public identifier to identify it:
+
+ ISO 8879:1986//ENTITIES Added Math Symbols: Arrow Relations//EN//XML
+-->
+
+<!ENTITY cularr "&#x21B6;"> <!-- ANTICLOCKWISE TOP SEMICIRCLE ARROW -->
+<!ENTITY curarr "&#x21B7;"> <!-- CLOCKWISE TOP SEMICIRCLE ARROW -->
+<!ENTITY dArr "&#x21D3;"> <!-- DOWNWARDS DOUBLE ARROW -->
+<!ENTITY darr2 "&#x21CA;"> <!-- DOWNWARDS PAIRED ARROWS -->
+<!ENTITY dharl "&#x21C3;"> <!-- DOWNWARDS HARPOON WITH BARB LEFTWARDS -->
+<!ENTITY dharr "&#x21C2;"> <!-- DOWNWARDS HARPOON WITH BARB RIGHTWARDS -->
+<!ENTITY lAarr "&#x21DA;"> <!-- LEFTWARDS TRIPLE ARROW -->
+<!ENTITY Larr "&#x219E;"> <!-- LEFTWARDS TWO HEADED ARROW -->
+<!ENTITY larr2 "&#x21C7;"> <!-- LEFTWARDS PAIRED ARROWS -->
+<!ENTITY larrhk "&#x21A9;"> <!-- LEFTWARDS ARROW WITH HOOK -->
+<!ENTITY larrlp "&#x21AB;"> <!-- LEFTWARDS ARROW WITH LOOP -->
+<!ENTITY larrtl "&#x21A2;"> <!-- LEFTWARDS ARROW WITH TAIL -->
+<!ENTITY lhard "&#x21BD;"> <!-- LEFTWARDS HARPOON WITH BARB DOWNWARDS -->
+<!ENTITY lharu "&#x21BC;"> <!-- LEFTWARDS HARPOON WITH BARB UPWARDS -->
+<!ENTITY hArr "&#x21D4;"> <!-- -->
+<!ENTITY harr "&#x2194;"> <!-- LEFT RIGHT ARROW -->
+<!ENTITY lrarr2 "&#x21C6;"> <!-- LEFTWARDS ARROW OVER RIGHTWARDS ARROW -->
+<!ENTITY rlarr2 "&#x21C4;"> <!-- RIGHTWARDS ARROW OVER LEFTWARDS ARROW -->
+<!ENTITY harrw "&#x21AD;"> <!-- LEFT RIGHT WAVE ARROW -->
+<!ENTITY rlhar2 "&#x21CC;"> <!-- RIGHTWARDS HARPOON OVER LEFTWARDS HARPOON -->
+<!ENTITY lrhar2 "&#x21CB;"> <!-- LEFTWARDS HARPOON OVER RIGHTWARDS HARPOON -->
+<!ENTITY lsh "&#x21B0;"> <!-- UPWARDS ARROW WITH TIP LEFTWARDS -->
+<!ENTITY map "&#x21A6;"> <!-- RIGHTWARDS ARROW FROM BAR -->
+<!ENTITY mumap "&#x22B8;"> <!-- MULTIMAP -->
+<!ENTITY nearr "&#x2197;"> <!-- NORTH EAST ARROW -->
+<!ENTITY nlArr "&#x21CD;"> <!-- LEFTWARDS DOUBLE ARROW WITH STROKE -->
+<!ENTITY nlarr "&#x219A;"> <!-- LEFTWARDS ARROW WITH STROKE -->
+<!ENTITY nhArr "&#x21CE;"> <!-- LEFT RIGHT DOUBLE ARROW WITH STROKE -->
+<!ENTITY nharr "&#x21AE;"> <!-- LEFT RIGHT ARROW WITH STROKE -->
+<!ENTITY nrarr "&#x219B;"> <!-- RIGHTWARDS ARROW WITH STROKE -->
+<!ENTITY nrArr "&#x21CF;"> <!-- RIGHTWARDS DOUBLE ARROW WITH STROKE -->
+<!ENTITY nwarr "&#x2196;"> <!-- NORTH WEST ARROW -->
+<!ENTITY olarr "&#x21BA;"> <!-- ANTICLOCKWISE OPEN CIRCLE ARROW -->
+<!ENTITY orarr "&#x21BB;"> <!-- CLOCKWISE OPEN CIRCLE ARROW -->
+<!ENTITY rAarr "&#x21DB;"> <!-- RIGHTWARDS TRIPLE ARROW -->
+<!ENTITY Rarr "&#x21A0;"> <!-- RIGHTWARDS TWO HEADED ARROW -->
+<!ENTITY rarr2 "&#x21C9;"> <!-- RIGHTWARDS PAIRED ARROWS -->
+<!ENTITY rarrhk "&#x21AA;"> <!-- RIGHTWARDS ARROW WITH HOOK -->
+<!ENTITY rarrlp "&#x21AC;"> <!-- RIGHTWARDS ARROW WITH LOOP -->
+<!ENTITY rarrtl "&#x21A3;"> <!-- RIGHTWARDS ARROW WITH TAIL -->
+<!ENTITY rarrw "&#x219D;"> <!-- RIGHTWARDS SQUIGGLE ARROW -->
+<!ENTITY rhard "&#x21C1;"> <!-- RIGHTWARDS HARPOON WITH BARB DOWNWARDS -->
+<!ENTITY rharu "&#x21C0;"> <!-- RIGHTWARDS HARPOON WITH BARB UPWARDS -->
+<!ENTITY rsh "&#x21B1;"> <!-- UPWARDS ARROW WITH TIP RIGHTWARDS -->
+<!ENTITY drarr "&#x2198;"> <!-- SOUTH EAST ARROW -->
+<!ENTITY dlarr "&#x2199;"> <!-- SOUTH WEST ARROW -->
+<!ENTITY uArr "&#x21D1;"> <!-- UPWARDS DOUBLE ARROW -->
+<!ENTITY uarr2 "&#x21C8;"> <!-- UPWARDS PAIRED ARROWS -->
+<!ENTITY vArr "&#x21D5;"> <!-- UP DOWN DOUBLE ARROW -->
+<!ENTITY varr "&#x2195;"> <!-- UP DOWN ARROW -->
+<!ENTITY uharl "&#x21BF;"> <!-- UPWARDS HARPOON WITH BARB LEFTWARDS -->
+<!ENTITY uharr "&#x21BE;"> <!-- UPWARDS HARPOON WITH BARB RIGHTWARDS -->
+<!ENTITY xlArr "&#x21D0;"> <!-- LEFTWARDS DOUBLE ARROW -->
+<!ENTITY xhArr "&#x2194;"> <!-- LEFT RIGHT ARROW -->
+<!ENTITY xharr "&#x2194;"> <!-- LEFT RIGHT ARROW -->
+<!ENTITY xrArr "&#x21D2;"> <!-- RIGHTWARDS DOUBLE ARROW -->
+
+<!-- End of Added Math Symbols: Arrow Relations Entities V0.3 ............. -->
+<!-- ...................................................................... -->
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-amsb.ent b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-amsb.ent
new file mode 100644
index 000000000..cc8b5b533
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-amsb.ent
@@ -0,0 +1,84 @@
+<!-- ...................................................................... -->
+<!-- ISO Added Math Symbols: Binary Operators Entities V0.3 ............... -->
+<!-- File iso-amsb.ent .................................................... -->
+
+<!-- Copyright (C) 2001, 2002 Organization for the Advancement of Structured
+ Information Standards (OASIS).
+
+ $Id: iso-amsb.ent,v 1.1 2008-05-27 19:26:06 jsumali Exp $
+
+ Permission to use, copy, modify and distribute this entity set
+ 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 make no representation about the suitability of
+ the entities for any purpose. It is provided "as is" without
+ expressed or implied warranty.
+
+ Please direct all questions, bug reports, or suggestions for
+ changes to the docbook@lists.oasis-open.org mailing list. For more
+ information, see http://www.oasis-open.org/docbook/.
+
+ Derived, in part, from:
+
+ * iso-amsb.gml
+
+ Copyright (C) 1986 International Organization for Standardization
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+
+ * http://www.tug.org/applications/jadetex/unicode.xml
+
+ * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MISC/SGML.TXT
+
+ Please use the following formal public identifier to identify it:
+
+ ISO 8879:1986//ENTITIES Added Math Symbols: Binary Operators//EN//XML
+-->
+
+<!ENTITY amalg "&#x2210;"> <!-- N-ARY COPRODUCT -->
+<!ENTITY Barwed "&#x2306;"> <!-- PERSPECTIVE -->
+<!ENTITY barwed "&#x22BC;"> <!-- NAND -->
+<!ENTITY Cap "&#x22D2;"> <!-- DOUBLE INTERSECTION -->
+<!ENTITY Cup "&#x22D3;"> <!-- DOUBLE UNION -->
+<!ENTITY cuvee "&#x22CE;"> <!-- CURLY LOGICAL OR -->
+<!ENTITY cuwed "&#x22CF;"> <!-- CURLY LOGICAL AND -->
+<!ENTITY diam "&#x22C4;"> <!-- DIAMOND OPERATOR -->
+<!ENTITY divonx "&#x22C7;"> <!-- DIVISION TIMES -->
+<!ENTITY intcal "&#x22BA;"> <!-- INTERCALATE -->
+<!ENTITY lthree "&#x22CB;"> <!-- LEFT SEMIDIRECT PRODUCT -->
+<!ENTITY ltimes "&#x22C9;"> <!-- LEFT NORMAL FACTOR SEMIDIRECT PRODUCT -->
+<!ENTITY minusb "&#x229F;"> <!-- SQUARED MINUS -->
+<!ENTITY oast "&#x229B;"> <!-- CIRCLED ASTERISK OPERATOR -->
+<!ENTITY ocir "&#x229A;"> <!-- CIRCLED RING OPERATOR -->
+<!ENTITY odash "&#x229D;"> <!-- CIRCLED DASH -->
+<!ENTITY odot "&#x2299;"> <!-- CIRCLED DOT OPERATOR -->
+<!ENTITY ominus "&#x2296;"> <!-- CIRCLED MINUS -->
+<!ENTITY oplus "&#x2295;"> <!-- CIRCLED PLUS -->
+<!ENTITY osol "&#x2298;"> <!-- CIRCLED DIVISION SLASH -->
+<!ENTITY otimes "&#x2297;"> <!-- CIRCLED TIMES -->
+<!ENTITY plusb "&#x229E;"> <!-- SQUARED PLUS -->
+<!ENTITY plusdo "&#x2214;"> <!-- DOT PLUS -->
+<!ENTITY rthree "&#x22CC;"> <!-- RIGHT SEMIDIRECT PRODUCT -->
+<!ENTITY rtimes "&#x22CA;"> <!-- RIGHT NORMAL FACTOR SEMIDIRECT PRODUCT -->
+<!ENTITY sdot "&#x22C5;"> <!-- DOT OPERATOR -->
+<!ENTITY sdotb "&#x22A1;"> <!-- SQUARED DOT OPERATOR -->
+<!ENTITY setmn "&#x2216;"> <!-- SET MINUS -->
+<!ENTITY sqcap "&#x2293;"> <!-- SQUARE CAP -->
+<!ENTITY sqcup "&#x2294;"> <!-- SQUARE CUP -->
+<!ENTITY ssetmn "&#x2216;"> <!-- SET MINUS -->
+<!ENTITY sstarf "&#x22C6;"> <!-- STAR OPERATOR -->
+<!ENTITY timesb "&#x22A0;"> <!-- SQUARED TIMES -->
+<!ENTITY top "&#x22A4;"> <!-- DOWN TACK -->
+<!ENTITY uplus "&#x228E;"> <!-- MULTISET UNION -->
+<!ENTITY wreath "&#x2240;"> <!-- WREATH PRODUCT -->
+<!ENTITY xcirc "&#x25CB;"> <!-- WHITE CIRCLE -->
+<!ENTITY xdtri "&#x25BD;"> <!-- WHITE DOWN-POINTING TRIANGLE -->
+<!ENTITY xutri "&#x25B3;"> <!-- WHITE UP-POINTING TRIANGLE -->
+<!ENTITY coprod "&#x2210;"> <!-- N-ARY COPRODUCT -->
+<!ENTITY prod "&#x220F;"> <!-- N-ARY PRODUCT -->
+<!ENTITY sum "&#x2211;"> <!-- N-ARY SUMMATION -->
+
+<!-- End of Added Math Symbols: Binary Operators Entities V0.3 ............ -->
+<!-- ...................................................................... -->
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-amsc.ent b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-amsc.ent
new file mode 100644
index 000000000..0d4990f54
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-amsc.ent
@@ -0,0 +1,52 @@
+<!-- ...................................................................... -->
+<!-- ISO Added Math Symbols: Delimiters Entities V0.3 ..................... -->
+<!-- File iso-amsc.ent .................................................... -->
+
+<!-- Copyright (C) 2001, 2002 Organization for the Advancement of Structured
+ Information Standards (OASIS).
+
+ $Id: iso-amsc.ent,v 1.1 2008-05-27 19:26:06 jsumali Exp $
+
+ Permission to use, copy, modify and distribute this entity set
+ 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 make no representation about the suitability of
+ the entities for any purpose. It is provided "as is" without
+ expressed or implied warranty.
+
+ Please direct all questions, bug reports, or suggestions for
+ changes to the docbook@lists.oasis-open.org mailing list. For more
+ information, see http://www.oasis-open.org/docbook/.
+
+ Derived, in part, from:
+
+ * iso-amsc.gml
+
+ Copyright (C) 1986 International Organization for Standardization
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+
+ * http://www.tug.org/applications/jadetex/unicode.xml
+
+ * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MISC/SGML.TXT
+
+ Please use the following formal public identifier to identify it:
+
+ ISO 8879:1986//ENTITIES Added Math Symbols: Delimiters//EN//XML
+-->
+
+<!ENTITY rceil "&#x2309;"> <!-- RIGHT CEILING -->
+<!ENTITY rfloor "&#x230B;"> <!-- RIGHT FLOOR -->
+<!ENTITY rpargt "&#xE291;"> <!-- -->
+<!ENTITY urcorn "&#x231D;"> <!-- TOP RIGHT CORNER -->
+<!ENTITY drcorn "&#x231F;"> <!-- BOTTOM RIGHT CORNER -->
+<!ENTITY lceil "&#x2308;"> <!-- LEFT CEILING -->
+<!ENTITY lfloor "&#x230A;"> <!-- LEFT FLOOR -->
+<!-- lpargt Unknown unicode character -->
+<!ENTITY ulcorn "&#x231C;"> <!-- TOP LEFT CORNER -->
+<!ENTITY dlcorn "&#x231E;"> <!-- BOTTOM LEFT CORNER -->
+
+<!-- End of Added Math Symbols: Delimiters Entities V0.3 .................. -->
+<!-- ...................................................................... -->
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-amsn.ent b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-amsn.ent
new file mode 100644
index 000000000..9906bde8c
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-amsn.ent
@@ -0,0 +1,101 @@
+<!-- ...................................................................... -->
+<!-- ISO Added Math Symbols: Negated Relations Entities V0.3 .............. -->
+<!-- File iso-amsn.ent .................................................... -->
+
+<!-- Copyright (C) 2001, 2002 Organization for the Advancement of Structured
+ Information Standards (OASIS).
+
+ $Id: iso-amsn.ent,v 1.1 2008-05-27 19:26:06 jsumali Exp $
+
+ Permission to use, copy, modify and distribute this entity set
+ 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 make no representation about the suitability of
+ the entities for any purpose. It is provided "as is" without
+ expressed or implied warranty.
+
+ Please direct all questions, bug reports, or suggestions for
+ changes to the docbook@lists.oasis-open.org mailing list. For more
+ information, see http://www.oasis-open.org/docbook/.
+
+ Derived, in part, from:
+
+ * iso-amsn.gml
+
+ Copyright (C) 1986 International Organization for Standardization
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+
+ * http://www.tug.org/applications/jadetex/unicode.xml
+
+ * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MISC/SGML.TXT
+
+ Please use the following formal public identifier to identify it:
+
+ ISO 8879:1986//ENTITIES Added Math Symbols: Negated Relations//EN//XML
+-->
+
+<!ENTITY gnap "&#xE411;"> <!-- -->
+<!ENTITY gne "&#x2269;"> <!-- -->
+<!ENTITY gnE "&#x2269;"> <!-- -->
+<!ENTITY gnsim "&#x22E7;"> <!-- GREATER-THAN BUT NOT EQUIVALENT TO -->
+<!ENTITY gvnE "&#x2269;"> <!-- GREATER-THAN BUT NOT EQUAL TO -->
+<!ENTITY lnap "&#xE2A2;"> <!-- -->
+<!ENTITY lnE "&#x2268;"> <!-- -->
+<!ENTITY lne "&#x2268;"> <!-- -->
+<!ENTITY lnsim "&#x22E6;"> <!-- -->
+<!ENTITY lvnE "&#x2268;"> <!-- LESS-THAN BUT NOT EQUAL TO -->
+<!ENTITY nap "&#x2249;"> <!-- NOT ALMOST EQUAL TO -->
+<!ENTITY ncong "&#x2247;"> <!-- NEITHER APPROXIMATELY NOR ACTUALLY EQUAL TO -->
+<!ENTITY nequiv "&#x2262;"> <!-- NOT IDENTICAL TO -->
+<!ENTITY ngE "&#x2271;"> <!-- -->
+<!ENTITY nge "&#x2271;"> <!-- NEITHER GREATER-THAN NOR EQUAL TO -->
+<!ENTITY nges "&#x2271;"> <!-- -->
+<!ENTITY ngt "&#x226F;"> <!-- NOT GREATER-THAN -->
+<!ENTITY nle "&#x2270;"> <!-- NEITHER LESS-THAN NOR EQUAL TO -->
+<!ENTITY nlE "&#x2270;"> <!-- -->
+<!ENTITY nles "&#x2270;"> <!-- -->
+<!ENTITY nlt "&#x226E;"> <!-- NOT LESS-THAN -->
+<!ENTITY nltri "&#x22EA;"> <!-- NOT NORMAL SUBGROUP OF -->
+<!ENTITY nltrie "&#x22EC;"> <!-- NOT NORMAL SUBGROUP OF OR EQUAL TO -->
+<!ENTITY nmid "&#x2224;"> <!-- DOES NOT DIVIDE -->
+<!ENTITY npar "&#x2226;"> <!-- NOT PARALLEL TO -->
+<!ENTITY npr "&#x2280;"> <!-- DOES NOT PRECEDE -->
+<!ENTITY npre "&#x22E0;"> <!-- DOES NOT PRECEDE OR EQUAL -->
+<!ENTITY nrtri "&#x22EB;"> <!-- DOES NOT CONTAIN AS NORMAL SUBGROUP -->
+<!ENTITY nrtrie "&#x22ED;"> <!-- DOES NOT CONTAIN AS NORMAL SUBGROUP OR EQUAL -->
+<!ENTITY nsc "&#x2281;"> <!-- DOES NOT SUCCEED -->
+<!ENTITY nsce "&#x22E1;"> <!-- DOES NOT SUCCEED OR EQUAL -->
+<!ENTITY nsim "&#x2241;"> <!-- -->
+<!ENTITY nsime "&#x2244;"> <!-- -->
+<!ENTITY nsmid "&#xE2AA;"> <!-- -->
+<!ENTITY nspar "&#x2226;"> <!-- NOT PARALLEL TO -->
+<!ENTITY nsub "&#x2284;"> <!-- NOT A SUBSET OF -->
+<!ENTITY nsube "&#x2288;"> <!-- -->
+<!ENTITY nsubE "&#x2288;"> <!-- -->
+<!ENTITY nsup "&#x2285;"> <!-- NOT A SUPERSET OF -->
+<!ENTITY nsupE "&#x2289;"> <!-- -->
+<!ENTITY nsupe "&#x2289;"> <!-- -->
+<!ENTITY nvdash "&#x22AC;"> <!-- DOES NOT PROVE -->
+<!ENTITY nvDash "&#x22AD;"> <!-- NOT TRUE -->
+<!ENTITY nVDash "&#x22AF;"> <!-- NEGATED DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE -->
+<!ENTITY nVdash "&#x22AE;"> <!-- DOES NOT FORCE -->
+<!ENTITY prnap "&#x22E8;"> <!-- -->
+<!ENTITY prnE "&#xE2B3;"> <!-- -->
+<!ENTITY prnsim "&#x22E8;"> <!-- -->
+<!ENTITY scnap "&#x22E9;"> <!-- -->
+<!ENTITY scnE "&#xE2B5;"> <!-- -->
+<!ENTITY scnsim "&#x22E9;"> <!-- -->
+<!ENTITY subne "&#x228A;"> <!-- -->
+<!ENTITY subnE "&#x228A;"> <!-- SUBSET OF WITH NOT EQUAL TO -->
+<!ENTITY supne "&#x228B;"> <!-- -->
+<!ENTITY supnE "&#x228B;"> <!-- -->
+<!ENTITY vsubnE "&#xE2B8;"> <!-- -->
+<!ENTITY vsubne "&#x228A;"> <!-- SUBSET OF WITH NOT EQUAL TO -->
+<!ENTITY vsupne "&#x228B;"> <!-- SUPERSET OF WITH NOT EQUAL TO -->
+<!ENTITY vsupnE "&#x228B;"> <!-- SUPERSET OF WITH NOT EQUAL TO -->
+
+<!-- End of ISO Added Math Symbols: Negated Relations Entities V0.3 ....... -->
+<!-- ...................................................................... -->
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-amso.ent b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-amso.ent
new file mode 100644
index 000000000..f972ffd88
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-amso.ent
@@ -0,0 +1,68 @@
+<!-- ...................................................................... -->
+<!-- ISO Added Math Symbols: Ordinary Entities V0.3 ....................... -->
+<!-- File iso-amso.ent .................................................... -->
+
+<!-- Copyright (C) 2001, 2002 Organization for the Advancement of Structured
+ Information Standards (OASIS).
+
+ $Id: iso-amso.ent,v 1.1 2008-05-27 19:26:06 jsumali Exp $
+
+ Permission to use, copy, modify and distribute this entity set
+ 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 make no representation about the suitability of
+ the entities for any purpose. It is provided "as is" without
+ expressed or implied warranty.
+
+ Please direct all questions, bug reports, or suggestions for
+ changes to the docbook@lists.oasis-open.org mailing list. For more
+ information, see http://www.oasis-open.org/docbook/.
+
+ Derived, in part, from:
+
+ * iso-amso.gml
+
+ Copyright (C) 1986 International Organization for Standardization
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+
+ * http://www.tug.org/applications/jadetex/unicode.xml
+
+ * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MISC/SGML.TXT
+
+ Please use the following formal public identifier to identify it:
+
+ ISO 8879:1986//ENTITIES Added Math Symbols: Ordinary//EN//XML
+-->
+
+<!-- iso-amso.ent (initially distributed with DocBook XML DTD V4.1.1beta1) -->
+
+<!-- Derived from the corresponding ISO 8879 standard entity set
+ and the Unicode character mappings provided by Sebastian Rahtz
+ With additional derivations from
+ ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MISC/SGML.TXT -->
+
+<!ENTITY ang "&#x2220;"> <!-- ANGLE -->
+<!ENTITY angmsd "&#x2221;"> <!-- MEASURED ANGLE -->
+<!ENTITY beth "&#x2136;"> <!-- BET SYMBOL -->
+<!ENTITY bprime "&#x2035;"> <!-- REVERSED PRIME -->
+<!ENTITY comp "&#x2201;"> <!-- COMPLEMENT -->
+<!ENTITY daleth "&#x2138;"> <!-- DALET SYMBOL -->
+<!ENTITY ell "&#x2113;"> <!-- SCRIPT SMALL L -->
+<!ENTITY empty "&#x2205;"> <!-- -->
+<!ENTITY gimel "&#x2137;"> <!-- GIMEL SYMBOL -->
+<!ENTITY image "&#x2111;"> <!-- BLACK-LETTER CAPITAL I -->
+<!ENTITY inodot "&#x0131;"> <!-- LATIN SMALL LETTER DOTLESS I -->
+<!-- jnodot Unknown unicode character -->
+<!ENTITY nexist "&#x2204;"> <!-- THERE DOES NOT EXIST -->
+<!ENTITY oS "&#x24C8;"> <!-- CIRCLED LATIN CAPITAL LETTER S -->
+<!ENTITY planck "&#x210F;"> <!-- PLANCK CONSTANT OVER TWO PI -->
+<!ENTITY real "&#x211C;"> <!-- BLACK-LETTER CAPITAL R -->
+<!ENTITY sbsol "&#xFE68;"> <!-- SMALL REVERSE SOLIDUS -->
+<!ENTITY vprime "&#x2032;"> <!-- PRIME -->
+<!ENTITY weierp "&#x2118;"> <!-- SCRIPT CAPITAL P -->
+
+<!-- End of ISO Added Math Symbols: Ordinary Entities V0.3 ................ -->
+<!-- ...................................................................... -->
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-amsr.ent b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-amsr.ent
new file mode 100644
index 000000000..c09c33bea
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-amsr.ent
@@ -0,0 +1,126 @@
+<!-- ...................................................................... -->
+<!-- ISO Added Math Symbols: Relations Entities V0.3 ...................... -->
+<!-- File iso-amsr.ent .................................................... -->
+
+<!-- Copyright (C) 2001, 2002 Organization for the Advancement of Structured
+ Information Standards (OASIS).
+
+ $Id: iso-amsr.ent,v 1.1 2008-05-27 19:26:06 jsumali Exp $
+
+ Permission to use, copy, modify and distribute this entity set
+ 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 make no representation about the suitability of
+ the entities for any purpose. It is provided "as is" without
+ expressed or implied warranty.
+
+ Please direct all questions, bug reports, or suggestions for
+ changes to the docbook@lists.oasis-open.org mailing list. For more
+ information, see http://www.oasis-open.org/docbook/.
+
+ Derived, in part, from:
+
+ * iso-amsr.gml
+
+ Copyright (C) 1986 International Organization for Standardization
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+
+ * http://www.tug.org/applications/jadetex/unicode.xml
+
+ * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MISC/SGML.TXT
+
+ Please use the following formal public identifier to identify it:
+
+ ISO 8879:1986//ENTITIES Added Math Symbols: Relations//EN//XML
+-->
+
+<!ENTITY ape "&#x224A;"> <!-- -->
+<!ENTITY asymp "&#x224D;"> <!-- EQUIVALENT TO -->
+<!ENTITY bcong "&#x224C;"> <!-- ALL EQUAL TO -->
+<!ENTITY bepsi "&#x220D;"> <!-- SMALL CONTAINS AS MEMBER -->
+<!ENTITY bowtie "&#x22C8;"> <!-- -->
+<!ENTITY bsim "&#x223D;"> <!-- -->
+<!ENTITY bsime "&#x22CD;"> <!-- -->
+<!ENTITY bump "&#x224E;"> <!-- -->
+<!ENTITY bumpe "&#x224F;"> <!-- -->
+<!ENTITY cire "&#x2257;"> <!-- -->
+<!ENTITY colone "&#x2254;"> <!-- -->
+<!ENTITY cuepr "&#x22DE;"> <!-- -->
+<!ENTITY cuesc "&#x22DF;"> <!-- -->
+<!ENTITY cupre "&#x227C;"> <!-- -->
+<!ENTITY dashv "&#x22A3;"> <!-- -->
+<!ENTITY ecir "&#x2256;"> <!-- -->
+<!ENTITY ecolon "&#x2255;"> <!-- -->
+<!ENTITY eDot "&#x2251;"> <!-- -->
+<!ENTITY esdot "&#x2250;"> <!-- -->
+<!ENTITY efDot "&#x2252;"> <!-- -->
+<!ENTITY egs "&#x22DD;"> <!-- -->
+<!ENTITY els "&#x22DC;"> <!-- -->
+<!ENTITY erDot "&#x2253;"> <!-- -->
+<!ENTITY fork "&#x22D4;"> <!-- -->
+<!ENTITY frown "&#x2322;"> <!-- -->
+<!ENTITY gap "&#x2273;"> <!-- GREATER-THAN OR EQUIVALENT TO -->
+<!ENTITY gsdot "&#x22D7;"> <!-- -->
+<!ENTITY gE "&#x2267;"> <!-- -->
+<!ENTITY gel "&#x22DB;"> <!-- -->
+<!ENTITY gEl "&#x22DB;"> <!-- -->
+<!ENTITY ges "&#x2265;"> <!-- GREATER-THAN OR EQUAL TO -->
+<!ENTITY Gg "&#x22D9;"> <!-- VERY MUCH GREATER-THAN -->
+<!ENTITY gl "&#x2277;"> <!-- -->
+<!ENTITY gsim "&#x2273;"> <!-- GREATER-THAN OR EQUIVALENT TO -->
+<!ENTITY Gt "&#x226B;"> <!-- MUCH GREATER-THAN -->
+<!ENTITY lap "&#x2272;"> <!-- LESS-THAN OR EQUIVALENT TO -->
+<!ENTITY ldot "&#x22D6;"> <!-- -->
+<!ENTITY lE "&#x2266;"> <!-- -->
+<!ENTITY lEg "&#x22DA;"> <!-- -->
+<!ENTITY leg "&#x22DA;"> <!-- -->
+<!ENTITY les "&#x2264;"> <!-- LESS-THAN OR EQUAL TO -->
+<!ENTITY lg "&#x2276;"> <!-- LESS-THAN OR GREATER-THAN -->
+<!ENTITY Ll "&#x22D8;"> <!-- -->
+<!ENTITY lsim "&#x2272;"> <!-- LESS-THAN OR EQUIVALENT TO -->
+<!ENTITY Lt "&#x226A;"> <!-- MUCH LESS-THAN -->
+<!ENTITY ltrie "&#x22B4;"> <!-- -->
+<!ENTITY mid "&#x2223;"> <!-- -->
+<!ENTITY models "&#x22A7;"> <!-- MODELS -->
+<!ENTITY pr "&#x227A;"> <!-- -->
+<!ENTITY prap "&#x227E;"> <!-- -->
+<!ENTITY pre "&#x227C;"> <!-- -->
+<!ENTITY prsim "&#x227E;"> <!-- -->
+<!ENTITY rtrie "&#x22B5;"> <!-- -->
+<!ENTITY samalg "&#x2210;"> <!-- -->
+<!ENTITY sc "&#x227B;"> <!-- -->
+<!ENTITY scap "&#x227F;"> <!-- -->
+<!ENTITY sccue "&#x227D;"> <!-- -->
+<!ENTITY sce "&#x227D;"> <!-- -->
+<!ENTITY scsim "&#x227F;"> <!-- -->
+<!ENTITY sfrown "&#x2322;"> <!-- FROWN -->
+<!ENTITY smid "&#xE301;"> <!-- -->
+<!ENTITY smile "&#x2323;"> <!-- -->
+<!ENTITY spar "&#x2225;"> <!-- PARALLEL TO -->
+<!ENTITY sqsub "&#x228F;"> <!-- -->
+<!ENTITY sqsube "&#x2291;"> <!-- -->
+<!ENTITY sqsup "&#x2290;"> <!-- -->
+<!ENTITY sqsupe "&#x2292;"> <!-- -->
+<!ENTITY ssmile "&#x2323;"> <!-- SMILE -->
+<!ENTITY Sub "&#x22D0;"> <!-- -->
+<!ENTITY subE "&#x2286;"> <!-- -->
+<!ENTITY Sup "&#x22D1;"> <!-- -->
+<!ENTITY supE "&#x2287;"> <!-- -->
+<!ENTITY thkap "&#x2248;"> <!-- ALMOST EQUAL TO -->
+<!ENTITY thksim "&#x223C;"> <!-- TILDE OPERATOR -->
+<!ENTITY trie "&#x225C;"> <!-- -->
+<!ENTITY twixt "&#x226C;"> <!-- BETWEEN -->
+<!ENTITY vdash "&#x22A2;"> <!-- -->
+<!ENTITY Vdash "&#x22A9;"> <!-- -->
+<!ENTITY vDash "&#x22A8;"> <!-- -->
+<!ENTITY veebar "&#x22BB;"> <!-- -->
+<!ENTITY vltri "&#x22B2;"> <!-- -->
+<!ENTITY vprop "&#x221D;"> <!-- -->
+<!ENTITY vrtri "&#x22B3;"> <!-- -->
+<!ENTITY Vvdash "&#x22AA;"> <!-- -->
+
+<!-- End of ISO Added Math Symbols: Relations Entities V0.3 ............... -->
+<!-- ...................................................................... -->
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-box.ent b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-box.ent
new file mode 100644
index 000000000..456c43441
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-box.ent
@@ -0,0 +1,82 @@
+<!-- ...................................................................... -->
+<!-- ISO Box and Line Drawing Entities V0.3 ............................... -->
+<!-- File iso-box.ent ..................................................... -->
+
+<!-- Copyright (C) 2001, 2002 Organization for the Advancement of Structured
+ Information Standards (OASIS).
+
+ $Id: iso-box.ent,v 1.1 2008-05-27 19:26:06 jsumali Exp $
+
+ Permission to use, copy, modify and distribute this entity set
+ 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 make no representation about the suitability of
+ the entities for any purpose. It is provided "as is" without
+ expressed or implied warranty.
+
+ Please direct all questions, bug reports, or suggestions for
+ changes to the docbook@lists.oasis-open.org mailing list. For more
+ information, see http://www.oasis-open.org/docbook/.
+
+ Derived, in part, from:
+
+ * iso-box.gml
+
+ Copyright (C) 1986 International Organization for Standardization
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+
+ * http://www.tug.org/applications/jadetex/unicode.xml
+
+ * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MISC/SGML.TXT
+
+ Please use the following formal public identifier to identify it:
+
+ ISO 8879:1986//ENTITIES Box and Line Drawing//EN//XML
+-->
+
+<!ENTITY boxh "&#x2500;"> <!-- BOX DRAWINGS LIGHT HORIZONTAL -->
+<!ENTITY boxv "&#x2502;"> <!-- BOX DRAWINGS LIGHT VERTICAL -->
+<!ENTITY boxur "&#x2514;"> <!-- BOX DRAWINGS LIGHT UP AND RIGHT -->
+<!ENTITY boxul "&#x2518;"> <!-- BOX DRAWINGS LIGHT UP AND LEFT -->
+<!ENTITY boxdl "&#x2510;"> <!-- BOX DRAWINGS LIGHT DOWN AND LEFT -->
+<!ENTITY boxdr "&#x250C;"> <!-- BOX DRAWINGS LIGHT DOWN AND RIGHT -->
+<!ENTITY boxvr "&#x251C;"> <!-- BOX DRAWINGS LIGHT VERTICAL AND RIGHT -->
+<!ENTITY boxhu "&#x2534;"> <!-- BOX DRAWINGS LIGHT UP AND HORIZONTAL -->
+<!ENTITY boxvl "&#x2524;"> <!-- BOX DRAWINGS LIGHT VERTICAL AND LEFT -->
+<!ENTITY boxhd "&#x252C;"> <!-- BOX DRAWINGS LIGHT DOWN AND HORIZONTAL -->
+<!ENTITY boxvh "&#x253C;"> <!-- BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL -->
+<!ENTITY boxvR "&#x255E;"> <!-- BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE -->
+<!ENTITY boxhU "&#x2567;"> <!-- BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE -->
+<!ENTITY boxvL "&#x2561;"> <!-- BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE -->
+<!ENTITY boxhD "&#x2564;"> <!-- BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE -->
+<!ENTITY boxvH "&#x256A;"> <!-- BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE -->
+<!ENTITY boxH "&#x2550;"> <!-- BOX DRAWINGS DOUBLE HORIZONTAL -->
+<!ENTITY boxV "&#x2551;"> <!-- BOX DRAWINGS DOUBLE VERTICAL -->
+<!ENTITY boxUR "&#x2558;"> <!-- BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE -->
+<!ENTITY boxUL "&#x255B;"> <!-- BOX DRAWINGS UP SINGLE AND LEFT DOUBLE -->
+<!ENTITY boxDL "&#x2555;"> <!-- BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE -->
+<!ENTITY boxDR "&#x2552;"> <!-- BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE -->
+<!ENTITY boxVR "&#x255F;"> <!-- BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE -->
+<!ENTITY boxHU "&#x2568;"> <!-- BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE -->
+<!ENTITY boxVL "&#x2562;"> <!-- BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE -->
+<!ENTITY boxHD "&#x2565;"> <!-- BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE -->
+<!ENTITY boxVH "&#x256B;"> <!-- BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE -->
+<!ENTITY boxVr "&#x2560;"> <!-- BOX DRAWINGS DOUBLE VERTICAL AND RIGHT -->
+<!ENTITY boxHu "&#x2569;"> <!-- BOX DRAWINGS DOUBLE UP AND HORIZONTAL -->
+<!ENTITY boxVl "&#x2563;"> <!-- BOX DRAWINGS DOUBLE VERTICAL AND LEFT -->
+<!ENTITY boxHd "&#x2566;"> <!-- BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL -->
+<!ENTITY boxVh "&#x256C;"> <!-- BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL -->
+<!ENTITY boxuR "&#x2559;"> <!-- BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE -->
+<!ENTITY boxUl "&#x255C;"> <!-- BOX DRAWINGS UP DOUBLE AND LEFT SINGLE -->
+<!ENTITY boxdL "&#x2556;"> <!-- BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE -->
+<!ENTITY boxDr "&#x2553;"> <!-- BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE -->
+<!ENTITY boxUr "&#x255A;"> <!-- BOX DRAWINGS DOUBLE UP AND RIGHT -->
+<!ENTITY boxuL "&#x255D;"> <!-- BOX DRAWINGS DOUBLE UP AND LEFT -->
+<!ENTITY boxDl "&#x2557;"> <!-- BOX DRAWINGS DOUBLE DOWN AND LEFT -->
+<!ENTITY boxdR "&#x2554;"> <!-- BOX DRAWINGS DOUBLE DOWN AND RIGHT -->
+
+<!-- End of ISO Box and Line Drawing Entities V0.3 ........................ -->
+<!-- ...................................................................... -->
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-cyr1.ent b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-cyr1.ent
new file mode 100644
index 000000000..1caf86b85
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-cyr1.ent
@@ -0,0 +1,109 @@
+<!-- ...................................................................... -->
+<!-- ISO Russian Cyrillic Entities V0.3 ................................... -->
+<!-- File iso-cyr1.ent .................................................... -->
+
+<!-- Copyright (C) 2001, 2002 Organization for the Advancement of Structured
+ Information Standards (OASIS).
+
+ $Id: iso-cyr1.ent,v 1.1 2008-05-27 19:26:06 jsumali Exp $
+
+ Permission to use, copy, modify and distribute this entity set
+ 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 make no representation about the suitability of
+ the entities for any purpose. It is provided "as is" without
+ expressed or implied warranty.
+
+ Please direct all questions, bug reports, or suggestions for
+ changes to the docbook@lists.oasis-open.org mailing list. For more
+ information, see http://www.oasis-open.org/docbook/.
+
+ Derived, in part, from:
+
+ * iso-cyr1.gml
+
+ Copyright (C) 1986 International Organization for Standardization
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+
+ * http://www.tug.org/applications/jadetex/unicode.xml
+
+ * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MISC/SGML.TXT
+
+ Please use the following formal public identifier to identify it:
+
+ ISO 8879:1986//ENTITIES Russian Cyrillic//EN//XML
+-->
+
+<!ENTITY acy "&#x0430;"> <!-- CYRILLIC SMALL LETTER A -->
+<!ENTITY Acy "&#x0410;"> <!-- CYRILLIC CAPITAL LETTER A -->
+<!ENTITY bcy "&#x0431;"> <!-- CYRILLIC SMALL LETTER BE -->
+<!ENTITY Bcy "&#x0411;"> <!-- CYRILLIC CAPITAL LETTER BE -->
+<!ENTITY vcy "&#x0432;"> <!-- CYRILLIC SMALL LETTER VE -->
+<!ENTITY Vcy "&#x0412;"> <!-- CYRILLIC CAPITAL LETTER VE -->
+<!ENTITY gcy "&#x0433;"> <!-- CYRILLIC SMALL LETTER GHE -->
+<!ENTITY Gcy "&#x0413;"> <!-- CYRILLIC CAPITAL LETTER GHE -->
+<!ENTITY dcy "&#x0434;"> <!-- CYRILLIC SMALL LETTER DE -->
+<!ENTITY Dcy "&#x0414;"> <!-- CYRILLIC CAPITAL LETTER DE -->
+<!ENTITY iecy "&#x0435;"> <!-- CYRILLIC SMALL LETTER IE -->
+<!ENTITY IEcy "&#x0415;"> <!-- CYRILLIC CAPITAL LETTER IE -->
+<!ENTITY iocy "&#x0451;"> <!-- CYRILLIC SMALL LETTER IO -->
+<!ENTITY IOcy "&#x0401;"> <!-- CYRILLIC CAPITAL LETTER IO -->
+<!ENTITY zhcy "&#x0436;"> <!-- CYRILLIC SMALL LETTER ZHE -->
+<!ENTITY ZHcy "&#x0416;"> <!-- CYRILLIC CAPITAL LETTER ZHE -->
+<!ENTITY zcy "&#x0437;"> <!-- CYRILLIC SMALL LETTER ZE -->
+<!ENTITY Zcy "&#x0417;"> <!-- CYRILLIC CAPITAL LETTER ZE -->
+<!ENTITY icy "&#x0438;"> <!-- CYRILLIC SMALL LETTER I -->
+<!ENTITY Icy "&#x0418;"> <!-- CYRILLIC CAPITAL LETTER I -->
+<!ENTITY jcy "&#x0439;"> <!-- CYRILLIC SMALL LETTER SHORT I -->
+<!ENTITY Jcy "&#x0419;"> <!-- CYRILLIC CAPITAL LETTER SHORT I -->
+<!ENTITY kcy "&#x043A;"> <!-- CYRILLIC SMALL LETTER KA -->
+<!ENTITY Kcy "&#x041A;"> <!-- CYRILLIC CAPITAL LETTER KA -->
+<!ENTITY lcy "&#x043B;"> <!-- CYRILLIC SMALL LETTER EL -->
+<!ENTITY Lcy "&#x041B;"> <!-- CYRILLIC CAPITAL LETTER EL -->
+<!ENTITY mcy "&#x043C;"> <!-- CYRILLIC SMALL LETTER EM -->
+<!ENTITY Mcy "&#x041C;"> <!-- CYRILLIC CAPITAL LETTER EM -->
+<!ENTITY ncy "&#x043D;"> <!-- CYRILLIC SMALL LETTER EN -->
+<!ENTITY Ncy "&#x041D;"> <!-- CYRILLIC CAPITAL LETTER EN -->
+<!ENTITY ocy "&#x043E;"> <!-- CYRILLIC SMALL LETTER O -->
+<!ENTITY Ocy "&#x041E;"> <!-- CYRILLIC CAPITAL LETTER O -->
+<!ENTITY pcy "&#x043F;"> <!-- CYRILLIC SMALL LETTER PE -->
+<!ENTITY Pcy "&#x041F;"> <!-- CYRILLIC CAPITAL LETTER PE -->
+<!ENTITY rcy "&#x0440;"> <!-- CYRILLIC SMALL LETTER ER -->
+<!ENTITY Rcy "&#x0420;"> <!-- CYRILLIC CAPITAL LETTER ER -->
+<!ENTITY scy "&#x0441;"> <!-- CYRILLIC SMALL LETTER ES -->
+<!ENTITY Scy "&#x0421;"> <!-- CYRILLIC CAPITAL LETTER ES -->
+<!ENTITY tcy "&#x0442;"> <!-- CYRILLIC SMALL LETTER TE -->
+<!ENTITY Tcy "&#x0422;"> <!-- CYRILLIC CAPITAL LETTER TE -->
+<!ENTITY ucy "&#x0443;"> <!-- CYRILLIC SMALL LETTER U -->
+<!ENTITY Ucy "&#x0423;"> <!-- CYRILLIC CAPITAL LETTER U -->
+<!ENTITY fcy "&#x0444;"> <!-- CYRILLIC SMALL LETTER EF -->
+<!ENTITY Fcy "&#x0424;"> <!-- CYRILLIC CAPITAL LETTER EF -->
+<!ENTITY khcy "&#x0445;"> <!-- CYRILLIC SMALL LETTER HA -->
+<!ENTITY KHcy "&#x0425;"> <!-- CYRILLIC CAPITAL LETTER HA -->
+<!ENTITY tscy "&#x0446;"> <!-- CYRILLIC SMALL LETTER TSE -->
+<!ENTITY TScy "&#x0426;"> <!-- CYRILLIC CAPITAL LETTER TSE -->
+<!ENTITY chcy "&#x0447;"> <!-- CYRILLIC SMALL LETTER CHE -->
+<!ENTITY CHcy "&#x0427;"> <!-- CYRILLIC CAPITAL LETTER CHE -->
+<!ENTITY shcy "&#x0448;"> <!-- CYRILLIC SMALL LETTER SHA -->
+<!ENTITY SHcy "&#x0428;"> <!-- CYRILLIC CAPITAL LETTER SHA -->
+<!ENTITY shchcy "&#x0449;"> <!-- CYRILLIC SMALL LETTER SHCHA -->
+<!ENTITY SHCHcy "&#x0429;"> <!-- CYRILLIC CAPITAL LETTER SHCHA -->
+<!ENTITY hardcy "&#x044A;"> <!-- CYRILLIC SMALL LETTER HARD SIGN -->
+<!ENTITY HARDcy "&#x042A;"> <!-- CYRILLIC CAPITAL LETTER HARD SIGN -->
+<!ENTITY ycy "&#x044B;"> <!-- CYRILLIC SMALL LETTER YERU -->
+<!ENTITY Ycy "&#x042B;"> <!-- CYRILLIC CAPITAL LETTER YERU -->
+<!ENTITY softcy "&#x044C;"> <!-- CYRILLIC SMALL LETTER SOFT SIGN -->
+<!ENTITY SOFTcy "&#x042C;"> <!-- CYRILLIC CAPITAL LETTER SOFT SIGN -->
+<!ENTITY ecy "&#x044D;"> <!-- CYRILLIC SMALL LETTER E -->
+<!ENTITY Ecy "&#x042D;"> <!-- CYRILLIC CAPITAL LETTER E -->
+<!ENTITY yucy "&#x044E;"> <!-- CYRILLIC SMALL LETTER YU -->
+<!ENTITY YUcy "&#x042E;"> <!-- CYRILLIC CAPITAL LETTER YU -->
+<!ENTITY yacy "&#x044F;"> <!-- CYRILLIC SMALL LETTER YA -->
+<!ENTITY YAcy "&#x042F;"> <!-- CYRILLIC CAPITAL LETTER YA -->
+<!ENTITY numero "&#x2116;"> <!-- NUMERO SIGN -->
+
+<!-- End of ISO Russian Cyrillic Entities V0.3 ............................ -->
+<!-- ...................................................................... -->
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-cyr2.ent b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-cyr2.ent
new file mode 100644
index 000000000..07d61e0ea
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-cyr2.ent
@@ -0,0 +1,68 @@
+<!-- ...................................................................... -->
+<!-- ISO Non-Russian Cyrillic Entities V0.3 ............................... -->
+<!-- File iso-cyr2.ent .................................................... -->
+
+<!-- Copyright (C) 2001, 2002 Organization for the Advancement of Structured
+ Information Standards (OASIS).
+
+ $Id: iso-cyr2.ent,v 1.1 2008-05-27 19:26:07 jsumali Exp $
+
+ Permission to use, copy, modify and distribute this entity set
+ 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 make no representation about the suitability of
+ the entities for any purpose. It is provided "as is" without
+ expressed or implied warranty.
+
+ Please direct all questions, bug reports, or suggestions for
+ changes to the docbook@lists.oasis-open.org mailing list. For more
+ information, see http://www.oasis-open.org/docbook/.
+
+ Derived, in part, from:
+
+ * iso-cyr2.gml
+
+ Copyright (C) 1986 International Organization for Standardization
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+
+ * http://www.tug.org/applications/jadetex/unicode.xml
+
+ * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MISC/SGML.TXT
+
+ Please use the following formal public identifier to identify it:
+
+ ISO 8879:1986//ENTITIES Non-Russian Cyrillic//EN//XML
+-->
+
+<!ENTITY djcy "&#x0452;"> <!-- CYRILLIC SMALL LETTER DJE -->
+<!ENTITY DJcy "&#x0402;"> <!-- CYRILLIC CAPITAL LETTER DJE -->
+<!ENTITY gjcy "&#x0453;"> <!-- CYRILLIC SMALL LETTER GJE -->
+<!ENTITY GJcy "&#x0403;"> <!-- CYRILLIC CAPITAL LETTER GJE -->
+<!ENTITY jukcy "&#x0454;"> <!-- CYRILLIC SMALL LETTER UKRAINIAN IE -->
+<!ENTITY Jukcy "&#x0404;"> <!-- CYRILLIC CAPITAL LETTER UKRAINIAN IE -->
+<!ENTITY dscy "&#x0455;"> <!-- CYRILLIC SMALL LETTER DZE -->
+<!ENTITY DScy "&#x0405;"> <!-- CYRILLIC CAPITAL LETTER DZE -->
+<!ENTITY iukcy "&#x0456;"> <!-- CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I -->
+<!ENTITY Iukcy "&#x0406;"> <!-- CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I -->
+<!ENTITY yicy "&#x0457;"> <!-- CYRILLIC SMALL LETTER YI -->
+<!ENTITY YIcy "&#x0407;"> <!-- CYRILLIC CAPITAL LETTER YI -->
+<!ENTITY jsercy "&#x0458;"> <!-- CYRILLIC SMALL LETTER JE -->
+<!ENTITY Jsercy "&#x0408;"> <!-- CYRILLIC CAPITAL LETTER JE -->
+<!ENTITY ljcy "&#x0459;"> <!-- CYRILLIC SMALL LETTER LJE -->
+<!ENTITY LJcy "&#x0409;"> <!-- CYRILLIC CAPITAL LETTER LJE -->
+<!ENTITY njcy "&#x045A;"> <!-- CYRILLIC SMALL LETTER NJE -->
+<!ENTITY NJcy "&#x040A;"> <!-- CYRILLIC CAPITAL LETTER NJE -->
+<!ENTITY tshcy "&#x045B;"> <!-- CYRILLIC SMALL LETTER TSHE -->
+<!ENTITY TSHcy "&#x040B;"> <!-- CYRILLIC CAPITAL LETTER TSHE -->
+<!ENTITY kjcy "&#x045C;"> <!-- CYRILLIC SMALL LETTER KJE -->
+<!ENTITY KJcy "&#x040C;"> <!-- CYRILLIC CAPITAL LETTER KJE -->
+<!ENTITY ubrcy "&#x045E;"> <!-- CYRILLIC SMALL LETTER SHORT U -->
+<!ENTITY Ubrcy "&#x040E;"> <!-- CYRILLIC CAPITAL LETTER SHORT U -->
+<!ENTITY dzcy "&#x045F;"> <!-- CYRILLIC SMALL LETTER DZHE -->
+<!ENTITY DZcy "&#x040F;"> <!-- CYRILLIC CAPITAL LETTER DZHE -->
+
+<!-- End of ISO Non-Russian Cyrillic Entities V0.3 ........................ -->
+<!-- ...................................................................... -->
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-dia.ent b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-dia.ent
new file mode 100644
index 000000000..3e1fe7645
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-dia.ent
@@ -0,0 +1,56 @@
+<!-- ...................................................................... -->
+<!-- ISO Diacritical Marks Entities V0.3 .................................. -->
+<!-- File iso-dia.ent ..................................................... -->
+
+<!-- Copyright (C) 2001, 2002 Organization for the Advancement of Structured
+ Information Standards (OASIS).
+
+ $Id: iso-dia.ent,v 1.1 2008-05-27 19:26:07 jsumali Exp $
+
+ Permission to use, copy, modify and distribute this entity set
+ 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 make no representation about the suitability of
+ the entities for any purpose. It is provided "as is" without
+ expressed or implied warranty.
+
+ Please direct all questions, bug reports, or suggestions for
+ changes to the docbook@lists.oasis-open.org mailing list. For more
+ information, see http://www.oasis-open.org/docbook/.
+
+ Derived, in part, from:
+
+ * iso-dia.gml
+
+ Copyright (C) 1986 International Organization for Standardization
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+
+ * http://www.tug.org/applications/jadetex/unicode.xml
+
+ * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MISC/SGML.TXT
+
+ Please use the following formal public identifier to identify it:
+
+ ISO 8879:1986//ENTITIES Diacritical Marks//EN//XML
+-->
+
+<!ENTITY acute "&#x00B4;"> <!-- ACUTE ACCENT -->
+<!ENTITY breve "&#x02D8;"> <!-- BREVE -->
+<!ENTITY caron "&#x02C7;"> <!-- CARON -->
+<!ENTITY cedil "&#x00B8;"> <!-- CEDILLA -->
+<!ENTITY circ "&#x005E;"> <!-- RING OPERATOR -->
+<!ENTITY dblac "&#x02DD;"> <!-- DOUBLE ACUTE ACCENT -->
+<!ENTITY die "&#x00A8;"> <!-- -->
+<!ENTITY dot "&#x02D9;"> <!-- DOT ABOVE -->
+<!ENTITY grave "&#x0060;"> <!-- GRAVE ACCENT -->
+<!ENTITY macr "&#x00AF;"> <!-- MACRON -->
+<!ENTITY ogon "&#x02DB;"> <!-- OGONEK -->
+<!ENTITY ring "&#x02DA;"> <!-- RING ABOVE -->
+<!ENTITY tilde "&#x02DC;"> <!-- TILDE -->
+<!ENTITY uml "&#x00A8;"> <!-- -->
+
+<!-- End of ISO Diacritical Marks Entities V0.3 ........................... -->
+<!-- ...................................................................... -->
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-grk1.ent b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-grk1.ent
new file mode 100644
index 000000000..9c85b5710
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-grk1.ent
@@ -0,0 +1,91 @@
+<!-- ...................................................................... -->
+<!-- ISO Greek Letters Entities V0.3 ...................................... -->
+<!-- File iso-grk1.ent .................................................... -->
+
+<!-- Copyright (C) 2001, 2002 Organization for the Advancement of Structured
+ Information Standards (OASIS).
+
+ $Id: iso-grk1.ent,v 1.1 2008-05-27 19:26:07 jsumali Exp $
+
+ Permission to use, copy, modify and distribute this entity set
+ 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 make no representation about the suitability of
+ the entities for any purpose. It is provided "as is" without
+ expressed or implied warranty.
+
+ Please direct all questions, bug reports, or suggestions for
+ changes to the docbook@lists.oasis-open.org mailing list. For more
+ information, see http://www.oasis-open.org/docbook/.
+
+ Derived, in part, from:
+
+ * iso-grk1.gml
+
+ Copyright (C) 1986 International Organization for Standardization
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+
+ * http://www.tug.org/applications/jadetex/unicode.xml
+
+ * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MISC/SGML.TXT
+
+ Please use the following formal public identifier to identify it:
+
+ ISO 8879:1986//ENTITIES Greek Letters//EN//XML
+-->
+
+<!ENTITY agr "&#x03B1;"> <!-- -->
+<!ENTITY Agr "&#x0391;"> <!-- GREEK CAPITAL LETTER ALPHA -->
+<!ENTITY bgr "&#x03B2;"> <!-- GREEK SMALL LETTER BETA -->
+<!ENTITY Bgr "&#x0392;"> <!-- GREEK CAPITAL LETTER BETA -->
+<!ENTITY ggr "&#x03B3;"> <!-- GREEK SMALL LETTER GAMMA -->
+<!ENTITY Ggr "&#x0393;"> <!-- GREEK CAPITAL LETTER GAMMA -->
+<!ENTITY dgr "&#x03B4;"> <!-- GREEK SMALL LETTER DELTA -->
+<!ENTITY Dgr "&#x0394;"> <!-- GREEK CAPITAL LETTER DELTA -->
+<!ENTITY egr "&#x03B5;"> <!-- -->
+<!ENTITY Egr "&#x0395;"> <!-- GREEK CAPITAL LETTER EPSILON -->
+<!ENTITY zgr "&#x03B6;"> <!-- GREEK SMALL LETTER ZETA -->
+<!ENTITY Zgr "&#x0396;"> <!-- GREEK CAPITAL LETTER ZETA -->
+<!ENTITY eegr "&#x03B7;"> <!-- GREEK SMALL LETTER ETA -->
+<!ENTITY EEgr "&#x0397;"> <!-- GREEK CAPITAL LETTER ETA -->
+<!ENTITY thgr "&#x03B8;"> <!-- -->
+<!ENTITY THgr "&#x0398;"> <!-- GREEK CAPITAL LETTER THETA -->
+<!ENTITY igr "&#x03B9;"> <!-- GREEK SMALL LETTER IOTA -->
+<!ENTITY Igr "&#x0399;"> <!-- GREEK CAPITAL LETTER IOTA -->
+<!ENTITY kgr "&#x03BA;"> <!-- GREEK SMALL LETTER KAPPA -->
+<!ENTITY Kgr "&#x039A;"> <!-- GREEK CAPITAL LETTER KAPPA -->
+<!ENTITY lgr "&#x03BB;"> <!-- GREEK SMALL LETTER LAMDA -->
+<!ENTITY Lgr "&#x039B;"> <!-- GREEK CAPITAL LETTER LAMDA -->
+<!ENTITY mgr "&#x03BC;"> <!-- GREEK SMALL LETTER MU -->
+<!ENTITY Mgr "&#x039C;"> <!-- GREEK CAPITAL LETTER MU -->
+<!ENTITY ngr "&#x03BD;"> <!-- GREEK SMALL LETTER NU -->
+<!ENTITY Ngr "&#x039D;"> <!-- GREEK CAPITAL LETTER NU -->
+<!ENTITY xgr "&#x03BE;"> <!-- GREEK SMALL LETTER XI -->
+<!ENTITY Xgr "&#x039E;"> <!-- GREEK CAPITAL LETTER XI -->
+<!ENTITY ogr "&#x03BF;"> <!-- GREEK SMALL LETTER OMICRON -->
+<!ENTITY Ogr "&#x039F;"> <!-- GREEK CAPITAL LETTER OMICRON -->
+<!ENTITY pgr "&#x03C0;"> <!-- GREEK SMALL LETTER PI -->
+<!ENTITY Pgr "&#x03A0;"> <!-- GREEK CAPITAL LETTER PI -->
+<!ENTITY rgr "&#x03C1;"> <!-- GREEK SMALL LETTER RHO -->
+<!ENTITY Rgr "&#x03A1;"> <!-- GREEK CAPITAL LETTER RHO -->
+<!ENTITY sgr "&#x03C3;"> <!-- GREEK SMALL LETTER SIGMA -->
+<!ENTITY Sgr "&#x03A3;"> <!-- GREEK CAPITAL LETTER SIGMA -->
+<!ENTITY sfgr "&#x03C2;"> <!-- -->
+<!ENTITY tgr "&#x03C4;"> <!-- GREEK SMALL LETTER TAU -->
+<!ENTITY Tgr "&#x03A4;"> <!-- GREEK CAPITAL LETTER TAU -->
+<!ENTITY ugr "&#x03C5;"> <!-- GREEK SMALL LETTER UPSILON -->
+<!ENTITY Ugr "&#x03A5;"> <!-- -->
+<!ENTITY phgr "&#x03C6;"> <!-- GREEK SMALL LETTER PHI -->
+<!ENTITY PHgr "&#x03A6;"> <!-- GREEK CAPITAL LETTER PHI -->
+<!ENTITY khgr "&#x03C7;"> <!-- GREEK SMALL LETTER CHI -->
+<!ENTITY KHgr "&#x03A7;"> <!-- GREEK CAPITAL LETTER CHI -->
+<!ENTITY psgr "&#x03C8;"> <!-- GREEK SMALL LETTER PSI -->
+<!ENTITY PSgr "&#x03A8;"> <!-- GREEK CAPITAL LETTER PSI -->
+<!ENTITY ohgr "&#x03C9;"> <!-- GREEK SMALL LETTER OMEGA -->
+<!ENTITY OHgr "&#x03A9;"> <!-- GREEK CAPITAL LETTER OMEGA -->
+
+<!-- End of ISO Greek Letters V0.3 ........................................ -->
+<!-- ...................................................................... -->
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-grk2.ent b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-grk2.ent
new file mode 100644
index 000000000..3809376a4
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-grk2.ent
@@ -0,0 +1,62 @@
+<!-- ...................................................................... -->
+<!-- ISO Monotoniko Greek Entities V0.3 ................................... -->
+<!-- File iso-grk2.ent .................................................... -->
+
+<!-- Copyright (C) 2001, 2002 Organization for the Advancement of Structured
+ Information Standards (OASIS).
+
+ $Id: iso-grk2.ent,v 1.1 2008-05-27 19:26:07 jsumali Exp $
+
+ Permission to use, copy, modify and distribute this entity set
+ 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 make no representation about the suitability of
+ the entities for any purpose. It is provided "as is" without
+ expressed or implied warranty.
+
+ Please direct all questions, bug reports, or suggestions for
+ changes to the docbook@lists.oasis-open.org mailing list. For more
+ information, see http://www.oasis-open.org/docbook/.
+
+ Derived, in part, from:
+
+ * iso-grk2.gml
+
+ Copyright (C) 1986 International Organization for Standardization
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+
+ * http://www.tug.org/applications/jadetex/unicode.xml
+
+ * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MISC/SGML.TXT
+
+ Please use the following formal public identifier to identify it:
+
+ ISO 8879:1986//ENTITIES Monotoniko Greek//EN//XML
+-->
+
+<!ENTITY aacgr "&#x03AC;"> <!-- GREEK SMALL LETTER ALPHA WITH TONOS -->
+<!ENTITY Aacgr "&#x0386;"> <!-- GREEK CAPITAL LETTER ALPHA WITH TONOS -->
+<!ENTITY eacgr "&#x03AD;"> <!-- GREEK SMALL LETTER EPSILON WITH TONOS -->
+<!ENTITY Eacgr "&#x0388;"> <!-- GREEK CAPITAL LETTER EPSILON WITH TONOS -->
+<!ENTITY eeacgr "&#x03AE;"> <!-- GREEK SMALL LETTER ETA WITH TONOS -->
+<!ENTITY EEacgr "&#x0389;"> <!-- GREEK CAPITAL LETTER ETA WITH TONOS -->
+<!ENTITY idigr "&#x03CA;"> <!-- GREEK SMALL LETTER IOTA WITH DIALYTIKA -->
+<!ENTITY Idigr "&#x03AA;"> <!-- GREEK CAPITAL LETTER IOTA WITH DIALYTIKA -->
+<!ENTITY iacgr "&#x03AF;"> <!-- GREEK SMALL LETTER IOTA WITH TONOS -->
+<!ENTITY Iacgr "&#x038A;"> <!-- GREEK CAPITAL LETTER IOTA WITH TONOS -->
+<!ENTITY idiagr "&#x0390;"> <!-- GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS -->
+<!ENTITY oacgr "&#x03CC;"> <!-- GREEK SMALL LETTER OMICRON WITH TONOS -->
+<!ENTITY Oacgr "&#x038C;"> <!-- GREEK CAPITAL LETTER OMICRON WITH TONOS -->
+<!ENTITY udigr "&#x03CB;"> <!-- GREEK SMALL LETTER UPSILON WITH DIALYTIKA -->
+<!ENTITY Udigr "&#x03AB;"> <!-- GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA -->
+<!ENTITY uacgr "&#x03CD;"> <!-- GREEK SMALL LETTER UPSILON WITH TONOS -->
+<!ENTITY Uacgr "&#x038E;"> <!-- GREEK CAPITAL LETTER UPSILON WITH TONOS -->
+<!ENTITY udiagr "&#x03B0;"> <!-- GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS -->
+<!ENTITY ohacgr "&#x03CE;"> <!-- GREEK SMALL LETTER OMEGA WITH TONOS -->
+<!ENTITY OHacgr "&#x038F;"> <!-- GREEK CAPITAL LETTER OMEGA WITH TONOS -->
+
+<!-- End of ISO Monotoniko Greek Entities V0.3 ............................ -->
+<!-- ...................................................................... -->
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-grk3.ent b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-grk3.ent
new file mode 100644
index 000000000..8ca2d4387
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-grk3.ent
@@ -0,0 +1,85 @@
+<!-- ...................................................................... -->
+<!-- ISO Greek Symbols Entities V0.3 ...................................... -->
+<!-- File iso-grk3.ent .................................................... -->
+
+<!-- Copyright (C) 2001, 2002 Organization for the Advancement of Structured
+ Information Standards (OASIS).
+
+ $Id: iso-grk3.ent,v 1.1 2008-05-27 19:26:07 jsumali Exp $
+
+ Permission to use, copy, modify and distribute this entity set
+ 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 make no representation about the suitability of
+ the entities for any purpose. It is provided "as is" without
+ expressed or implied warranty.
+
+ Please direct all questions, bug reports, or suggestions for
+ changes to the docbook@lists.oasis-open.org mailing list. For more
+ information, see http://www.oasis-open.org/docbook/.
+
+ Derived, in part, from:
+
+ * iso-grk3.gml
+
+ Copyright (C) 1986 International Organization for Standardization
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+
+ * http://www.tug.org/applications/jadetex/unicode.xml
+
+ * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MISC/SGML.TXT
+
+ Please use the following formal public identifier to identify it:
+
+ ISO 8879:1986//ENTITIES Greek Symbols//EN//XML
+-->
+
+<!ENTITY alpha "&#x03B1;"> <!-- -->
+<!ENTITY beta "&#x03B2;"> <!-- GREEK SMALL LETTER BETA -->
+<!ENTITY gamma "&#x03B3;"> <!-- GREEK SMALL LETTER GAMMA -->
+<!ENTITY Gamma "&#x0393;"> <!-- GREEK CAPITAL LETTER GAMMA -->
+<!ENTITY gammad "&#x03DC;"> <!-- GREEK LETTER DIGAMMA -->
+<!ENTITY delta "&#x03B4;"> <!-- GREEK SMALL LETTER DELTA -->
+<!ENTITY Delta "&#x0394;"> <!-- GREEK CAPITAL LETTER DELTA -->
+<!ENTITY epsi "&#x220A;"> <!-- -->
+<!ENTITY epsiv "&#x03B5;"> <!-- -->
+<!ENTITY epsis "&#x220A;"> <!-- -->
+<!ENTITY zeta "&#x03B6;"> <!-- GREEK SMALL LETTER ZETA -->
+<!ENTITY eta "&#x03B7;"> <!-- GREEK SMALL LETTER ETA -->
+<!ENTITY thetas "&#x03B8;"> <!-- -->
+<!ENTITY Theta "&#x0398;"> <!-- GREEK CAPITAL LETTER THETA -->
+<!ENTITY thetav "&#x03D1;"> <!-- -->
+<!ENTITY iota "&#x03B9;"> <!-- GREEK SMALL LETTER IOTA -->
+<!ENTITY kappa "&#x03BA;"> <!-- GREEK SMALL LETTER KAPPA -->
+<!ENTITY kappav "&#x03F0;"> <!-- GREEK KAPPA SYMBOL -->
+<!ENTITY lambda "&#x03BB;"> <!-- GREEK SMALL LETTER LAMDA -->
+<!ENTITY Lambda "&#x039B;"> <!-- GREEK CAPITAL LETTER LAMDA -->
+<!ENTITY mu "&#x03BC;"> <!-- GREEK SMALL LETTER MU -->
+<!ENTITY nu "&#x03BD;"> <!-- GREEK SMALL LETTER NU -->
+<!ENTITY xi "&#x03BE;"> <!-- GREEK SMALL LETTER XI -->
+<!ENTITY Xi "&#x039E;"> <!-- GREEK CAPITAL LETTER XI -->
+<!ENTITY pi "&#x03C0;"> <!-- GREEK SMALL LETTER PI -->
+<!ENTITY piv "&#x03D6;"> <!-- GREEK PI SYMBOL -->
+<!ENTITY Pi "&#x03A0;"> <!-- GREEK CAPITAL LETTER PI -->
+<!ENTITY rho "&#x03C1;"> <!-- GREEK SMALL LETTER RHO -->
+<!ENTITY rhov "&#x03F1;"> <!-- GREEK RHO SYMBOL -->
+<!ENTITY sigma "&#x03C3;"> <!-- GREEK SMALL LETTER SIGMA -->
+<!ENTITY Sigma "&#x03A3;"> <!-- GREEK CAPITAL LETTER SIGMA -->
+<!ENTITY sigmav "&#x03C2;"> <!-- -->
+<!ENTITY tau "&#x03C4;"> <!-- GREEK SMALL LETTER TAU -->
+<!ENTITY upsi "&#x03C5;"> <!-- GREEK SMALL LETTER UPSILON -->
+<!ENTITY Upsi "&#x03D2;"> <!-- -->
+<!ENTITY phis "&#x03C6;"> <!-- GREEK SMALL LETTER PHI -->
+<!ENTITY Phi "&#x03A6;"> <!-- GREEK CAPITAL LETTER PHI -->
+<!ENTITY phiv "&#x03D5;"> <!-- GREEK PHI SYMBOL -->
+<!ENTITY chi "&#x03C7;"> <!-- GREEK SMALL LETTER CHI -->
+<!ENTITY psi "&#x03C8;"> <!-- GREEK SMALL LETTER PSI -->
+<!ENTITY Psi "&#x03A8;"> <!-- GREEK CAPITAL LETTER PSI -->
+<!ENTITY omega "&#x03C9;"> <!-- GREEK SMALL LETTER OMEGA -->
+<!ENTITY Omega "&#x03A9;"> <!-- GREEK CAPITAL LETTER OMEGA -->
+
+<!-- End of ISO Greek Symbols Entities V0.3 ............................... -->
+<!-- ...................................................................... -->
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-grk4.ent b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-grk4.ent
new file mode 100644
index 000000000..93956dc76
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-grk4.ent
@@ -0,0 +1,85 @@
+<!-- ...................................................................... -->
+<!-- ISO Alternative Greek Symbols Entities V0.3 .......................... -->
+<!-- File iso-grk4.ent .................................................... -->
+
+<!-- Copyright (C) 2001, 2002 Organization for the Advancement of Structured
+ Information Standards (OASIS).
+
+ $Id: iso-grk4.ent,v 1.1 2008-05-27 19:26:07 jsumali Exp $
+
+ Permission to use, copy, modify and distribute this entity set
+ 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 make no representation about the suitability of
+ the entities for any purpose. It is provided "as is" without
+ expressed or implied warranty.
+
+ Please direct all questions, bug reports, or suggestions for
+ changes to the docbook@lists.oasis-open.org mailing list. For more
+ information, see http://www.oasis-open.org/docbook/.
+
+ Derived, in part, from:
+
+ * iso-grk4.gml
+
+ Copyright (C) 1986 International Organization for Standardization
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+
+ * http://www.tug.org/applications/jadetex/unicode.xml
+
+ * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MISC/SGML.TXT
+
+ Please use the following formal public identifier to identify it:
+
+ ISO 8879:1986//ENTITIES Alternative Greek Symbols//EN//XML
+-->
+
+<!ENTITY b.alpha "&#x03B1;"> <!-- -->
+<!ENTITY b.beta "&#x03B2;"> <!-- GREEK SMALL LETTER BETA -->
+<!ENTITY b.gamma "&#x03B3;"> <!-- GREEK SMALL LETTER GAMMA -->
+<!ENTITY b.Gamma "&#x0393;"> <!-- GREEK CAPITAL LETTER GAMMA -->
+<!ENTITY b.gammad "&#x03DC;"> <!-- GREEK LETTER DIGAMMA -->
+<!ENTITY b.delta "&#x03B4;"> <!-- GREEK SMALL LETTER DELTA -->
+<!ENTITY b.Delta "&#x0394;"> <!-- GREEK CAPITAL LETTER DELTA -->
+<!ENTITY b.epsi "&#x03B5;"> <!-- -->
+<!ENTITY b.epsiv "&#x03B5;"> <!-- -->
+<!ENTITY b.epsis "&#x03B5;"> <!-- -->
+<!ENTITY b.zeta "&#x03B6;"> <!-- GREEK SMALL LETTER ZETA -->
+<!ENTITY b.eta "&#x03B7;"> <!-- GREEK SMALL LETTER ETA -->
+<!ENTITY b.thetas "&#x03B8;"> <!-- -->
+<!ENTITY b.Theta "&#x0398;"> <!-- GREEK CAPITAL LETTER THETA -->
+<!ENTITY b.thetav "&#x03D1;"> <!-- -->
+<!ENTITY b.iota "&#x03B9;"> <!-- GREEK SMALL LETTER IOTA -->
+<!ENTITY b.kappa "&#x03BA;"> <!-- GREEK SMALL LETTER KAPPA -->
+<!ENTITY b.kappav "&#x03F0;"> <!-- GREEK KAPPA SYMBOL -->
+<!ENTITY b.lambda "&#x03BB;"> <!-- GREEK SMALL LETTER LAMDA -->
+<!ENTITY b.Lambda "&#x039B;"> <!-- GREEK CAPITAL LETTER LAMDA -->
+<!ENTITY b.mu "&#x03BC;"> <!-- GREEK SMALL LETTER MU -->
+<!ENTITY b.nu "&#x03BD;"> <!-- GREEK SMALL LETTER NU -->
+<!ENTITY b.xi "&#x03BE;"> <!-- GREEK SMALL LETTER XI -->
+<!ENTITY b.Xi "&#x039E;"> <!-- GREEK CAPITAL LETTER XI -->
+<!ENTITY b.pi "&#x03C0;"> <!-- GREEK SMALL LETTER PI -->
+<!ENTITY b.Pi "&#x03A0;"> <!-- GREEK CAPITAL LETTER PI -->
+<!ENTITY b.piv "&#x03D6;"> <!-- GREEK PI SYMBOL -->
+<!ENTITY b.rho "&#x03C1;"> <!-- GREEK SMALL LETTER RHO -->
+<!ENTITY b.rhov "&#x03F1;"> <!-- GREEK RHO SYMBOL -->
+<!ENTITY b.sigma "&#x03C3;"> <!-- GREEK SMALL LETTER SIGMA -->
+<!ENTITY b.Sigma "&#x03A3;"> <!-- GREEK CAPITAL LETTER SIGMA -->
+<!ENTITY b.sigmav "&#x03C2;"> <!-- -->
+<!ENTITY b.tau "&#x03C4;"> <!-- GREEK SMALL LETTER TAU -->
+<!ENTITY b.upsi "&#x03C5;"> <!-- GREEK SMALL LETTER UPSILON -->
+<!ENTITY b.Upsi "&#x03D2;"> <!-- -->
+<!ENTITY b.phis "&#x03C6;"> <!-- GREEK SMALL LETTER PHI -->
+<!ENTITY b.Phi "&#x03A6;"> <!-- GREEK CAPITAL LETTER PHI -->
+<!ENTITY b.phiv "&#x03D5;"> <!-- GREEK PHI SYMBOL -->
+<!ENTITY b.chi "&#x03C7;"> <!-- GREEK SMALL LETTER CHI -->
+<!ENTITY b.psi "&#x03C8;"> <!-- GREEK SMALL LETTER PSI -->
+<!ENTITY b.Psi "&#x03A8;"> <!-- GREEK CAPITAL LETTER PSI -->
+<!ENTITY b.omega "&#x03C9;"> <!-- GREEK SMALL LETTER OMEGA -->
+<!ENTITY b.Omega "&#x03A9;"> <!-- GREEK CAPITAL LETTER OMEGA -->
+
+<!-- End of ISO Alternative Greek Symbols Entities V0.3 ................... -->
+<!-- ...................................................................... -->
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-lat1.ent b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-lat1.ent
new file mode 100644
index 000000000..4e60e4408
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-lat1.ent
@@ -0,0 +1,104 @@
+<!-- ...................................................................... -->
+<!-- ISO Added Latin 1 Entities V0.3 ...................................... -->
+<!-- File iso-lat1.ent .................................................... -->
+
+<!-- Copyright (C) 2001, 2002 Organization for the Advancement of Structured
+ Information Standards (OASIS).
+
+ $Id: iso-lat1.ent,v 1.1 2008-05-27 19:26:07 jsumali Exp $
+
+ Permission to use, copy, modify and distribute this entity set
+ 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 make no representation about the suitability of
+ the entities for any purpose. It is provided "as is" without
+ expressed or implied warranty.
+
+ Please direct all questions, bug reports, or suggestions for
+ changes to the docbook@lists.oasis-open.org mailing list. For more
+ information, see http://www.oasis-open.org/docbook/.
+
+ Derived, in part, from:
+
+ * iso-lat1.gml
+
+ Copyright (C) 1986 International Organization for Standardization
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+
+ * http://www.tug.org/applications/jadetex/unicode.xml
+
+ * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MISC/SGML.TXT
+
+ Please use the following formal public identifier to identify it:
+
+ ISO 8879:1986//ENTITIES Added Latin 1//EN//XML
+-->
+
+<!ENTITY aacute "&#x00E1;"> <!-- LATIN SMALL LETTER A WITH ACUTE -->
+<!ENTITY Aacute "&#x00C1;"> <!-- LATIN CAPITAL LETTER A WITH ACUTE -->
+<!ENTITY acirc "&#x00E2;"> <!-- LATIN SMALL LETTER A WITH CIRCUMFLEX -->
+<!ENTITY Acirc "&#x00C2;"> <!-- LATIN CAPITAL LETTER A WITH CIRCUMFLEX -->
+<!ENTITY agrave "&#x00E0;"> <!-- LATIN SMALL LETTER A WITH GRAVE -->
+<!ENTITY Agrave "&#x00C0;"> <!-- LATIN CAPITAL LETTER A WITH GRAVE -->
+<!ENTITY aring "&#x00E5;"> <!-- LATIN SMALL LETTER A WITH RING ABOVE -->
+<!ENTITY Aring "&#x00C5;"> <!-- LATIN CAPITAL LETTER A WITH RING ABOVE -->
+<!ENTITY atilde "&#x00E3;"> <!-- LATIN SMALL LETTER A WITH TILDE -->
+<!ENTITY Atilde "&#x00C3;"> <!-- LATIN CAPITAL LETTER A WITH TILDE -->
+<!ENTITY auml "&#x00E4;"> <!-- LATIN SMALL LETTER A WITH DIAERESIS -->
+<!ENTITY Auml "&#x00C4;"> <!-- LATIN CAPITAL LETTER A WITH DIAERESIS -->
+<!ENTITY aelig "&#x00E6;"> <!-- LATIN SMALL LETTER AE -->
+<!ENTITY AElig "&#x00C6;"> <!-- LATIN CAPITAL LETTER AE -->
+<!ENTITY ccedil "&#x00E7;"> <!-- LATIN SMALL LETTER C WITH CEDILLA -->
+<!ENTITY Ccedil "&#x00C7;"> <!-- LATIN CAPITAL LETTER C WITH CEDILLA -->
+<!ENTITY eth "&#x00F0;"> <!-- LATIN SMALL LETTER ETH -->
+<!ENTITY ETH "&#x00D0;"> <!-- LATIN CAPITAL LETTER ETH -->
+<!ENTITY eacute "&#x00E9;"> <!-- LATIN SMALL LETTER E WITH ACUTE -->
+<!ENTITY Eacute "&#x00C9;"> <!-- LATIN CAPITAL LETTER E WITH ACUTE -->
+<!ENTITY ecirc "&#x00EA;"> <!-- LATIN SMALL LETTER E WITH CIRCUMFLEX -->
+<!ENTITY Ecirc "&#x00CA;"> <!-- LATIN CAPITAL LETTER E WITH CIRCUMFLEX -->
+<!ENTITY egrave "&#x00E8;"> <!-- LATIN SMALL LETTER E WITH GRAVE -->
+<!ENTITY Egrave "&#x00C8;"> <!-- LATIN CAPITAL LETTER E WITH GRAVE -->
+<!ENTITY euml "&#x00EB;"> <!-- LATIN SMALL LETTER E WITH DIAERESIS -->
+<!ENTITY Euml "&#x00CB;"> <!-- LATIN CAPITAL LETTER E WITH DIAERESIS -->
+<!ENTITY iacute "&#x00ED;"> <!-- LATIN SMALL LETTER I WITH ACUTE -->
+<!ENTITY Iacute "&#x00CD;"> <!-- LATIN CAPITAL LETTER I WITH ACUTE -->
+<!ENTITY icirc "&#x00EE;"> <!-- LATIN SMALL LETTER I WITH CIRCUMFLEX -->
+<!ENTITY Icirc "&#x00CE;"> <!-- LATIN CAPITAL LETTER I WITH CIRCUMFLEX -->
+<!ENTITY igrave "&#x00EC;"> <!-- LATIN SMALL LETTER I WITH GRAVE -->
+<!ENTITY Igrave "&#x00CC;"> <!-- LATIN CAPITAL LETTER I WITH GRAVE -->
+<!ENTITY iuml "&#x00EF;"> <!-- LATIN SMALL LETTER I WITH DIAERESIS -->
+<!ENTITY Iuml "&#x00CF;"> <!-- LATIN CAPITAL LETTER I WITH DIAERESIS -->
+<!ENTITY ntilde "&#x00F1;"> <!-- LATIN SMALL LETTER N WITH TILDE -->
+<!ENTITY Ntilde "&#x00D1;"> <!-- LATIN CAPITAL LETTER N WITH TILDE -->
+<!ENTITY oacute "&#x00F3;"> <!-- LATIN SMALL LETTER O WITH ACUTE -->
+<!ENTITY Oacute "&#x00D3;"> <!-- LATIN CAPITAL LETTER O WITH ACUTE -->
+<!ENTITY ocirc "&#x00F4;"> <!-- LATIN SMALL LETTER O WITH CIRCUMFLEX -->
+<!ENTITY Ocirc "&#x00D4;"> <!-- LATIN CAPITAL LETTER O WITH CIRCUMFLEX -->
+<!ENTITY ograve "&#x00F2;"> <!-- LATIN SMALL LETTER O WITH GRAVE -->
+<!ENTITY Ograve "&#x00D2;"> <!-- LATIN CAPITAL LETTER O WITH GRAVE -->
+<!ENTITY oslash "&#x00F8;"> <!-- LATIN SMALL LETTER O WITH STROKE -->
+<!ENTITY Oslash "&#x00D8;"> <!-- LATIN CAPITAL LETTER O WITH STROKE -->
+<!ENTITY otilde "&#x00F5;"> <!-- LATIN SMALL LETTER O WITH TILDE -->
+<!ENTITY Otilde "&#x00D5;"> <!-- LATIN CAPITAL LETTER O WITH TILDE -->
+<!ENTITY ouml "&#x00F6;"> <!-- LATIN SMALL LETTER O WITH DIAERESIS -->
+<!ENTITY Ouml "&#x00D6;"> <!-- LATIN CAPITAL LETTER O WITH DIAERESIS -->
+<!ENTITY szlig "&#x00DF;"> <!-- LATIN SMALL LETTER SHARP S -->
+<!ENTITY thorn "&#x00FE;"> <!-- LATIN SMALL LETTER THORN -->
+<!ENTITY THORN "&#x00DE;"> <!-- LATIN CAPITAL LETTER THORN -->
+<!ENTITY uacute "&#x00FA;"> <!-- LATIN SMALL LETTER U WITH ACUTE -->
+<!ENTITY Uacute "&#x00DA;"> <!-- LATIN CAPITAL LETTER U WITH ACUTE -->
+<!ENTITY ucirc "&#x00FB;"> <!-- LATIN SMALL LETTER U WITH CIRCUMFLEX -->
+<!ENTITY Ucirc "&#x00DB;"> <!-- LATIN CAPITAL LETTER U WITH CIRCUMFLEX -->
+<!ENTITY ugrave "&#x00F9;"> <!-- LATIN SMALL LETTER U WITH GRAVE -->
+<!ENTITY Ugrave "&#x00D9;"> <!-- LATIN CAPITAL LETTER U WITH GRAVE -->
+<!ENTITY uuml "&#x00FC;"> <!-- LATIN SMALL LETTER U WITH DIAERESIS -->
+<!ENTITY Uuml "&#x00DC;"> <!-- LATIN CAPITAL LETTER U WITH DIAERESIS -->
+<!ENTITY yacute "&#x00FD;"> <!-- LATIN SMALL LETTER Y WITH ACUTE -->
+<!ENTITY Yacute "&#x00DD;"> <!-- LATIN CAPITAL LETTER Y WITH ACUTE -->
+<!ENTITY yuml "&#x00FF;"> <!-- LATIN SMALL LETTER Y WITH DIAERESIS -->
+
+<!-- End of ISO Added Latin 1 Entities V0.3 ............................... -->
+<!-- ...................................................................... -->
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-lat2.ent b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-lat2.ent
new file mode 100644
index 000000000..0d5f0d3fd
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-lat2.ent
@@ -0,0 +1,163 @@
+<!-- ...................................................................... -->
+<!-- ISO Added Latin 2 Entities V0.3 ...................................... -->
+<!-- File iso-lat2.ent .................................................... -->
+
+<!-- Copyright (C) 2001, 2002 Organization for the Advancement of Structured
+ Information Standards (OASIS).
+
+ $Id: iso-lat2.ent,v 1.1 2008-05-27 19:26:07 jsumali Exp $
+
+ Permission to use, copy, modify and distribute this entity set
+ 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 make no representation about the suitability of
+ the entities for any purpose. It is provided "as is" without
+ expressed or implied warranty.
+
+ Please direct all questions, bug reports, or suggestions for
+ changes to the docbook@lists.oasis-open.org mailing list. For more
+ information, see http://www.oasis-open.org/docbook/.
+
+ Derived, in part, from:
+
+ * iso-lat2.gml
+
+ Copyright (C) 1986 International Organization for Standardization
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+
+ * http://www.tug.org/applications/jadetex/unicode.xml
+
+ * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MISC/SGML.TXT
+
+ Please use the following formal public identifier to identify it:
+
+ ISO 8879:1986//ENTITIES Added Latin 2//EN//XML
+-->
+
+<!ENTITY abreve "&#x0103;"> <!-- LATIN SMALL LETTER A WITH BREVE -->
+<!ENTITY Abreve "&#x0102;"> <!-- LATIN CAPITAL LETTER A WITH BREVE -->
+<!ENTITY amacr "&#x0101;"> <!-- LATIN SMALL LETTER A WITH MACRON -->
+<!ENTITY Amacr "&#x0100;"> <!-- LATIN CAPITAL LETTER A WITH MACRON -->
+<!ENTITY aogon "&#x0105;"> <!-- LATIN SMALL LETTER A WITH OGONEK -->
+<!ENTITY Aogon "&#x0104;"> <!-- LATIN CAPITAL LETTER A WITH OGONEK -->
+<!ENTITY cacute "&#x0107;"> <!-- LATIN SMALL LETTER C WITH ACUTE -->
+<!ENTITY Cacute "&#x0106;"> <!-- LATIN CAPITAL LETTER C WITH ACUTE -->
+<!ENTITY ccaron "&#x010D;"> <!-- LATIN SMALL LETTER C WITH CARON -->
+<!ENTITY Ccaron "&#x010C;"> <!-- LATIN CAPITAL LETTER C WITH CARON -->
+<!ENTITY ccirc "&#x0109;"> <!-- LATIN SMALL LETTER C WITH CIRCUMFLEX -->
+<!ENTITY Ccirc "&#x0108;"> <!-- LATIN CAPITAL LETTER C WITH CIRCUMFLEX -->
+<!ENTITY cdot "&#x010B;"> <!-- LATIN SMALL LETTER C WITH DOT ABOVE -->
+<!ENTITY Cdot "&#x010A;"> <!-- LATIN CAPITAL LETTER C WITH DOT ABOVE -->
+<!ENTITY dcaron "&#x010F;"> <!-- LATIN SMALL LETTER D WITH CARON -->
+<!ENTITY Dcaron "&#x010E;"> <!-- LATIN CAPITAL LETTER D WITH CARON -->
+<!ENTITY dstrok "&#x0111;"> <!-- LATIN SMALL LETTER D WITH STROKE -->
+<!ENTITY Dstrok "&#x0110;"> <!-- LATIN CAPITAL LETTER D WITH STROKE -->
+<!ENTITY ecaron "&#x011B;"> <!-- LATIN SMALL LETTER E WITH CARON -->
+<!ENTITY Ecaron "&#x011A;"> <!-- LATIN CAPITAL LETTER E WITH CARON -->
+<!ENTITY edot "&#x0117;"> <!-- LATIN SMALL LETTER E WITH DOT ABOVE -->
+<!ENTITY Edot "&#x0116;"> <!-- LATIN CAPITAL LETTER E WITH DOT ABOVE -->
+<!ENTITY emacr "&#x0113;"> <!-- LATIN SMALL LETTER E WITH MACRON -->
+<!ENTITY Emacr "&#x0112;"> <!-- LATIN CAPITAL LETTER E WITH MACRON -->
+<!ENTITY eogon "&#x0119;"> <!-- LATIN SMALL LETTER E WITH OGONEK -->
+<!ENTITY Eogon "&#x0118;"> <!-- LATIN CAPITAL LETTER E WITH OGONEK -->
+<!ENTITY gacute "&#x01F5;"> <!-- LATIN SMALL LETTER G WITH ACUTE -->
+<!ENTITY gbreve "&#x011F;"> <!-- LATIN SMALL LETTER G WITH BREVE -->
+<!ENTITY Gbreve "&#x011E;"> <!-- LATIN CAPITAL LETTER G WITH BREVE -->
+<!ENTITY Gcedil "&#x0122;"> <!-- LATIN CAPITAL LETTER G WITH CEDILLA -->
+<!ENTITY gcirc "&#x011D;"> <!-- LATIN SMALL LETTER G WITH CIRCUMFLEX -->
+<!ENTITY Gcirc "&#x011C;"> <!-- LATIN CAPITAL LETTER G WITH CIRCUMFLEX -->
+<!ENTITY gdot "&#x0121;"> <!-- LATIN SMALL LETTER G WITH DOT ABOVE -->
+<!ENTITY Gdot "&#x0120;"> <!-- LATIN CAPITAL LETTER G WITH DOT ABOVE -->
+<!ENTITY hcirc "&#x0125;"> <!-- LATIN SMALL LETTER H WITH CIRCUMFLEX -->
+<!ENTITY Hcirc "&#x0124;"> <!-- LATIN CAPITAL LETTER H WITH CIRCUMFLEX -->
+<!ENTITY hstrok "&#x0127;"> <!-- LATIN SMALL LETTER H WITH STROKE -->
+<!ENTITY Hstrok "&#x0126;"> <!-- LATIN CAPITAL LETTER H WITH STROKE -->
+<!ENTITY Idot "&#x0130;"> <!-- LATIN CAPITAL LETTER I WITH DOT ABOVE -->
+<!ENTITY Imacr "&#x012A;"> <!-- LATIN CAPITAL LETTER I WITH MACRON -->
+<!ENTITY imacr "&#x012B;"> <!-- LATIN SMALL LETTER I WITH MACRON -->
+<!ENTITY ijlig "&#x0133;"> <!-- LATIN SMALL LIGATURE IJ -->
+<!ENTITY IJlig "&#x0132;"> <!-- LATIN CAPITAL LIGATURE IJ -->
+<!ENTITY inodot "&#x0131;"> <!-- LATIN SMALL LETTER DOTLESS I -->
+<!ENTITY iogon "&#x012F;"> <!-- LATIN SMALL LETTER I WITH OGONEK -->
+<!ENTITY Iogon "&#x012E;"> <!-- LATIN CAPITAL LETTER I WITH OGONEK -->
+<!ENTITY itilde "&#x0129;"> <!-- LATIN SMALL LETTER I WITH TILDE -->
+<!ENTITY Itilde "&#x0128;"> <!-- LATIN CAPITAL LETTER I WITH TILDE -->
+<!ENTITY jcirc "&#x0135;"> <!-- LATIN SMALL LETTER J WITH CIRCUMFLEX -->
+<!ENTITY Jcirc "&#x0134;"> <!-- LATIN CAPITAL LETTER J WITH CIRCUMFLEX -->
+<!ENTITY kcedil "&#x0137;"> <!-- LATIN SMALL LETTER K WITH CEDILLA -->
+<!ENTITY Kcedil "&#x0136;"> <!-- LATIN CAPITAL LETTER K WITH CEDILLA -->
+<!ENTITY kgreen "&#x0138;"> <!-- LATIN SMALL LETTER KRA -->
+<!ENTITY lacute "&#x013A;"> <!-- LATIN SMALL LETTER L WITH ACUTE -->
+<!ENTITY Lacute "&#x0139;"> <!-- LATIN CAPITAL LETTER L WITH ACUTE -->
+<!ENTITY lcaron "&#x013E;"> <!-- LATIN SMALL LETTER L WITH CARON -->
+<!ENTITY Lcaron "&#x013D;"> <!-- LATIN CAPITAL LETTER L WITH CARON -->
+<!ENTITY lcedil "&#x013C;"> <!-- LATIN SMALL LETTER L WITH CEDILLA -->
+<!ENTITY Lcedil "&#x013B;"> <!-- LATIN CAPITAL LETTER L WITH CEDILLA -->
+<!ENTITY lmidot "&#x0140;"> <!-- LATIN SMALL LETTER L WITH MIDDLE DOT -->
+<!ENTITY Lmidot "&#x013F;"> <!-- LATIN CAPITAL LETTER L WITH MIDDLE DOT -->
+<!ENTITY lstrok "&#x0142;"> <!-- LATIN SMALL LETTER L WITH STROKE -->
+<!ENTITY Lstrok "&#x0141;"> <!-- LATIN CAPITAL LETTER L WITH STROKE -->
+<!ENTITY nacute "&#x0144;"> <!-- LATIN SMALL LETTER N WITH ACUTE -->
+<!ENTITY Nacute "&#x0143;"> <!-- LATIN CAPITAL LETTER N WITH ACUTE -->
+<!ENTITY eng "&#x014B;"> <!-- LATIN SMALL LETTER ENG -->
+<!ENTITY ENG "&#x014A;"> <!-- LATIN CAPITAL LETTER ENG -->
+<!ENTITY napos "&#x0149;"> <!-- LATIN SMALL LETTER N PRECEDED BY APOSTROPHE -->
+<!ENTITY ncaron "&#x0148;"> <!-- LATIN SMALL LETTER N WITH CARON -->
+<!ENTITY Ncaron "&#x0147;"> <!-- LATIN CAPITAL LETTER N WITH CARON -->
+<!ENTITY ncedil "&#x0146;"> <!-- LATIN SMALL LETTER N WITH CEDILLA -->
+<!ENTITY Ncedil "&#x0145;"> <!-- LATIN CAPITAL LETTER N WITH CEDILLA -->
+<!ENTITY odblac "&#x0151;"> <!-- LATIN SMALL LETTER O WITH DOUBLE ACUTE -->
+<!ENTITY Odblac "&#x0150;"> <!-- LATIN CAPITAL LETTER O WITH DOUBLE ACUTE -->
+<!ENTITY Omacr "&#x014C;"> <!-- LATIN CAPITAL LETTER O WITH MACRON -->
+<!ENTITY omacr "&#x014D;"> <!-- LATIN SMALL LETTER O WITH MACRON -->
+<!ENTITY oelig "&#x0153;"> <!-- LATIN SMALL LIGATURE OE -->
+<!ENTITY OElig "&#x0152;"> <!-- LATIN CAPITAL LIGATURE OE -->
+<!ENTITY racute "&#x0155;"> <!-- LATIN SMALL LETTER R WITH ACUTE -->
+<!ENTITY Racute "&#x0154;"> <!-- LATIN CAPITAL LETTER R WITH ACUTE -->
+<!ENTITY rcaron "&#x0159;"> <!-- LATIN SMALL LETTER R WITH CARON -->
+<!ENTITY Rcaron "&#x0158;"> <!-- LATIN CAPITAL LETTER R WITH CARON -->
+<!ENTITY rcedil "&#x0157;"> <!-- LATIN SMALL LETTER R WITH CEDILLA -->
+<!ENTITY Rcedil "&#x0156;"> <!-- LATIN CAPITAL LETTER R WITH CEDILLA -->
+<!ENTITY sacute "&#x015B;"> <!-- LATIN SMALL LETTER S WITH ACUTE -->
+<!ENTITY Sacute "&#x015A;"> <!-- LATIN CAPITAL LETTER S WITH ACUTE -->
+<!ENTITY scaron "&#x0161;"> <!-- LATIN SMALL LETTER S WITH CARON -->
+<!ENTITY Scaron "&#x0160;"> <!-- LATIN CAPITAL LETTER S WITH CARON -->
+<!ENTITY scedil "&#x015F;"> <!-- LATIN SMALL LETTER S WITH CEDILLA -->
+<!ENTITY Scedil "&#x015E;"> <!-- LATIN CAPITAL LETTER S WITH CEDILLA -->
+<!ENTITY scirc "&#x015D;"> <!-- LATIN SMALL LETTER S WITH CIRCUMFLEX -->
+<!ENTITY Scirc "&#x015C;"> <!-- LATIN CAPITAL LETTER S WITH CIRCUMFLEX -->
+<!ENTITY tcaron "&#x0165;"> <!-- LATIN SMALL LETTER T WITH CARON -->
+<!ENTITY Tcaron "&#x0164;"> <!-- LATIN CAPITAL LETTER T WITH CARON -->
+<!ENTITY tcedil "&#x0163;"> <!-- LATIN SMALL LETTER T WITH CEDILLA -->
+<!ENTITY Tcedil "&#x0162;"> <!-- LATIN CAPITAL LETTER T WITH CEDILLA -->
+<!ENTITY tstrok "&#x0167;"> <!-- LATIN SMALL LETTER T WITH STROKE -->
+<!ENTITY Tstrok "&#x0166;"> <!-- LATIN CAPITAL LETTER T WITH STROKE -->
+<!ENTITY ubreve "&#x016D;"> <!-- LATIN SMALL LETTER U WITH BREVE -->
+<!ENTITY Ubreve "&#x016C;"> <!-- LATIN CAPITAL LETTER U WITH BREVE -->
+<!ENTITY udblac "&#x0171;"> <!-- LATIN SMALL LETTER U WITH DOUBLE ACUTE -->
+<!ENTITY Udblac "&#x0170;"> <!-- LATIN CAPITAL LETTER U WITH DOUBLE ACUTE -->
+<!ENTITY umacr "&#x016B;"> <!-- LATIN SMALL LETTER U WITH MACRON -->
+<!ENTITY Umacr "&#x016A;"> <!-- LATIN CAPITAL LETTER U WITH MACRON -->
+<!ENTITY uogon "&#x0173;"> <!-- LATIN SMALL LETTER U WITH OGONEK -->
+<!ENTITY Uogon "&#x0172;"> <!-- LATIN CAPITAL LETTER U WITH OGONEK -->
+<!ENTITY uring "&#x016F;"> <!-- LATIN SMALL LETTER U WITH RING ABOVE -->
+<!ENTITY Uring "&#x016E;"> <!-- LATIN CAPITAL LETTER U WITH RING ABOVE -->
+<!ENTITY utilde "&#x0169;"> <!-- LATIN SMALL LETTER U WITH TILDE -->
+<!ENTITY Utilde "&#x0168;"> <!-- LATIN CAPITAL LETTER U WITH TILDE -->
+<!ENTITY wcirc "&#x0175;"> <!-- LATIN SMALL LETTER W WITH CIRCUMFLEX -->
+<!ENTITY Wcirc "&#x0174;"> <!-- LATIN CAPITAL LETTER W WITH CIRCUMFLEX -->
+<!ENTITY ycirc "&#x0177;"> <!-- LATIN SMALL LETTER Y WITH CIRCUMFLEX -->
+<!ENTITY Ycirc "&#x0176;"> <!-- LATIN CAPITAL LETTER Y WITH CIRCUMFLEX -->
+<!ENTITY Yuml "&#x0178;"> <!-- LATIN CAPITAL LETTER Y WITH DIAERESIS -->
+<!ENTITY zacute "&#x017A;"> <!-- LATIN SMALL LETTER Z WITH ACUTE -->
+<!ENTITY Zacute "&#x0179;"> <!-- LATIN CAPITAL LETTER Z WITH ACUTE -->
+<!ENTITY zcaron "&#x017E;"> <!-- LATIN SMALL LETTER Z WITH CARON -->
+<!ENTITY Zcaron "&#x017D;"> <!-- LATIN CAPITAL LETTER Z WITH CARON -->
+<!ENTITY zdot "&#x017C;"> <!-- LATIN SMALL LETTER Z WITH DOT ABOVE -->
+<!ENTITY Zdot "&#x017B;"> <!-- LATIN CAPITAL LETTER Z WITH DOT ABOVE -->
+
+<!-- End of ISO Added Latin 2 Entities V0.3 ............................... -->
+<!-- ...................................................................... -->
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-num.ent b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-num.ent
new file mode 100644
index 000000000..947bdae63
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-num.ent
@@ -0,0 +1,118 @@
+<!-- ...................................................................... -->
+<!-- ISO Numeric and Special Graphic Entities V0.3 ........................ -->
+<!-- File iso-num.ent ..................................................... -->
+
+<!-- Copyright (C) 2001, 2002 Organization for the Advancement of Structured
+ Information Standards (OASIS).
+
+ $Id: iso-num.ent,v 1.1 2008-05-27 19:26:07 jsumali Exp $
+
+ Permission to use, copy, modify and distribute this entity set
+ 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 make no representation about the suitability of
+ the entities for any purpose. It is provided "as is" without
+ expressed or implied warranty.
+
+ Please direct all questions, bug reports, or suggestions for
+ changes to the docbook@lists.oasis-open.org mailing list. For more
+ information, see http://www.oasis-open.org/docbook/.
+
+ Derived, in part, from:
+
+ * iso-num.gml
+
+ Copyright (C) 1986 International Organization for Standardization
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+
+ * http://www.tug.org/applications/jadetex/unicode.xml
+
+ * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MISC/SGML.TXT
+
+ Please use the following formal public identifier to identify it:
+
+ ISO 8879:1986//ENTITIES Numeric and Special Graphic//EN//XML
+-->
+
+<!ENTITY half "&#x00BD;"> <!-- VULGAR FRACTION ONE HALF -->
+<!ENTITY frac12 "&#x00BD;"> <!-- VULGAR FRACTION ONE HALF -->
+<!ENTITY frac14 "&#x00BC;"> <!-- VULGAR FRACTION ONE QUARTER -->
+<!ENTITY frac34 "&#x00BE;"> <!-- VULGAR FRACTION THREE QUARTERS -->
+<!ENTITY frac18 "&#x215B;"> <!-- -->
+<!ENTITY frac38 "&#x215C;"> <!-- -->
+<!ENTITY frac58 "&#x215D;"> <!-- -->
+<!ENTITY frac78 "&#x215E;"> <!-- -->
+<!ENTITY sup1 "&#x00B9;"> <!-- SUPERSCRIPT ONE -->
+<!ENTITY sup2 "&#x00B2;"> <!-- SUPERSCRIPT TWO -->
+<!ENTITY sup3 "&#x00B3;"> <!-- SUPERSCRIPT THREE -->
+<!ENTITY plus "&#x002B;"> <!-- PLUS SIGN -->
+<!ENTITY plusmn "&#x00B1;"> <!-- PLUS-MINUS SIGN -->
+<!ENTITY lt "&#38;#60;"> <!-- LESS-THAN SIGN -->
+<!ENTITY equals "&#x003D;"> <!-- EQUALS SIGN -->
+<!ENTITY gt "&#x003E;"> <!-- GREATER-THAN SIGN -->
+<!ENTITY divide "&#x00F7;"> <!-- DIVISION SIGN -->
+<!ENTITY times "&#x00D7;"> <!-- MULTIPLICATION SIGN -->
+<!ENTITY curren "&#x00A4;"> <!-- CURRENCY SIGN -->
+<!ENTITY pound "&#x00A3;"> <!-- POUND SIGN -->
+<!ENTITY dollar "&#x0024;"> <!-- DOLLAR SIGN -->
+<!ENTITY cent "&#x00A2;"> <!-- CENT SIGN -->
+<!ENTITY yen "&#x00A5;"> <!-- YEN SIGN -->
+<!ENTITY num "&#x0023;"> <!-- NUMBER SIGN -->
+<!ENTITY percnt "&#x0025;"> <!-- PERCENT SIGN -->
+<!ENTITY amp "&#38;#38;"> <!-- AMPERSAND -->
+<!ENTITY ast "&#x002A;"> <!-- ASTERISK -->
+<!ENTITY commat "&#x0040;"> <!-- COMMERCIAL AT -->
+<!ENTITY lsqb "&#x005B;"> <!-- LEFT SQUARE BRACKET -->
+<!ENTITY bsol "&#x005C;"> <!-- REVERSE SOLIDUS -->
+<!ENTITY rsqb "&#x005D;"> <!-- RIGHT SQUARE BRACKET -->
+<!ENTITY lcub "&#x007B;"> <!-- LEFT CURLY BRACKET -->
+<!ENTITY horbar "&#x2015;"> <!-- HORIZONTAL BAR -->
+<!ENTITY verbar "&#x007C;"> <!-- VERTICAL LINE -->
+<!ENTITY rcub "&#x007D;"> <!-- RIGHT CURLY BRACKET -->
+<!ENTITY micro "&#x00B5;"> <!-- MICRO SIGN -->
+<!ENTITY ohm "&#x2126;"> <!-- OHM SIGN -->
+<!ENTITY deg "&#x00B0;"> <!-- DEGREE SIGN -->
+<!ENTITY ordm "&#x00BA;"> <!-- MASCULINE ORDINAL INDICATOR -->
+<!ENTITY ordf "&#x00AA;"> <!-- FEMININE ORDINAL INDICATOR -->
+<!ENTITY sect "&#x00A7;"> <!-- SECTION SIGN -->
+<!ENTITY para "&#x00B6;"> <!-- PILCROW SIGN -->
+<!ENTITY middot "&#x00B7;"> <!-- MIDDLE DOT -->
+<!ENTITY larr "&#x2190;"> <!-- LEFTWARDS ARROW -->
+<!ENTITY rarr "&#x2192;"> <!-- RIGHTWARDS ARROW -->
+<!ENTITY uarr "&#x2191;"> <!-- UPWARDS ARROW -->
+<!ENTITY darr "&#x2193;"> <!-- DOWNWARDS ARROW -->
+<!ENTITY copy "&#x00A9;"> <!-- COPYRIGHT SIGN -->
+<!ENTITY reg "&#x00AE;"> <!-- REG TRADE MARK SIGN -->
+<!ENTITY trade "&#x2122;"> <!-- TRADE MARK SIGN -->
+<!ENTITY brvbar "&#x00A6;"> <!-- BROKEN BAR -->
+<!ENTITY not "&#x00AC;"> <!-- NOT SIGN -->
+<!ENTITY sung "&#x2669;"> <!-- -->
+<!ENTITY excl "&#x0021;"> <!-- EXCLAMATION MARK -->
+<!ENTITY iexcl "&#x00A1;"> <!-- INVERTED EXCLAMATION MARK -->
+<!ENTITY quot "&#x0022;"> <!-- QUOTATION MARK -->
+<!ENTITY apos "&#x0027;"> <!-- APOSTROPHE -->
+<!ENTITY lpar "&#x0028;"> <!-- LEFT PARENTHESIS -->
+<!ENTITY rpar "&#x0029;"> <!-- RIGHT PARENTHESIS -->
+<!ENTITY comma "&#x002C;"> <!-- COMMA -->
+<!ENTITY lowbar "&#x005F;"> <!-- LOW LINE -->
+<!ENTITY hyphen "&#x002D;"> <!-- HYPHEN-MINUS -->
+<!ENTITY period "&#x002E;"> <!-- FULL STOP -->
+<!ENTITY sol "&#x002F;"> <!-- SOLIDUS -->
+<!ENTITY colon "&#x003A;"> <!-- COLON -->
+<!ENTITY semi "&#x003B;"> <!-- SEMICOLON -->
+<!ENTITY quest "&#x003F;"> <!-- QUESTION MARK -->
+<!ENTITY iquest "&#x00BF;"> <!-- INVERTED QUESTION MARK -->
+<!ENTITY laquo "&#x00AB;"> <!-- LEFT-POINTING DOUBLE ANGLE QUOTATION MARK -->
+<!ENTITY raquo "&#x00BB;"> <!-- RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK -->
+<!ENTITY lsquo "&#x2018;"> <!-- -->
+<!ENTITY rsquo "&#x2019;"> <!-- RIGHT SINGLE QUOTATION MARK -->
+<!ENTITY ldquo "&#x201C;"> <!-- -->
+<!ENTITY rdquo "&#x201D;"> <!-- RIGHT DOUBLE QUOTATION MARK -->
+<!ENTITY nbsp "&#x00A0;"> <!-- NO-BREAK SPACE -->
+<!ENTITY shy "&#x00AD;"> <!-- SOFT HYPHEN -->
+
+<!-- End of ISO Numeric and Special Graphic Entities V0.3 ................. -->
+<!-- ...................................................................... -->
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-pub.ent b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-pub.ent
new file mode 100644
index 000000000..56710314f
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-pub.ent
@@ -0,0 +1,127 @@
+<!-- ...................................................................... -->
+<!-- ISO Publishing Entities V0.3 ......................................... -->
+<!-- File iso-pub.ent ..................................................... -->
+
+<!-- Copyright (C) 2001, 2002 Organization for the Advancement of Structured
+ Information Standards (OASIS).
+
+ $Id: iso-pub.ent,v 1.1 2008-05-27 19:26:08 jsumali Exp $
+
+ Permission to use, copy, modify and distribute this entity set
+ 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 make no representation about the suitability of
+ the entities for any purpose. It is provided "as is" without
+ expressed or implied warranty.
+
+ Please direct all questions, bug reports, or suggestions for
+ changes to the docbook@lists.oasis-open.org mailing list. For more
+ information, see http://www.oasis-open.org/docbook/.
+
+ Derived, in part, from:
+
+ * iso-pub.gml
+
+ Copyright (C) 1986 International Organization for Standardization
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+
+ * http://www.tug.org/applications/jadetex/unicode.xml
+
+ * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MISC/SGML.TXT
+
+ Please use the following formal public identifier to identify it:
+
+ ISO 8879:1986//ENTITIES Publishing//EN//XML
+-->
+
+<!ENTITY emsp "&#x2003;"> <!-- EM SPACE -->
+<!ENTITY ensp "&#x2002;"> <!-- EN SPACE -->
+<!ENTITY emsp13 "&#x2004;"> <!-- THREE-PER-EM SPACE -->
+<!ENTITY emsp14 "&#x2005;"> <!-- FOUR-PER-EM SPACE -->
+<!ENTITY numsp "&#x2007;"> <!-- FIGURE SPACE -->
+<!ENTITY puncsp "&#x2008;"> <!-- PUNCTUATION SPACE -->
+<!ENTITY thinsp "&#x2009;"> <!-- THIN SPACE -->
+<!ENTITY hairsp "&#x200A;"> <!-- HAIR SPACE -->
+<!ENTITY mdash "&#x2014;"> <!-- EM DASH -->
+<!ENTITY ndash "&#x2013;"> <!-- EN DASH -->
+<!ENTITY dash "&#x2010;"> <!-- HYPHEN -->
+<!ENTITY blank "&#x2423;"> <!-- OPEN BOX -->
+<!ENTITY hellip "&#x2026;"> <!-- HORIZONTAL ELLIPSIS -->
+<!ENTITY nldr "&#x2025;"> <!-- TWO DOT LEADER -->
+<!ENTITY frac13 "&#x2153;"> <!-- VULGAR FRACTION ONE THIRD -->
+<!ENTITY frac23 "&#x2154;"> <!-- VULGAR FRACTION TWO THIRDS -->
+<!ENTITY frac15 "&#x2155;"> <!-- VULGAR FRACTION ONE FIFTH -->
+<!ENTITY frac25 "&#x2156;"> <!-- VULGAR FRACTION TWO FIFTHS -->
+<!ENTITY frac35 "&#x2157;"> <!-- VULGAR FRACTION THREE FIFTHS -->
+<!ENTITY frac45 "&#x2158;"> <!-- VULGAR FRACTION FOUR FIFTHS -->
+<!ENTITY frac16 "&#x2159;"> <!-- VULGAR FRACTION ONE SIXTH -->
+<!ENTITY frac56 "&#x215A;"> <!-- VULGAR FRACTION FIVE SIXTHS -->
+<!ENTITY incare "&#x2105;"> <!-- CARE OF -->
+<!ENTITY block "&#x2588;"> <!-- FULL BLOCK -->
+<!ENTITY uhblk "&#x2580;"> <!-- UPPER HALF BLOCK -->
+<!ENTITY lhblk "&#x2584;"> <!-- LOWER HALF BLOCK -->
+<!ENTITY blk14 "&#x2591;"> <!-- LIGHT SHADE -->
+<!ENTITY blk12 "&#x2592;"> <!-- MEDIUM SHADE -->
+<!ENTITY blk34 "&#x2593;"> <!-- DARK SHADE -->
+<!ENTITY marker "&#x25AE;"> <!-- BLACK VERTICAL RECTANGLE -->
+<!ENTITY cir "&#x25CB;"> <!-- WHITE CIRCLE -->
+<!ENTITY squ "&#x25A1;"> <!-- WHITE SQUARE -->
+<!ENTITY rect "&#x25AD;"> <!-- WHITE RECTANGLE -->
+<!ENTITY utri "&#x25B5;"> <!-- WHITE UP-POINTING TRIANGLE -->
+<!ENTITY dtri "&#x25BF;"> <!-- WHITE DOWN-POINTING TRIANGLE -->
+<!ENTITY star "&#x22C6;"> <!-- STAR OPERATOR -->
+<!ENTITY bull "&#x2022;"> <!-- BULLET -->
+<!ENTITY squf "&#x25AA;"> <!-- -->
+<!ENTITY utrif "&#x25B4;"> <!-- BLACK UP-POINTING TRIANGLE -->
+<!ENTITY dtrif "&#x25BE;"> <!-- BLACK DOWN-POINTING TRIANGLE -->
+<!ENTITY ltrif "&#x25C2;"> <!-- BLACK LEFT-POINTING TRIANGLE -->
+<!ENTITY rtrif "&#x25B8;"> <!-- BLACK RIGHT-POINTING TRIANGLE -->
+<!ENTITY clubs "&#x2663;"> <!-- BLACK CLUB SUIT -->
+<!ENTITY diams "&#x2666;"> <!-- BLACK DIAMOND SUIT -->
+<!ENTITY hearts "&#x2665;"> <!-- BLACK HEART SUIT -->
+<!ENTITY spades "&#x2660;"> <!-- BLACK SPADE SUIT -->
+<!ENTITY malt "&#x2720;"> <!-- MALTESE CROSS -->
+<!ENTITY dagger "&#x2020;"> <!-- DAGGER -->
+<!ENTITY Dagger "&#x2021;"> <!-- DOUBLE DAGGER -->
+<!ENTITY check "&#x2713;"> <!-- CHECK MARK -->
+<!ENTITY cross "&#x2717;"> <!-- BALLOT X -->
+<!ENTITY sharp "&#x266F;"> <!-- MUSIC SHARP SIGN -->
+<!ENTITY flat "&#x266D;"> <!-- MUSIC FLAT SIGN -->
+<!ENTITY male "&#x2642;"> <!-- MALE SIGN -->
+<!ENTITY female "&#x2640;"> <!-- -->
+<!ENTITY phone "&#x260E;"> <!-- TELEPHONE SIGN -->
+<!ENTITY telrec "&#x2315;"> <!-- TELEPHONE RECORDER -->
+<!ENTITY copysr "&#x2117;"> <!-- SOUND RECORDING COPYRIGHT -->
+<!ENTITY caret "&#x2041;"> <!-- CARET -->
+<!ENTITY lsquor "&#x201A;"> <!-- SINGLE LOW-9 QUOTATION MARK -->
+<!ENTITY ldquor "&#x201E;"> <!-- DOUBLE LOW-9 QUOTATION MARK -->
+<!ENTITY fflig "&#xFB00;"> <!-- -->
+<!ENTITY filig "&#xFB01;"> <!-- -->
+<!-- fjlig Unknown unicode character -->
+<!ENTITY ffilig "&#xFB03;"> <!-- -->
+<!ENTITY ffllig "&#xFB04;"> <!-- -->
+<!ENTITY fllig "&#xFB02;"> <!-- -->
+<!ENTITY mldr "&#x2026;"> <!-- HORIZONTAL ELLIPSIS -->
+<!ENTITY rdquor "&#x201C;"> <!-- -->
+<!ENTITY rsquor "&#x2018;"> <!-- -->
+<!ENTITY vellip "&#x22EE;"> <!-- -->
+<!ENTITY hybull "&#x2043;"> <!-- HYPHEN BULLET -->
+<!ENTITY loz "&#x25CA;"> <!-- LOZENGE -->
+<!ENTITY lozf "&#x2726;"> <!-- -->
+<!ENTITY ltri "&#x25C3;"> <!-- WHITE LEFT-POINTING TRIANGLE -->
+<!ENTITY rtri "&#x25B9;"> <!-- WHITE RIGHT-POINTING TRIANGLE -->
+<!ENTITY starf "&#x2605;"> <!-- BLACK STAR -->
+<!ENTITY natur "&#x266E;"> <!-- MUSIC NATURAL SIGN -->
+<!ENTITY rx "&#x211E;"> <!-- PRESCRIPTION TAKE -->
+<!ENTITY sext "&#x2736;"> <!-- SIX POINTED BLACK STAR -->
+<!ENTITY target "&#x2316;"> <!-- POSITION INDICATOR -->
+<!ENTITY dlcrop "&#x230D;"> <!-- BOTTOM LEFT CROP -->
+<!ENTITY drcrop "&#x230C;"> <!-- BOTTOM RIGHT CROP -->
+<!ENTITY ulcrop "&#x230F;"> <!-- TOP LEFT CROP -->
+<!ENTITY urcrop "&#x230E;"> <!-- TOP RIGHT CROP -->
+
+<!-- End of ISO Publishing Entities V0.3 .................................. -->
+<!-- ...................................................................... -->
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-tech.ent b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-tech.ent
new file mode 100644
index 000000000..388d94557
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/dtd/ent/iso-tech.ent
@@ -0,0 +1,104 @@
+<!-- ...................................................................... -->
+<!-- ISO General Technical Entities V0.3 .................................. -->
+<!-- File iso-tech.ent .................................................... -->
+
+<!-- Copyright (C) 2001, 2002 Organization for the Advancement of Structured
+ Information Standards (OASIS).
+
+ $Id: iso-tech.ent,v 1.1 2008-05-27 19:26:08 jsumali Exp $
+
+ Permission to use, copy, modify and distribute this entity set
+ 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 make no representation about the suitability of
+ the entities for any purpose. It is provided "as is" without
+ expressed or implied warranty.
+
+ Please direct all questions, bug reports, or suggestions for
+ changes to the docbook@lists.oasis-open.org mailing list. For more
+ information, see http://www.oasis-open.org/docbook/.
+
+ Derived, in part, from:
+
+ * iso-tech.gml
+
+ Copyright (C) 1986 International Organization for Standardization
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+
+ * http://www.tug.org/applications/jadetex/unicode.xml
+
+ * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MISC/SGML.TXT
+
+ Please use the following formal public identifier to identify it:
+
+ ISO 8879:1986//ENTITIES General Technical//EN//XML
+-->
+
+<!ENTITY aleph "&#x2135;"> <!-- ALEF SYMBOL -->
+<!ENTITY and "&#x2227;"> <!-- -->
+<!ENTITY ang90 "&#x221F;"> <!-- RIGHT ANGLE -->
+<!ENTITY angsph "&#x2222;"> <!-- -->
+<!ENTITY ap "&#x2248;"> <!-- -->
+<!ENTITY becaus "&#x2235;"> <!-- BECAUSE -->
+<!ENTITY bottom "&#x22A5;"> <!-- -->
+<!ENTITY cap "&#x2229;"> <!-- -->
+<!ENTITY cong "&#x2245;"> <!-- -->
+<!ENTITY conint "&#x222E;"> <!-- -->
+<!ENTITY cup "&#x222A;"> <!-- -->
+<!ENTITY equiv "&#x2261;"> <!-- -->
+<!ENTITY exist "&#x2203;"> <!-- -->
+<!ENTITY forall "&#x2200;"> <!-- -->
+<!ENTITY fnof "&#x0192;"> <!-- LATIN SMALL LETTER F WITH HOOK -->
+<!ENTITY ge "&#x2265;"> <!-- GREATER-THAN OR EQUAL TO -->
+<!ENTITY iff "&#x21D4;"> <!-- LEFT RIGHT DOUBLE ARROW -->
+<!ENTITY infin "&#x221E;"> <!-- -->
+<!ENTITY int "&#x222B;"> <!-- -->
+<!ENTITY isin "&#x220A;"> <!-- -->
+<!ENTITY lang "&#x3008;"> <!-- -->
+<!ENTITY lArr "&#x21D0;"> <!-- LEFTWARDS ARROW -->
+<!ENTITY le "&#x2264;"> <!-- -->
+<!ENTITY minus "&#x2212;"> <!-- MINUS SIGN -->
+<!ENTITY mnplus "&#x2213;"> <!-- -->
+<!ENTITY nabla "&#x2207;"> <!-- NABLA -->
+<!ENTITY ne "&#x2260;"> <!-- -->
+<!ENTITY ni "&#x220D;"> <!-- -->
+<!ENTITY or "&#x2228;"> <!-- -->
+<!ENTITY par "&#x2225;"> <!-- PARALLEL TO -->
+<!ENTITY part "&#x2202;"> <!-- -->
+<!ENTITY permil "&#x2030;"> <!-- PER MILLE SIGN -->
+<!ENTITY perp "&#x22A5;"> <!-- -->
+<!ENTITY prime "&#x2032;"> <!-- PRIME -->
+<!ENTITY Prime "&#x2033;"> <!-- DOUBLE PRIME -->
+<!ENTITY prop "&#x221D;"> <!-- -->
+<!ENTITY radic "&#x221A;"> <!-- -->
+<!ENTITY rang "&#x3009;"> <!-- -->
+<!ENTITY rArr "&#x21D2;"> <!-- RIGHTWARDS ARROW -->
+<!ENTITY sim "&#x223C;"> <!-- -->
+<!ENTITY sime "&#x2243;"> <!-- -->
+<!ENTITY square "&#x25A1;"> <!-- WHITE SQUARE -->
+<!ENTITY sub "&#x2282;"> <!-- -->
+<!ENTITY sube "&#x2286;"> <!-- -->
+<!ENTITY sup "&#x2283;"> <!-- -->
+<!ENTITY supe "&#x2287;"> <!-- -->
+<!ENTITY there4 "&#x2234;"> <!-- -->
+<!ENTITY Verbar "&#x2016;"> <!-- DOUBLE VERTICAL LINE -->
+<!ENTITY angst "&#x212B;"> <!-- ANGSTROM SIGN -->
+<!ENTITY bernou "&#x212C;"> <!-- SCRIPT CAPITAL B -->
+<!ENTITY compfn "&#x2218;"> <!-- RING OPERATOR -->
+<!ENTITY Dot "&#x00A8;"> <!-- -->
+<!ENTITY DotDot "&#x20DC;"> <!-- COMBINING FOUR DOTS ABOVE -->
+<!ENTITY hamilt "&#x210B;"> <!-- SCRIPT CAPITAL H -->
+<!ENTITY lagran "&#x2112;"> <!-- SCRIPT CAPITAL L -->
+<!ENTITY lowast "&#x2217;"> <!-- ASTERISK OPERATOR -->
+<!ENTITY notin "&#x2209;"> <!-- -->
+<!ENTITY order "&#x2134;"> <!-- SCRIPT SMALL O -->
+<!ENTITY phmmat "&#x2133;"> <!-- SCRIPT CAPITAL M -->
+<!ENTITY tdot "&#x20DB;"> <!-- COMBINING THREE DOTS ABOVE -->
+<!ENTITY tprime "&#x2034;"> <!-- TRIPLE PRIME -->
+<!ENTITY wedgeq "&#x2259;"> <!-- ESTIMATES -->
+
+<!-- End of ISO General Technical Entities V0.3 ........................... -->
+<!-- ...................................................................... -->
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/dtd/gjdoc-alphaindex.dtd b/tools/resource/gnu/classpath/tools/gjdoc/dtd/gjdoc-alphaindex.dtd
new file mode 100644
index 000000000..5597d7bbe
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/dtd/gjdoc-alphaindex.dtd
@@ -0,0 +1,35 @@
+<!-- gjdoc-alphabetical.dtd
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. -->
+
+<!--
+ NOTE: This is NOT a complete DTD usable for verifying XML files
+ generated by XmlDoclet. This file is currently only used to include
+ OASIS' standard entity sets.
+-->
+
+<!ENTITY % dbcent.module "INCLUDE">
+<![%dbcent.module;[
+<!ENTITY euro "&#x20AC;"> <!-- Euro sign, U+20AC -->
+<!ENTITY % dbcent PUBLIC
+"-//OASIS//ENTITIES DocBook XML Character Entities V4.1.2//EN"
+"dbcentx.mod">
+%dbcent;
+]]>
+
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/dtd/gjdoc.dtd b/tools/resource/gnu/classpath/tools/gjdoc/dtd/gjdoc.dtd
new file mode 100644
index 000000000..6d02bd86c
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/dtd/gjdoc.dtd
@@ -0,0 +1,35 @@
+<!-- gjdoc.dtd
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. -->
+
+<!--
+ NOTE: This is NOT a complete DTD usable for verifying XML files
+ generated by XmlDoclet. This file is currently only used to include
+ OASIS' standard entity sets.
+-->
+
+<!ENTITY % dbcent.module "INCLUDE">
+<![%dbcent.module;[
+<!ENTITY euro "&#x20AC;"> <!-- Euro sign, U+20AC -->
+<!ENTITY % dbcent PUBLIC
+"-//OASIS//ENTITIES DocBook XML Character Entities V4.1.2//EN"
+"dbcentx.mod">
+%dbcent;
+]]>
+
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/htmldoclet/HtmlDoclet.properties b/tools/resource/gnu/classpath/tools/gjdoc/htmldoclet/HtmlDoclet.properties
new file mode 100644
index 000000000..37ffad45b
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/htmldoclet/HtmlDoclet.properties
@@ -0,0 +1,32 @@
+# gjdochtml-vanilla.css
+# Copyright (C) 2004 Free Software Foundation, Inc.
+#
+# This file is part of GNU Classpath.
+#
+# GNU Classpath is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Classpath is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Classpath; see the file COPYING. If not, write to the
+# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+# 02111-1307 USA.
+
+#
+# Defines localized strings for HtmlDoclet (US-english/fallback)
+#
+
+usagetype.class-derived-from = Classes derived from {0}
+usagetype.class-implementing = Classes implementing {0}
+usagetype.field-of-type = Fields of type {0}
+usagetype.method-with-return-type = Methods with return type {0}
+usagetype.method-with-parameter-type = Methods with parameter type {0}
+usagetype.method-with-thrown-type = Methods which throw type {0}
+usagetype.constructor-with-parameter-type = Constructors with parameter type {0}
+usagetype.constructor-with-thrown-type = Constructors which throw type {0}
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/htmldoclet/gjdoc.js b/tools/resource/gnu/classpath/tools/gjdoc/htmldoclet/gjdoc.js
new file mode 100644
index 000000000..91f8ba2ac
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/htmldoclet/gjdoc.js
@@ -0,0 +1,115 @@
+/* gjdoc.js
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/**
+ * Sets a new stylesheet for a single frame.
+ */
+function setStyleSheetForFrame(title, frame_name)
+{
+ var i, num, a, main;
+ f = eval("top.frames." + frame_name);
+ for(i=0; (a = f.document.getElementsByTagName("link")[i]); i++) {
+ if(a.getAttribute("rel").indexOf("style") != -1
+ && a.getAttribute("title")) {
+ a.disabled = true;
+ a.disabled = (a.getAttribute("title") != title);
+ }
+ }
+}
+
+/**
+ * Sets a new stylesheet for a single document.
+ */
+function setStyleSheetForDocument(title)
+{
+ var i, num, a, main;
+ for(i=0; (a = top.document.getElementsByTagName("link")[i]); i++) {
+ if(a.getAttribute("rel").indexOf("style") != -1
+ && a.getAttribute("title")) {
+ a.disabled = true;
+ a.disabled = (a.getAttribute("title") != title);
+ }
+ }
+}
+
+/**
+ * Sets a new stylesheets for all frames.
+ */
+function setStyleSheet(title)
+{
+ var i, num, a, main;
+ num = top.frames.length;
+ if (num > 0) {
+ for (i=0; i<num; i++) {
+ setStyleSheetForFrame(title, top.frames[i].name);
+ }
+ }
+ else {
+ setStyleSheetForDocument(title);
+ }
+ top.selectedSheet = title;
+ return false;
+}
+
+/**
+ * Returns the title of the set of stylesheets that is active in the
+ * given frame.
+ */
+function getActiveStylesheetTitle(frame)
+{
+ for(i=0; (a = frame.document.getElementsByTagName("link")[i]); i++) {
+ if(a.getAttribute("rel").indexOf("style") != -1
+ && a.getAttribute("title")) {
+ if (!a.disabled) {
+ return a.getAttribute("title");
+ }
+ }
+ }
+ return "";
+}
+
+/**
+ * Invoked when a page in the main content frame has been loaded.
+ */
+function contentPageLoaded(title)
+{
+ if (title) {
+ top.document.title = title;
+ }
+ /** 20050204: removed since there is only one stylesheet at the time
+ if (top.frames.length > 0) {
+ setStyleSheet(getActiveStylesheetTitle(top.frames.packages), "content");
+ }
+ else if (top.selectedSheet) {
+ setStyleSheet(top.selectedSheet, "content");
+ }
+ **/
+}
+
+/**
+ * Invoked when a page in one of the two frames on the left hand has
+ * been loaded.
+ */
+function secondaryPageLoaded(frame_name)
+{
+ /** 20050204: removed since there is only one stylesheet at the time
+ setStyleSheet(getActiveStylesheetTitle(top.frames.packages), frame_name);
+ **/
+}
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/htmldoclet/gjdochtml-clean-color1.css b/tools/resource/gnu/classpath/tools/gjdoc/htmldoclet/gjdochtml-clean-color1.css
new file mode 100644
index 000000000..28452fa7b
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/htmldoclet/gjdochtml-clean-color1.css
@@ -0,0 +1,80 @@
+/* gjdochtml-clean-layout.css
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+/* --- GNU Clean Style: Color Scheme #1 --- */
+
+[class~="title"],
+[class="table header"],
+[class="table sub header"],
+[class="section header"],
+[class="serialized package header"],
+[class="serialized class header"]
+{
+ background-color: #E8EAFF;
+}
+
+[class~="navbar"][class~="item"]
+{
+ border-color: #000000;
+ color: #000000;
+}
+
+[class~="navbar"][class~="item"][class~="disabled"]
+{
+ border-color: #aaaaaa;
+ color: #aaaaaa;
+}
+
+[class~="navbar"][class~="item"][class~="active"]
+{
+ color: #000000;
+ background-color: #E8EAFF;
+}
+
+[class~="navbar"][class~="item"][class~="active"]
+{
+ border-color: #222222;
+}
+
+.navbar .header a
+{
+ color: #777777;
+}
+
+a[href] {
+ color: #141EB8;
+}
+
+a[href]:visited {
+ color: #0C126E;
+}
+
+
+/* ---- source highlighting ---- */
+
+.comment { color: #777777; }
+.tag { color: #444444; }
+.keyword { color: #B36B00; }
+.header.type { color: #00248F; }
+.type { color: #0033CC; }
+.literal { color: #809FFF; }
+.variable { color: #007D48; }
+.method { color: #B32400; }
+.line-number { color: #AAAAAA; }
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/htmldoclet/gjdochtml-clean-layout.css b/tools/resource/gnu/classpath/tools/gjdoc/htmldoclet/gjdochtml-clean-layout.css
new file mode 100644
index 000000000..9d4590973
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/htmldoclet/gjdochtml-clean-layout.css
@@ -0,0 +1,460 @@
+/* gjdochtml-clean-layout.css
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+/* --- GNU Clean Style: Layout --- */
+
+body
+{
+ background: white;
+ color: black;
+}
+
+body.content
+{
+ margin-left: 1.3em;
+ margin-right: 1.3em;
+ margin-top: 0.9em;
+ margin-bottom: 1.3em;
+}
+
+div[class="class title outer"]
+{
+ margin: 0em;
+ margin-bottom: 1em;
+ border: 1px solid;
+ padding: 10pt;
+}
+
+[class="class title-package"]
+{
+ margin: 0em;
+ padding: 0em;
+}
+
+[class="class title-class"]
+{
+ margin: 0em;
+ margin-top: 0.2em;
+ padding: 0em;
+}
+
+[class="table header"],
+[class="table sub header"]
+{
+ margin: 0em;
+ padding: 0.25em;
+}
+
+[class="section header"]
+{
+ margin: 0em;
+ padding: 0.25em;
+ border: 1px solid;
+}
+
+.serialized.package.header
+{
+ margin: 0em;
+ padding: 0.25em;
+ border: 1px solid;
+ margin-bottom: 1em;
+}
+
+
+.serialized.class.header
+{
+ margin: 0em;
+ padding: 0.25em;
+ padding-left: 3.25em;
+ border: 1px solid;
+ text-indent: -3em;
+ font-weight: normal;
+ font-size: 1.2em;
+}
+
+.serialized.section.header
+{
+ font-size: 1.15em;
+}
+
+div.serialized.section
+{
+ padding-left: 1em;
+}
+
+.summary td,
+.summary .inherited
+{
+ padding: 0.25em;
+}
+
+table[border]
+{
+ border-spacing: 0em;
+ border-collapse: collapse;
+}
+
+table[border] td
+{
+ border-spacing: 0em;
+ border-collapse: collapse;
+}
+
+hr
+{
+ border-top: 1px solid;
+ border-bottom: 0px;
+ border-left: 0px;
+ border-right: 0px;
+}
+
+.class.summary .left
+{
+ width: 10%;
+}
+
+.class.summary td.left
+{
+ text-align: right;
+}
+
+.class.summary .left .synopsis
+{
+ font-size: small;
+}
+
+
+[class="package summary left"]
+{
+ width: 20%;
+}
+
+ul.inheritance
+{
+ margin-left: 1.8em;
+ padding-left: 0em;
+ marker-offset: 0em !important;
+ list-style-type: none;
+ list-style-image: none;
+}
+
+li.inheritance
+{
+ margin: 0em !important;
+ margin-top: 0.1em !important;
+ padding: 0em !important;
+ marker-offset: 0em !important;
+}
+
+ul.inheritance > li.inheritance:before
+{
+ display: marker;
+ width: 12px;
+ margin: 0em !important;
+ padding: 0em !important;
+ marker-offset: 0em !important;
+ content: url(inherit.png);
+ vertical-align: center !important;
+}
+
+[class="inheritance 0"] > li.inheritance:before
+{
+ display: none;
+}
+
+ul [class="inheritance 0"]
+{
+ margin-left: 12px !important;
+ padding-left: 0em;
+ list-style-type: none !important;
+ list-style-image: none !important;
+}
+
+.inheritance-tree
+{
+ position: relative;
+ left: -24px;
+}
+
+.synopsis.outer
+{
+ padding: 0em;
+ margin-bottom: 0.3em;
+}
+
+.synopsis.outer > *
+{
+ margin: 0em;
+ padding: 0em;
+ line-height: 1.0em;
+}
+
+div.navbar.div
+{
+ padding: 0em;
+ margin: 0em;
+ position: relative;
+ left: -0.2em;
+}
+
+.navbar.div,
+.navbar.div tr,
+.navbar.div td
+{
+ margin: 0em;
+ padding: 0em;
+ border-spacing: 0em;
+ border-collapse: collapse;
+}
+
+table.navbar.div
+{
+ width: 100%;
+}
+
+table.navbar.div td
+{
+ line-height: 1.9em;
+ text-align: top;
+}
+
+.navbar.item
+{
+ /* float: left; */
+ border: 1px solid;
+ /* width: 7.5em; */
+ text-align: center;
+ margin: 0.05em;
+ padding-top: 0.2em;
+ padding-bottom: 0.3em;
+ padding-left: 0.5em;
+ padding-right: 0.5em;
+ font-size: 0.75em;
+ margin-bottom: 0.5em;
+}
+
+.navbar.item.active
+{
+ /* font-weight: bold; */
+ border: 1px solid;
+}
+
+[class~="title"]
+{
+ border: 1px solid;
+ padding: 0.3em;
+ margin-top: 0em;
+}
+
+.table.container,
+.table.container dd
+{
+ padding: 0em;
+ margin: 0em;
+}
+
+.overview.summary
+{
+ padding: 0em;
+ margin: 0em;
+}
+
+.summary
+{
+ margin-bottom: 1.2em;
+}
+
+table.navbar.top
+{
+ margin-bottom: 1em !important;
+}
+
+.package.description
+{
+ margin-top: 0.0em;
+ margin-bottom: 1.0em;
+}
+
+.class.description
+{
+ margin-top: 1em;
+ margin-bottom: 0.8em;
+}
+
+[class="overview description top"]
+{
+ margin-top: 0.0em;
+ margin-bottom: 1.0em;
+}
+
+[class="overview description full"]
+{
+ margin-top: 1.0em;
+ margin-bottom: 0.0em;
+}
+
+.class.summary .right .list
+{
+ margin: 0em;
+ padding: 0em;
+}
+
+.class.summary .right .list .synopsis
+{
+ margin: 0em;
+ padding: 0em;
+}
+
+.classes .menu-subtitle
+{
+ padding: 0em;
+ margin-top: 0.5em;
+ margin-bottom: 0em;
+}
+
+.menu-title
+{
+ padding: 0em;
+ margin-top: 0.8em;
+ margin-bottom: 0.2em;
+}
+
+.menu-entry
+{
+ font-size: 0.8em;
+}
+
+.class.summary .right
+{
+ vertical-align: top;
+}
+
+.class.summary .right .list
+{
+ vertical-align: top;
+}
+
+.navi
+{
+ padding-top: 0.5em;
+ font-size: x-small;
+}
+
+.navbar .header
+{
+ vertical-align: top;
+}
+
+.navbar .header span
+{
+ border: none;
+ white-space: nowrap;
+ padding-top: 0.2em;
+ padding-bottom: 0.3em;
+ padding-left: 0.5em;
+}
+
+.navbar .header a
+{
+ font-weight: bold;
+ font-size: 11pt;
+}
+
+h1
+{
+ font-size: 1.5em;
+}
+
+h2
+{
+ font-size: 1.3em;
+}
+
+h3
+{
+ font-size: 1.1em;
+}
+
+.summary .right .synopsis
+{
+ padding-left: 5.25em !important;
+ text-indent: -5em !important;
+}
+
+.summary .right .description
+{
+ text-indent: 1em !important;
+ padding-top: 0.25em !important;
+ padding-bottom: 0.1em !important;
+ padding-left: 0.25em !important;
+}
+
+td.usage.summary
+{
+ vertical-align: top;
+}
+
+.index .entry .description
+{
+ padding-left: 3em;
+}
+
+.index .entry .key
+{
+ padding-left: 5.25em;
+ text-indent: -5em;
+}
+
+.dep-list .summary .description
+{
+ padding-top: 0.1em;
+ padding-left: 3em;
+}
+
+.dep-toc .header
+{
+ padding-bottom: 0em;
+ margin-bottom: 0.2em;
+}
+
+.dep-toc .list
+{
+ margin-top: 0em;
+ margin-bottom: 1.5em;
+ padding-top: 0em;
+ padding-bottom: 0em;
+ padding-left: 2em;
+}
+
+ul.tree li.node
+{
+ list-style-type: disc;
+}
+
+ul.tree ul
+{
+ margin-left: 0em;
+ padding-left: 1.8em;
+}
+
+li.level
+{
+ list-style-type: none;
+}
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/htmldoclet/gjdochtml-vanilla.css b/tools/resource/gnu/classpath/tools/gjdoc/htmldoclet/gjdochtml-vanilla.css
new file mode 100644
index 000000000..503207b65
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/htmldoclet/gjdochtml-vanilla.css
@@ -0,0 +1,21 @@
+/* gjdochtml-vanilla.css
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+/* Empty Vanilla Stylesheeet */
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/htmldoclet/help.xhtml b/tools/resource/gnu/classpath/tools/gjdoc/htmldoclet/help.xhtml
new file mode 100644
index 000000000..e1bb453b0
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/htmldoclet/help.xhtml
@@ -0,0 +1,25 @@
+<!-- help.xhtml
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+ -->
+
+<p>
+ Sorry, no help available.
+</p>
+
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/htmldoclet/xhtml11-target10.dtd b/tools/resource/gnu/classpath/tools/gjdoc/htmldoclet/xhtml11-target10.dtd
new file mode 100644
index 000000000..0dd73f783
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/htmldoclet/xhtml11-target10.dtd
@@ -0,0 +1,54 @@
+<!-- xhtml11-strict-target10.dtd
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. -->
+
+<!-- XHTML 1.1 plus Target 1.0 DTD ................................ -->
+
+<!-- File: xhtml11-target10.dtd
+
+ XHTML 1.1 DTD which loads the optional Target 1.0 Module.
+
+ This file is based on a DTD by Jacques Distler. See
+ http://golem.ph.utexas.edu/~distler/blog/files/zeldman.html
+
+ Public and System Identifiers:
+
+ PUBLIC "-//gnu.org//DTD XHTML 1.1 plus Target 1.0//EN"
+ SYSTEM "http://gnu.org/DTD/xhtml11-target10.dtd"
+
+ The corresponding DOCTYPE declaration:
+
+ <!DOCTYPE html
+ PUBLIC "-//gnu.org//DTD XHTML 1.1 plus Target 1.0//EN"
+ "http://gnu.org/DTD/xhtml11-target10.dtd">
+
+ Original idea: Dave H <dmh@dmh.org.uk>
+ http://www.dmh.org.uk/
+
+-->
+<!ENTITY % XHTML.version
+ "-//gnu.org//DTD XHTML 1.1 plus Target 1.0//EN" >
+<!ENTITY % xhtml11.mod
+ PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" >
+%xhtml11.mod;
+<!ENTITY % xhtml-target.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Target 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-target-1.mod" >
+%xhtml-target.mod;
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/java.lang-classes-1.2.txt b/tools/resource/gnu/classpath/tools/gjdoc/java.lang-classes-1.2.txt
new file mode 100644
index 000000000..0e44adf1b
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/java.lang-classes-1.2.txt
@@ -0,0 +1,78 @@
+Cloneable
+Comparable
+Runnable
+Boolean
+Byte
+Character
+Character.Subset
+Character.UnicodeBlock
+Class
+ClassLoader
+Compiler
+Double
+Float
+InheritableThreadLocal
+Integer
+Long
+Math
+Number
+Object
+Package
+Process
+Runtime
+RuntimePermission
+SecurityManager
+Short
+String
+StringBuffer
+System
+Thread
+ThreadGroup
+ThreadLocal
+Throwable
+Void
+ArithmeticException
+ArrayIndexOutOfBoundsException
+ArrayStoreException
+ClassCastException
+ClassNotFoundException
+CloneNotSupportedException
+Exception
+IllegalAccessException
+IllegalArgumentException
+IllegalMonitorStateException
+IllegalStateException
+IllegalThreadStateException
+IndexOutOfBoundsException
+InstantiationException
+InterruptedException
+NegativeArraySizeException
+NoSuchFieldException
+NoSuchMethodException
+NullPointerException
+NumberFormatException
+RuntimeException
+SecurityException
+StringIndexOutOfBoundsException
+UnsupportedOperationException
+AbstractMethodError
+ClassCircularityError
+ClassFormatError
+Error
+ExceptionInInitializerError
+IllegalAccessError
+IncompatibleClassChangeError
+InstantiationError
+InternalError
+LinkageError
+NoClassDefFoundError
+NoSuchFieldError
+NoSuchMethodError
+OutOfMemoryError
+StackOverflowError
+ThreadDeath
+UnknownError
+UnsatisfiedLinkError
+UnsupportedClassVersionError
+VerifyError
+VirtualMachineError
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/java.lang-classes-1.3.txt b/tools/resource/gnu/classpath/tools/gjdoc/java.lang-classes-1.3.txt
new file mode 100644
index 000000000..119423d38
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/java.lang-classes-1.3.txt
@@ -0,0 +1,79 @@
+Cloneable
+Comparable
+Runnable
+Boolean
+Byte
+Character
+Character.Subset
+Character.UnicodeBlock
+Class
+ClassLoader
+Compiler
+Double
+Float
+InheritableThreadLocal
+Integer
+Long
+Math
+Number
+Object
+Package
+Process
+Runtime
+RuntimePermission
+SecurityManager
+Short
+StrictMath
+String
+StringBuffer
+System
+Thread
+ThreadGroup
+ThreadLocal
+Throwable
+Void
+ArithmeticException
+ArrayIndexOutOfBoundsException
+ArrayStoreException
+ClassCastException
+ClassNotFoundException
+CloneNotSupportedException
+Exception
+IllegalAccessException
+IllegalArgumentException
+IllegalMonitorStateException
+IllegalStateException
+IllegalThreadStateException
+IndexOutOfBoundsException
+InstantiationException
+InterruptedException
+NegativeArraySizeException
+NoSuchFieldException
+NoSuchMethodException
+NullPointerException
+NumberFormatException
+RuntimeException
+SecurityException
+StringIndexOutOfBoundsException
+UnsupportedOperationException
+AbstractMethodError
+ClassCircularityError
+ClassFormatError
+Error
+ExceptionInInitializerError
+IllegalAccessError
+IncompatibleClassChangeError
+InstantiationError
+InternalError
+LinkageError
+NoClassDefFoundError
+NoSuchFieldError
+NoSuchMethodError
+OutOfMemoryError
+StackOverflowError
+ThreadDeath
+UnknownError
+UnsatisfiedLinkError
+UnsupportedClassVersionError
+VerifyError
+VirtualMachineError
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/java.lang-classes-1.4.txt b/tools/resource/gnu/classpath/tools/gjdoc/java.lang-classes-1.4.txt
new file mode 100644
index 000000000..81a442d6c
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/java.lang-classes-1.4.txt
@@ -0,0 +1,82 @@
+CharSequence
+Cloneable
+Comparable
+Runnable
+Boolean
+Byte
+Character
+Character.Subset
+Character.UnicodeBlock
+Class
+ClassLoader
+Compiler
+Double
+Float
+InheritableThreadLocal
+Integer
+Long
+Math
+Number
+Object
+Package
+Process
+Runtime
+RuntimePermission
+SecurityManager
+Short
+StackTraceElement
+StrictMath
+String
+StringBuffer
+System
+Thread
+ThreadGroup
+ThreadLocal
+Throwable
+Void
+ArithmeticException
+ArrayIndexOutOfBoundsException
+ArrayStoreException
+ClassCastException
+ClassNotFoundException
+CloneNotSupportedException
+Exception
+IllegalAccessException
+IllegalArgumentException
+IllegalMonitorStateException
+IllegalStateException
+IllegalThreadStateException
+IndexOutOfBoundsException
+InstantiationException
+InterruptedException
+NegativeArraySizeException
+NoSuchFieldException
+NoSuchMethodException
+NullPointerException
+NumberFormatException
+RuntimeException
+SecurityException
+StringIndexOutOfBoundsException
+UnsupportedOperationException
+AbstractMethodError
+AssertionError
+ClassCircularityError
+ClassFormatError
+Error
+ExceptionInInitializerError
+IllegalAccessError
+IncompatibleClassChangeError
+InstantiationError
+InternalError
+LinkageError
+NoClassDefFoundError
+NoSuchFieldError
+NoSuchMethodError
+OutOfMemoryError
+StackOverflowError
+ThreadDeath
+UnknownError
+UnsatisfiedLinkError
+UnsupportedClassVersionError
+VerifyError
+VirtualMachineError
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/java.lang-classes-1.5.txt b/tools/resource/gnu/classpath/tools/gjdoc/java.lang-classes-1.5.txt
new file mode 100644
index 000000000..2439f2e38
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/java.lang-classes-1.5.txt
@@ -0,0 +1,90 @@
+Appendable
+CharSequence
+Cloneable
+Comparable
+Iterable
+Readable
+Runnable
+Thread.UncaughtExceptionHandler
+Boolean
+Byte
+Character
+Character.Subset
+Character.UnicodeBlock
+Class
+ClassLoader
+Compiler
+Double
+Enum
+Float
+InheritableThreadLocal
+Integer
+Long
+Math
+Number
+Object
+Package
+Process
+ProcessBuilder
+Runtime
+RuntimePermission
+SecurityManager
+Short
+StackTraceElement
+StrictMath
+String
+StringBuffer
+StringBuilder
+System
+Thread
+ThreadGroup
+ThreadLocal
+Throwable
+Void
+ArithmeticException
+ArrayIndexOutOfBoundsException
+ArrayStoreException
+ClassCastException
+ClassNotFoundException
+CloneNotSupportedException
+Exception
+IllegalAccessException
+IllegalArgumentException
+IllegalMonitorStateException
+IllegalStateException
+IllegalThreadStateException
+IndexOutOfBoundsException
+InstantiationException
+InterruptedException
+NegativeArraySizeException
+NoSuchFieldException
+NoSuchMethodException
+NullPointerException
+NumberFormatException
+RuntimeException
+SecurityException
+StringIndexOutOfBoundsException
+TypeNotPresentException
+UnsupportedOperationException
+AbstractMethodError
+AssertionError
+ClassCircularityError
+ClassFormatError
+Error
+ExceptionInInitializerError
+IllegalAccessError
+IncompatibleClassChangeError
+InstantiationError
+InternalError
+LinkageError
+NoClassDefFoundError
+NoSuchFieldError
+NoSuchMethodError
+OutOfMemoryError
+StackOverflowError
+ThreadDeath
+UnknownError
+UnsatisfiedLinkError
+UnsupportedClassVersionError
+VerifyError
+VirtualMachineError
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/rng/gjdoc-classdoc.rng b/tools/resource/gnu/classpath/tools/gjdoc/rng/gjdoc-classdoc.rng
new file mode 100644
index 000000000..085710d17
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/rng/gjdoc-classdoc.rng
@@ -0,0 +1,649 @@
+<?xml version="1.0"?>
+
+<!-- gjdoc-classdoc.rng
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. -->
+
+<grammar
+ xmlns="http://relaxng.org/ns/structure/1.0"
+ xmlns:a="http://relaxng.org/ns/annotation/1.0"
+ xmlns:gjdoc="http://www.gnu.org/software/cp-tools/gjdocxml">
+
+ <include href="gjdoc-common.rng"/>
+
+ <a:documentation>
+ The Relax NG grammar for an classdoc XML document generated by
+ GNU Gjdoc.
+ </a:documentation>
+
+ <start>
+ <a:documentation>
+ The root element for a Gjdoc classdoc XML document.
+ </a:documentation>
+
+ <element name="gjdoc:classdoc">
+ <a:documentation>
+ Corresponds to a Javadoc API com.sun.javadoc.ClassDoc
+ object, the subtree of the full generated documentation
+ corresponding to a particular Java class.
+ </a:documentation>
+
+ <ref name="name-attribute"/>
+ <ref name="qualifiedtypename-attribute"/>
+
+ <optional>
+ <ref name="superclass-element"/>
+ </optional>
+
+ <zeroOrMore>
+ <ref name="implements-element"/>
+ </zeroOrMore>
+
+ <zeroOrMore>
+ <ref name="superimplements-element"/>
+ </zeroOrMore>
+
+ <ref name="ProgramElementDocBody"/>
+
+ <optional>
+ <ref name="isAbstract-element"/>
+ </optional>
+
+ <optional>
+ <ref name="isSerializable-element"/>
+ </optional>
+
+ <optional>
+ <ref name="isExternalizable-element"/>
+ </optional>
+
+ <optional>
+ <ref name="definesSerializableFields-element"/>
+ </optional>
+
+ <zeroOrMore>
+ <ref name="constructordoc-element"/>
+ </zeroOrMore>
+
+ <zeroOrMore>
+ <ref name="methoddoc-element"/>
+ </zeroOrMore>
+
+ <zeroOrMore>
+ <ref name="fielddoc-element"/>
+ </zeroOrMore>
+
+ </element>
+
+ </start>
+
+ <!-- The following patterns are "body" patterns for the element
+ patterns below. Their content corresponds to the abstract
+ superclasses of the classes which are represented by the "element"
+ patterns below. -->
+
+ <define name="DocBody">
+ <a:documentation>
+ Corresponds to the abstract class
+ <code>com.sun.javadoc.Doc</code>, the common base class for
+ all documentation classes.
+ </a:documentation>
+
+ <optional>
+ <ref name="isClass-element"/>
+ </optional>
+
+ <optional>
+ <ref name="isConstructor-element"/>
+ </optional>
+
+ <optional>
+ <ref name="isError-element"/>
+ </optional>
+
+ <optional>
+ <ref name="isException-element"/>
+ </optional>
+
+ <optional>
+ <ref name="isField-element"/>
+ </optional>
+
+ <optional>
+ <ref name="isIncluded-element"/>
+ </optional>
+
+ <optional>
+ <ref name="isInterface-element"/>
+ </optional>
+
+ <optional>
+ <ref name="isMethod-element"/>
+ </optional>
+
+ <optional>
+ <ref name="isOrdinaryClass-element"/>
+ </optional>
+
+ <optional>
+ <ref name="inlineTags-element"/>
+ </optional>
+
+ <optional>
+ <ref name="firstSentenceTags-element"/>
+ </optional>
+
+ <optional>
+ <ref name="tags-element"/>
+ </optional>
+
+ <optional>
+ <ref name="seeTags-element"/>
+ </optional>
+
+ </define>
+
+ <define name="ProgramElementDocBody">
+ <a:documentation>
+ Corresponds to the abstract class
+ <code>com.sun.javadoc.ProgramElementDoc</code>.
+ </a:documentation>
+
+ <!-- ... which is derived from class com.sun.javadoc.Doc -->
+ <ref name="DocBody"/>
+
+ <ref name="containingPackage-element"/>
+
+ <optional>
+ <ref name="containingClass-element"/>
+ </optional>
+
+ <ref name="access-element"/>
+
+ <optional>
+ <ref name="isFinal-element"/>
+ </optional>
+
+ <optional>
+ <ref name="isStatic-element"/>
+ </optional>
+
+ </define>
+
+ <define name="MemberDocBody">
+ <a:documentation>
+ Corresponds to the abstract class
+ <code>com.sun.javadoc.MemberDoc</code>.
+ </a:documentation>
+
+ <!-- ... which is derived from class
+ com.sun.javadoc.ProgramElementDoc -->
+ <ref name="ProgramElementDocBody"/>
+
+ </define>
+
+ <define name="ExecutableMemberDocBody">
+ <a:documentation>
+ Corresponds to the abstract class
+ <code>com.sun.javadoc.ExecutableMemberDoc</code>.
+ </a:documentation>
+
+ <!-- ... which is derived from class
+ com.sun.javadoc.MemberDoc -->
+ <ref name="MemberDocBody"/>
+
+ <zeroOrMore>
+ <ref name="parameter-element"/>
+ </zeroOrMore>
+
+ <zeroOrMore>
+ <ref name="thrownException-element"/>
+ </zeroOrMore>
+
+ <ref name="signature-element"/>
+
+ <optional>
+ <ref name="isNative-element"/>
+ </optional>
+
+ <optional>
+ <ref name="isSynchronized-element"/>
+ </optional>
+
+ </define>
+
+ <define name="ConstructorDocBody">
+ <a:documentation>
+ Corresponds to an object of class
+ <code>com.sun.javadoc.ConstructorDoc</code>.
+ </a:documentation>
+
+ <!-- ... which is derived from class
+ com.sun.javadoc.ExecutableMemberDoc -->
+ <ref name="ExecutableMemberDocBody"/>
+
+ </define>
+
+ <define name="MethodDocBody">
+ <a:documentation>
+ Corresponds to an object of class
+ <code>com.sun.javadoc.MethodDoc</code>.
+ </a:documentation>
+
+ <!-- ... which is derived from class
+ com.sun.javadoc.ExecutableMemberDoc -->
+ <ref name="ExecutableMemberDocBody"/>
+
+ <ref name="returns-element"/>
+ </define>
+
+ <define name="FieldDocBody">
+ <a:documentation>
+ Corresponds to an object of class
+ <code>com.sun.javadoc.FieldDoc</code>.
+ </a:documentation>
+
+ <!-- ... which is derived from class
+ com.sun.javadoc.ProgramElementDoc -->
+ <ref name="ProgramElementDocBody"/>
+
+ <optional>
+ <ref name="isTransient-element"/>
+ </optional>
+
+ <optional>
+ <ref name="isVolatile-element"/>
+ </optional>
+
+ <element name="gjdoc:type">
+ <ref name="typedef-attributes"/>
+ </element>
+
+ </define>
+
+
+ <!-- The following patterns define the elements representing
+ concrete classes in the Javadoc API. -->
+
+ <define name="constructordoc-element">
+ <a:documentation>
+ Specifies a constructor of the class.
+ </a:documentation>
+
+ <element name="gjdoc:constructordoc">
+ <ref name="name-attribute"/>
+ <ref name="ConstructorDocBody"/>
+ </element>
+ </define>
+
+ <define name="methoddoc-element">
+ <a:documentation>
+ Specifies a method of the class.
+ </a:documentation>
+
+ <element name="gjdoc:methoddoc">
+ <ref name="name-attribute"/>
+ <ref name="MethodDocBody"/>
+ </element>
+ </define>
+
+ <define name="fielddoc-element">
+ <a:documentation>
+ Specifies a field of the class.
+ </a:documentation>
+
+ <element name="gjdoc:fielddoc">
+ <ref name="name-attribute"/>
+ <ref name="FieldDocBody"/>
+ </element>
+ </define>
+
+ <!-- The following patterns represent the return value of the
+ corresponding boolean getters of various classes in
+ <code>com.sun.javadoc</code>. The presence of each tag denotes a
+ return value of <code>true</code>, absence denotes a return value
+ of <code>false</code>. -->
+
+ <define name="isAbstract-element">
+ <a:documentation>
+ Presence means <code>ClassDoc.isAbstract()</code> returns
+ <code>true</code>.
+ </a:documentation>
+
+ <element name="gjdoc:isAbstract">
+ <empty/>
+ </element>
+ </define>
+
+ <define name="isClass-element">
+ <a:documentation>
+ Presence means <code>Doc.isClass()</code> returns
+ <code>true</code>.
+ </a:documentation>
+
+ <element name="gjdoc:isClass">
+ <empty/>
+ </element>
+ </define>
+
+ <define name="isConstructor-element">
+ <a:documentation>
+ Presence means <code>Doc.isConstructor()</code> returns
+ <code>true</code>.
+ </a:documentation>
+
+ <element name="gjdoc:isConstructor">
+ <empty/>
+ </element>
+ </define>
+
+ <define name="isError-element">
+ <a:documentation>
+ Presence means <code>Doc.isError()</code> returns
+ <code>true</code>.
+ </a:documentation>
+
+ <element name="gjdoc:isError">
+ <empty/>
+ </element>
+ </define>
+
+ <define name="isException-element">
+ <a:documentation>
+ Presence means <code>Doc.isException()</code> returns
+ <code>true</code>.
+ </a:documentation>
+
+ <element name="gjdoc:isException">
+ <empty/>
+ </element>
+ </define>
+
+ <define name="isSerializable-element">
+ <a:documentation>
+ Presence means <code>ClassDoc.isSerializable()</code> returns
+ <code>true</code>.
+ </a:documentation>
+
+ <element name="gjdoc:isSerializable">
+ <empty/>
+ </element>
+ </define>
+
+ <define name="isExternalizable-element">
+ <a:documentation>
+ Presence means <code>ClassDoc.isExternalizable()</code>
+ returns <code>true</code>.
+ </a:documentation>
+
+ <element name="gjdoc:isExternalizable">
+ <empty/>
+ </element>
+ </define>
+
+ <define name="isField-element">
+ <a:documentation>
+ Presence means <code>Doc.isField()</code> returns
+ <code>true</code>.
+ </a:documentation>
+
+ <element name="gjdoc:isField">
+ <empty/>
+ </element>
+ </define>
+
+ <define name="isIncluded-element">
+ <a:documentation>
+ Presence means <code>Doc.isIncluded()</code> returns
+ <code>true</code>.
+ </a:documentation>
+
+ <element name="gjdoc:isIncluded">
+ <empty/>
+ </element>
+ </define>
+
+ <define name="isInterface-element">
+ <a:documentation>
+ Presence means <code>Doc.isInterface()</code> returns
+ <code>true</code>.
+ </a:documentation>
+
+ <element name="gjdoc:isInterface">
+ <empty/>
+ </element>
+ </define>
+
+ <define name="isMethod-element">
+ <a:documentation>
+ Presence means <code>Doc.isMethod()</code> returns
+ <code>true</code>.
+ </a:documentation>
+
+ <element name="gjdoc:isMethod">
+ <empty/>
+ </element>
+ </define>
+
+ <define name="isOrdinaryClass-element">
+ <a:documentation>
+ Presence means <code>Doc.isOrdinaryClass()</code> returns
+ <code>true</code>.
+ </a:documentation>
+
+ <element name="gjdoc:isOrdinaryClass">
+ <empty/>
+ </element>
+ </define>
+
+ <define name="isFinal-element">
+ <a:documentation>
+ Presence means <code>ProgramElementDoc.isFinal()</code>
+ returns <code>true</code>.
+ </a:documentation>
+
+ <element name="gjdoc:isFinal">
+ <empty/>
+ </element>
+ </define>
+
+ <define name="isStatic-element">
+ <a:documentation>
+ Presence means <code>ProgramElementDoc.isStatic()</code>
+ returns <code>true</code>.
+ </a:documentation>
+
+ <element name="gjdoc:isStatic">
+ <empty/>
+ </element>
+ </define>
+
+ <define name="isTransient-element">
+ <a:documentation>
+ Presence means <code>FieldDoc.isTransient()</code>
+ returns <code>true</code>.
+ </a:documentation>
+
+ <element name="gjdoc:isTransient">
+ <empty/>
+ </element>
+ </define>
+
+ <define name="isVolatile-element">
+ <a:documentation>
+ Presence means <code>FieldDoc.isVolatile()</code>
+ returns <code>true</code>.
+ </a:documentation>
+
+ <element name="gjdoc:isVolatile">
+ <empty/>
+ </element>
+ </define>
+
+ <define name="isNative-element">
+ <a:documentation>
+ Presence means <code>ExecutableMemberDoc.isNative()</code>
+ returns <code>true</code>.
+ </a:documentation>
+
+ <element name="gjdoc:isNative">
+ <empty/>
+ </element>
+ </define>
+
+ <define name="isSynchronized-element">
+ <a:documentation>
+ Presence means
+ <code>ExecutableMemberDoc.isSynchronized()</code> returns
+ <code>true</code>.
+ </a:documentation>
+
+ <element name="gjdoc:isSynchronized">
+ <empty/>
+ </element>
+ </define>
+
+ <define name="definesSerializableFields-element">
+ <a:documentation>
+ Presence means
+ <code>ClassDoc.definesSerializableFields()</code> returns
+ <code>true</code>.
+ </a:documentation>
+
+ <element name="gjdoc:definesSerializableFields">
+ <empty/>
+ </element>
+ </define>
+
+ <define name="access-element">
+ <a:documentation>
+ Corresponds to the access modifier (public, protected,
+ private) specified by a ProgramElementDoc.
+ </a:documentation>
+
+ <element name="gjdoc:access">
+ <attribute name="scope">
+ <a:documentation>
+ This value is determined by calling
+ <code>ProgramElementDoc.isPublic()</code>,
+ <code>ProgramElementDoc.isProtected()</code>,
+ <code>ProgramElementDoc.isPrivate()</code> and
+ <code>ProgramElementDoc.isPackagePrivate()</code>.
+ </a:documentation>
+ <choice>
+ <value>public</value>
+ <value>protected</value>
+ <value>private</value>
+ <value>package</value>
+ </choice>
+ </attribute>
+ </element>
+ </define>
+
+ <define name="containingClass-element">
+ <a:documentation>
+ Corresponds to the type returned by a call to
+ <code>com.sun.javadoc.Classdoc.containingClass()</code>.
+ </a:documentation>
+
+ <element name="gjdoc:containingClass">
+ <a:documentation>
+ The full name of the outer class containing the class, if
+ this class is an inner class.
+ </a:documentation>
+ <ref name="typedef-attributes"/>
+ </element>
+ </define>
+
+ <define name="parameter-element">
+ <a:documentation>
+ Corresponds to an entry in the array returned by a
+ <code>com.sun.javadoc.ExecutableMemberDoc.parameters()</code>.
+ </a:documentation>
+
+ <element name="gjdoc:parameter">
+ <a:documentation>
+ A parameter for a method or constructor call.
+ </a:documentation>
+ <ref name="name-attribute"/>
+ <optional>
+ <ref name="typedef-attributes"/>
+ </optional>
+ </element>
+ </define>
+
+ <define name="thrownException-element">
+ <a:documentation>
+ Corresponds to an entry in the array returned by a
+ <code>com.sun.javadoc.ExecutableMemberDoc.thrownExceptions()</code>.
+ </a:documentation>
+
+ <element name="gjdoc:thrownException">
+ <a:documentation>
+ An exception thrown by a method or constructor.
+ </a:documentation>
+ <ref name="typedef-attributes"/>
+ </element>
+ </define>
+
+
+ <define name="signature-element">
+ <a:documentation>
+ Corresponds to the signature specified by a
+ <code>com.sun.javadoc.MethodDoc</code>.
+ </a:documentation>
+
+ <element name="gjdoc:signature">
+ <a:documentation>
+ The signature of a method or constructor.
+ </a:documentation>
+ <attribute name="full">
+ <a:documentation>
+ The full signature of a method or constructor, as
+ returned by
+ <code>com.sun.javadoc.ExecutableMemberDoc.signature()</code>.
+ </a:documentation>
+ <text/>
+ </attribute>
+ <attribute name="flat">
+ <a:documentation>
+ The "flat" signature of a method or constructor, as
+ returned by
+ <code>com.sun.javadoc.ExecutableMemberDoc.flatSignature()</code>.
+ </a:documentation>
+ <text/>
+ </attribute>
+ </element>
+ </define>
+
+ <define name="returns-element">
+ <a:documentation>
+ Corresponds to the type returned by
+ <code>com.sun.javadoc.MethodDoc.returnType()</code>.
+ </a:documentation>
+
+ <element name="gjdoc:returns">
+ <a:documentation>
+ The type returned by a method.
+ </a:documentation>
+
+ <ref name="typedef-attributes"/>
+ </element>
+ </define>
+</grammar>
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/rng/gjdoc-common.rng b/tools/resource/gnu/classpath/tools/gjdoc/rng/gjdoc-common.rng
new file mode 100644
index 000000000..85ffc1d91
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/rng/gjdoc-common.rng
@@ -0,0 +1,264 @@
+<?xml version="1.0"?>
+
+<!-- gjdoc-common.rng
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. -->
+
+<grammar
+ xmlns="http://relaxng.org/ns/structure/1.0"
+ xmlns:a="http://relaxng.org/ns/annotation/1.0"
+ xmlns:gjdoc="http://www.gnu.org/software/cp-tools/gjdocxml">
+
+ <a:documentation>
+ A Relax NG grammar with definitions of elements and attributes
+ used by both the XML index file and the XML class files
+ generated by GNU Gjdoc.
+ </a:documentation>
+
+ <define name="firstSentenceTags-element">
+ <a:documentation>
+
+ </a:documentation>
+
+ <element name="gjdoc:firstSentenceTags">
+ <ref name="tags-contents"/>
+ </element>
+ </define>
+
+ <define name="inlineTags-element">
+ <a:documentation>
+
+ </a:documentation>
+
+ <element name="gjdoc:inlineTags">
+ <ref name="tags-contents"/>
+ </element>
+ </define>
+
+ <define name="seeTags-element">
+ <a:documentation>
+
+ </a:documentation>
+
+ <element name="gjdoc:seeTags">
+ <ref name="tags-contents"/>
+ </element>
+ </define>
+
+
+ <define name="tags-element">
+ <a:documentation>
+
+ </a:documentation>
+
+ <element name="gjdoc:tags">
+ <ref name="tags-contents"/>
+ </element>
+ </define>
+
+ <define name="tags-contents">
+ <a:documentation>
+ Specifies mixed content comprised of gjdoc tags,
+ HTML tags, taglet output, and text.
+ </a:documentation>
+
+ <zeroOrMore>
+ <ref name="TagContent"/>
+ </zeroOrMore>
+ </define>
+
+ <define name="implements-element">
+ <element name="gjdoc:implements">
+ <a:documentation>
+ Specifies an interface that the class implements.
+ </a:documentation>
+
+ <ref name="typedef-attributes"/>
+ </element>
+ </define>
+
+
+ <define name="superimplements-element">
+ <element name="gjdoc:superimplements">
+ <a:documentation>
+ Specifies an interface implemented by superclasses
+ (ancestors) of the class. Together with the interfaces
+ specified with tag `implements', this lists all interfaces
+ the class can be cast to.
+ </a:documentation>
+
+ <ref name="typedef-attributes"/>
+ </element>
+ </define>
+
+ <define name="typedef-attributes">
+ <attribute name="typename">
+ <a:documentation>
+ The name of the class, without package prefix. If the
+ class is an inner class, this includes the name of its
+ outer class.
+ </a:documentation>
+
+ <text/>
+ </attribute>
+
+ <ref name="qualifiedtypename-attribute"/>
+
+ <optional>
+ <attribute name="dimension">
+ <a:documentation>
+ The dimension of this typedef, represented by a zero or
+ more repetitions of the string "[]".
+ </a:documentation>
+
+ <text/>
+ </attribute>
+ </optional>
+ </define>
+
+ <define name="name-attribute">
+ <attribute name="name">
+ <a:documentation>
+ The name of some Java Entity (package, class, constructor,
+ method, field.)
+ </a:documentation>
+
+ <text/>
+ </attribute>
+ </define>
+
+ <define name="qualifiedtypename-attribute">
+ <attribute name="qualifiedtypename">
+ <a:documentation>
+ The fully qualified name of the class.
+ </a:documentation>
+
+ <text/>
+ </attribute>
+ </define>
+
+ <define name="superclass-element">
+ <element name="gjdoc:superclass">
+ <a:documentation>
+ Specifies the superclass of the class.
+ </a:documentation>
+
+ <ref name="typedef-attributes"/>
+ </element>
+ </define>
+
+ <define name="tag-element">
+ <element name="gjdoc:tag">
+ <ref name="name-attribute"/>
+ <attribute name="kind">
+ <text/>
+ </attribute>
+ <zeroOrMore>
+ <ref name="TagContent"/>
+ </zeroOrMore>
+ </element>
+ </define>
+
+ <define name="exception-element">
+ <element name="gjdoc:exception">
+ <ref name="typedef-attributes"/>
+ </element>
+ </define>
+
+ <define name="TagContent">
+ <choice>
+ <element>
+ <anyName>
+ <except>
+ <nsName ns="gjdoc"/>
+ <name>gjdoc:tag</name>
+ </except>
+ </anyName>
+ <zeroOrMore>
+ <attribute>
+ <anyName/>
+ </attribute>
+ </zeroOrMore>
+ <zeroOrMore>
+ <choice>
+ <text/>
+ <ref name="TagContent"/>
+ </choice>
+ </zeroOrMore>
+ </element>
+ <ref name="tag-element"/>
+ <ref name="exception-element"/>
+ <ref name="tagletText-element"/>
+ <text/>
+ </choice>
+ </define>
+
+ <define name="containingPackage-element">
+ <element name="gjdoc:containingPackage">
+ <a:documentation>
+ The full name of the package containing the class.
+ </a:documentation>
+ <attribute name="name">
+ <text/>
+ </attribute>
+ </element>
+ </define>
+
+ <define name="tagletText-element">
+ <element name="gjdoc:tagletText">
+ <a:documentation>
+ A string generated by a Taglet.toString() method.
+ </a:documentation>
+ <attribute name="tagName">
+ <a:documentation>
+ The name of the tag this Taglet was assigned to.
+ </a:documentation>
+ <text/>
+ </attribute>
+ </element>
+ </define>
+
+ <define name="isError-element">
+ <element name="gjdoc:isError">
+ <a:documentation>
+ Exists when the described class is a subclass of
+ java.lang.Error.
+ </a:documentation>
+ </element>
+ </define>
+
+ <define name="isException-element">
+ <element name="gjdoc:isException">
+ <a:documentation>
+ Exists when the described class is a subclass of
+ java.lang.Exception.
+ </a:documentation>
+ </element>
+ </define>
+
+ <define name="isInterface-element">
+ <element name="gjdoc:isInterface">
+ <a:documentation>
+ Exists when the described class is an interface.
+ </a:documentation>
+ </element>
+ </define>
+
+</grammar>
+
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/rng/gjdoc-index.rng b/tools/resource/gnu/classpath/tools/gjdoc/rng/gjdoc-index.rng
new file mode 100644
index 000000000..b78855695
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/rng/gjdoc-index.rng
@@ -0,0 +1,176 @@
+<?xml version="1.0"?>
+
+<!-- gjdoc-index.rng
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. -->
+
+<grammar
+ xmlns="http://relaxng.org/ns/structure/1.0"
+ xmlns:a="http://relaxng.org/ns/annotation/1.0"
+ xmlns:gjdoc="http://www.gnu.org/software/cp-tools/gjdocxml">
+
+ <include href="gjdoc-common.rng"/>
+
+ <a:documentation>
+ The Relax NG grammar for the XML index file generated by GNU
+ Gjdoc.
+ </a:documentation>
+
+ <start>
+ <a:documentation>
+ The root element for a Gjdoc index XML document.
+ </a:documentation>
+
+ <element name="gjdoc:rootdoc">
+ <a:documentation>
+ Corresponds to the Javadoc API RootDoc object, the root of
+ the generated documentation.
+ </a:documentation>
+
+ <zeroOrMore>
+ <ref name="specifiedclass-element"/>
+ </zeroOrMore>
+
+ <zeroOrMore>
+ <ref name="specifiedpackage-element"/>
+ </zeroOrMore>
+
+ <zeroOrMore>
+ <ref name="packagedoc-element"/>
+ </zeroOrMore>
+
+ <zeroOrMore>
+ <ref name="classdoc-element"/>
+ </zeroOrMore>
+ </element>
+ </start>
+
+ <define name="containsClass-element">
+ <element name="gjdoc:containsClass">
+ <a:documentation>
+ Corresponds to a class contained in a package or in
+ another class.
+ </a:documentation>
+
+ <ref name="qualifiedtypename-attribute"/>
+ </element>
+ </define>
+
+ <define name="specifiedclass-element">
+ <element name="gjdoc:specifiedclass">
+ <a:documentation>
+ Corresponds to a class named on the Gjdoc command
+ line. This is a class the user explicitly wants
+ documentation generated for.
+ </a:documentation>
+
+ <attribute name="name">
+ <a:documentation>
+ The name of the class as given by the user on the command
+ line. (CHECK)
+ </a:documentation>
+
+ <text/>
+ </attribute>
+ </element>
+ </define>
+
+ <define name="specifiedpackage-element">
+ <element name="gjdoc:specifiedpackage">
+ <a:documentation>
+ Corresponds to a package named on the Gjdoc command
+ line. This is a package the user explicitly wants
+ documentation generated for.
+ </a:documentation>
+
+ <attribute name="name">
+ <a:documentation>
+ The full name of the package.
+ </a:documentation>
+
+ <text/>
+ </attribute>
+ </element>
+ </define>
+
+ <define name="packagedoc-element">
+ <element name="gjdoc:packagedoc">
+ <a:documentation>
+ Corresponds to a package for which XML documentation
+ has been generated. This is not necessarily a package
+ the user requested generation for.
+ </a:documentation>
+
+ <ref name="name-attribute"/>
+ <ref name="firstSentenceTags-element"/>
+
+ <zeroOrMore>
+ <ref name="containsClass-element"/>
+ </zeroOrMore>
+ </element>
+ </define>
+
+ <define name="classdoc-element">
+ <element name="gjdoc:classdoc">
+ <a:documentation>
+ Corresponds to a class for which XML documentation has
+ been generated.
+ </a:documentation>
+
+ <ref name="name-attribute"/>
+ <ref name="qualifiedtypename-attribute"/>
+
+ <optional>
+ <a:documentation>
+ The following is optional because the root class
+ java.lang.Object does not have a superclass. For all
+ other classes, this element should be specified.
+ </a:documentation>
+
+ <ref name="superclass-element"/>
+ </optional>
+
+ <zeroOrMore>
+ <ref name="implements-element"/>
+ </zeroOrMore>
+
+ <zeroOrMore>
+ <ref name="superimplements-element"/>
+ </zeroOrMore>
+
+ <ref name="containingPackage-element"/>
+
+ <zeroOrMore>
+ <ref name="isError-element"/>
+ </zeroOrMore>
+
+ <zeroOrMore>
+ <ref name="isException-element"/>
+ </zeroOrMore>
+
+ <zeroOrMore>
+ <ref name="isInterface-element"/>
+ </zeroOrMore>
+
+ <zeroOrMore>
+ <ref name="containsClass-element"/>
+ </zeroOrMore>
+ </element>
+ </define>
+</grammar>
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/version.properties b/tools/resource/gnu/classpath/tools/gjdoc/version.properties
new file mode 100644
index 000000000..3e74746d3
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/version.properties
@@ -0,0 +1 @@
+gjdoc.version=0.7.9
diff --git a/tools/resource/gnu/classpath/tools/gjdoc/version.properties.in b/tools/resource/gnu/classpath/tools/gjdoc/version.properties.in
new file mode 100644
index 000000000..7795e10d8
--- /dev/null
+++ b/tools/resource/gnu/classpath/tools/gjdoc/version.properties.in
@@ -0,0 +1 @@
+gjdoc.version=@VERSION@