📄 driver.java
字号:
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");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -