Commit 83fc120e authored by Dimitri van Heesch's avatar Dimitri van Heesch

Minor changes to the way the code for config options is generated (thanks to Albert for the patch)

parent e2597756
......@@ -15,4 +15,13 @@ bool parseConfig(
void writeStringValue(QTextStream &t,QTextCodec *codec,const QString &s);
// directly copied from ../../src/config.h to be consistent
enum
{
/*! Maximum length of an option in the config file. Used for
* alignment purposes.
*/
MAX_OPTION_LENGTH = 23
};
#endif
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -112,7 +112,8 @@ void Expert::createTopics(const QDomElement &rootElem)
{
if (childElem.tagName()==SA("group"))
{
QString name = childElem.attribute(SA("name"));
// Remove _ from a group name like: Source_Browser
QString name = childElem.attribute(SA("name")).replace(SA("_"),SA(" "));
items.append(new QTreeWidgetItem((QTreeWidget*)0,QStringList(name)));
QWidget *widget = createTopicWidget(childElem);
m_topics[name] = widget;
......@@ -144,7 +145,7 @@ static QString getDocsForNode(const QDomElement &child)
QDomText t = n.toText();
if (!t.isNull()) docs+=t.data();
}
docs+=SA("<br/>");
docs += SA("<br/>");
}
docsVal = docsVal.nextSiblingElement();
}
......@@ -152,6 +153,7 @@ static QString getDocsForNode(const QDomElement &child)
// for an enum we list the values
if (type==SA("enum"))
{
docs += SA("<br/>");
docs += SA("Possible values are: ");
int numValues=0;
docsVal = child.firstChildElement();
......@@ -192,29 +194,35 @@ static QString getDocsForNode(const QDomElement &child)
docsVal = docsVal.nextSiblingElement();
}
docs+=SA("<br/>");
docs+=SA("The default value is: <code>")+
docs+=SA("<br/>");
docs+=SA(" The default value is: <code>")+
child.attribute(SA("defval"))+
SA("</code>.");
docs+= SA("<br/>");
}
else if (type==SA("int"))
{
docs+=SA("<br/>");
docs+=SA("Minimum value: ")+child.attribute(SA("minval"))+SA(", ");
docs+=SA("maximum value: ")+child.attribute(SA("maxval"))+SA(", ");
docs+=SA("default value: ")+child.attribute(SA("defval"))+SA(".");
docs+= SA("<br/>");
}
else if (type==SA("bool"))
{
docs+=SA("<br/>");
if (child.hasAttribute(SA("altdefval")))
{
docs+=SA("The default value is: system dependent.");
docs+=SA(" The default value is: system dependent.");
}
else
{
QString defval = child.attribute(SA("defval"));
docs+=SA("The default value is: <code>")+
docs+=SA(" The default value is: <code>")+
(defval==SA("1")?SA("YES"):SA("NO"))+
SA("</code>.");
}
docs+= SA("<br/>");
}
else if (type==SA("list"))
{
......@@ -226,7 +234,12 @@ static QString getDocsForNode(const QDomElement &child)
{
if (docsVal.tagName()==SA("value"))
{
if (docsVal.attribute(SA("name"))!=SA("")) numValues++;
QString showDocu = SA("");
if (docsVal.hasAttribute(SA("show_docu")))
{
showDocu = docsVal.attribute(SA("show_docu")).toLower();
}
if ((showDocu != SA("no")) && (docsVal.attribute(SA("name"))!=SA(""))) numValues++;
}
docsVal = docsVal.nextSiblingElement();
}
......@@ -238,29 +251,38 @@ static QString getDocsForNode(const QDomElement &child)
{
if (docsVal.tagName()==SA("value"))
{
i++;
docs += SA("<code>") + docsVal.attribute(SA("name")) + SA("</code>");
QString desc = docsVal.attribute(SA("desc"));
if (desc != SA(""))
{
docs += SA(" ") + desc;
}
if (i==numValues-1)
QString showDocu = SA("");
if (docsVal.hasAttribute(SA("show_docu")))
{
docs += SA(" and ");
showDocu = docsVal.attribute(SA("show_docu")).toLower();
}
else if (i==numValues)
if ((showDocu != SA("no")) && (docsVal.attribute(SA("name"))!=SA("")))
{
docs += SA(".");
}
else
{
docs += SA(", ");
i++;
docs += SA("<code>") + docsVal.attribute(SA("name")) + SA("</code>");
QString desc = docsVal.attribute(SA("desc"));
if (desc != SA(""))
{
docs += SA(" ") + desc;
}
if (i==numValues-1)
{
docs += SA(" and ");
}
else if (i==numValues)
{
docs += SA(".");
}
else
{
docs += SA(", ");
}
}
}
docsVal = docsVal.nextSiblingElement();
}
}
// docs+= SA("<br/>");
}
}
else if (type==SA("string"))
......@@ -270,7 +292,9 @@ static QString getDocsForNode(const QDomElement &child)
{
if (defval != SA(""))
{
docs += SA("The default directory is: <code>") + defval + SA("</code>.");
docs+=SA("<br/>");
docs += SA(" The default directory is: <code>") + defval + SA("</code>.");
docs += SA("<br/>");
}
}
else if (child.attribute(SA("format")) == SA("file"))
......@@ -278,20 +302,24 @@ static QString getDocsForNode(const QDomElement &child)
QString abspath = child.attribute(SA("abspath"));
if (defval != SA(""))
{
docs+=SA("<br/>");
if (abspath != SA("1"))
{
docs += SA("The default file is: <code>") + defval + SA("</code>.");
docs += SA(" The default file is: <code>") + defval + SA("</code>.");
}
else
{
docs += SA("The default file (with absolute path) is: <code>") + defval + SA("</code>.");
docs += SA(" The default file (with absolute path) is: <code>") + defval + SA("</code>.");
}
docs += SA("<br/>");
}
else
{
if (abspath == SA("1"))
{
docs += SA("The file has to be specified with full path.");
docs+=SA("<br/>");
docs += SA(" The file has to be specified with full path.");
docs += SA("<br/>");
}
}
}
......@@ -299,7 +327,9 @@ static QString getDocsForNode(const QDomElement &child)
{
if (defval != SA(""))
{
docs += SA("The default value is: <code>") + defval + SA("</code>.");
docs+=SA("<br/>");
docs += SA(" The default value is: <code>") + defval + SA("</code>.");
docs += SA("<br/>");
}
}
}
......@@ -307,8 +337,8 @@ static QString getDocsForNode(const QDomElement &child)
if (child.hasAttribute(SA("depends")))
{
QString dependsOn = child.attribute(SA("depends"));
docs += SA("<br/>");
docs+= SA("This tag requires that the tag \\ref cfg_");
docs+=SA("<br/>");
docs+= SA(" This tag requires that the tag \\ref cfg_");
docs+= dependsOn.toLower();
docs+= SA(" \"");
docs+= dependsOn.toUpper();
......@@ -324,13 +354,22 @@ static QString getDocsForNode(const QDomElement &child)
// remove <br> at end
regexp.setPattern(SA("<br> *$"));
docs.replace(regexp,SA(" "));
// \c word -> <code>word</code>
// \c word -> <code>word</code>; word ends with ')', ',', '.' or ' '
regexp.setPattern(SA("\\\\c[ ]+([^ \\)]+)\\)"));
docs.replace(regexp,SA("<code>\\1</code>)"));
regexp.setPattern(SA("\\\\c[ ]+([^ ,]+),"));
docs.replace(regexp,SA("<code>\\1</code>,"));
regexp.setPattern(SA("\\\\c[ ]+([^ \\.]+)\\."));
docs.replace(regexp,SA("<code>\\1</code>."));
regexp.setPattern(SA("\\\\c[ ]+([^ ]+) "));
docs.replace(regexp,SA("<code>\\1</code> "));
// `word` -> <code>word</code>
docs.replace(SA("``"),SA(""));
regexp.setPattern(SA("`([^`]+)`"));
docs.replace(regexp,SA("<code>\\1</code> "));
docs.replace(regexp,SA("<code>\\1</code>"));
// \ref key "desc" -> <code>desc</code>
regexp.setPattern(SA("\\\\ref[ ]+[^ ]+[ ]+\"([^ ]+)\""));
docs.replace(regexp,SA("<code>\\1</code> "));
......@@ -683,7 +722,7 @@ void Expert::saveTopic(QTextStream &t,QDomElement &elem,QTextCodec *codec,
t << convertToComment(option->templateDocs());
t << endl;
}
t << name.leftJustified(23) << "= ";
t << name.leftJustified(MAX_OPTION_LENGTH) << "= ";
if (option)
{
option->writeValue(t,codec);
......@@ -744,9 +783,10 @@ void Expert::showHelp(Input *option)
m_helper->setText(
QString::fromAscii("<qt><b>")+option->id()+
QString::fromAscii("</b><br>")+
QString::fromAscii("<br/>")+
option->docs().
replace(QChar::fromAscii('\n'),QChar::fromAscii(' '))+
QString::fromAscii("<qt>")
QString::fromAscii("</qt>")
);
m_inShowHelp = FALSE;
}
......
This diff is collapsed.
......@@ -734,11 +734,11 @@ Go to the <a href="commands.html">next</a> section or return to the
entities in documentation are documented, even if no documentation was
available. Private class members and static file members will be hidden
unless the \ref cfg_extract_private "EXTRACT_PRIVATE" respectively
\ref cfg_extract_static "EXTRACT_STATIC" tags are set to \c YES
\ref cfg_extract_static "EXTRACT_STATIC" tags are set to \c YES.
\note This will also disable the warnings about undocumented members
that are normally produced when \ref cfg_warnings "WARNINGS" is
set to \c YES
set to \c YES.
]]>
</docs>
</option>
......@@ -1038,7 +1038,7 @@ Go to the <a href="commands.html">next</a> section or return to the
<![CDATA[
Set the \c SHOW_FILES tag to \c NO to disable the generation of the Files page.
This will remove the Files entry from the Quick Index and from the
Folder Tree View (if specified). The default is \c YES.
Folder Tree View (if specified).
]]>
</docs>
</option>
......@@ -1047,7 +1047,7 @@ Go to the <a href="commands.html">next</a> section or return to the
<![CDATA[
Set the \c SHOW_NAMESPACES tag to \c NO to disable the generation of the
Namespaces page. This will remove the Namespaces entry from the Quick Index
and from the Folder Tree View (if specified). The default is \c YES.
and from the Folder Tree View (if specified).
]]>
</docs>
</option>
......@@ -1131,8 +1131,7 @@ FILE_VERSION_INFO = "cleartool desc -fmt \%Vn"
<docs>
<![CDATA[
The \c QUIET tag can be used to turn on/off the messages that are generated
to standard output by doxygen. Possible values are \c YES and \c NO,
where \c YES implies that the messages are off.
to standard output by doxygen. If \c QUIET is set to \c YES this implies that the messages are off.
]]>
</docs>
</option>
......@@ -1140,8 +1139,8 @@ FILE_VERSION_INFO = "cleartool desc -fmt \%Vn"
<docs>
<![CDATA[
The \c WARNINGS tag can be used to turn on/off the warning messages that are
generated to standard error (\c stderr) by doxygen. Possible values are \c YES and \c NO,
where \c YES implies that the warnings are on.
generated to standard error (\c stderr) by doxygen. If \c WARNINGS is set to
\c YES this implies that the warnings are on.
<br>
\b Tip: Turn warnings on while writing the documentation.
]]>
......@@ -1196,7 +1195,7 @@ FILE_VERSION_INFO = "cleartool desc -fmt \%Vn"
<![CDATA[
The \c WARN_LOGFILE tag can be used to specify a file to which warning
and error messages should be written. If left blank the output is written
to standard error (\c stderr).
to standard error (`stderr`).
]]>
</docs>
</option>
......@@ -1282,8 +1281,7 @@ FILE_VERSION_INFO = "cleartool desc -fmt \%Vn"
<docs>
<![CDATA[
The \c RECURSIVE tag can be used to specify whether or not subdirectories
should be searched for input files as well. Possible values are \c YES
and \c NO.
should be searched for input files as well.
]]>
</docs>
</option>
......@@ -1350,7 +1348,7 @@ FILE_VERSION_INFO = "cleartool desc -fmt \%Vn"
blank all files are included.
]]>
</docs>
<value name='*'/>
<value name='*' show_docu='NO'/>
</option>
<option type='bool' id='EXAMPLE_RECURSIVE' defval='0'>
<docs>
......@@ -1829,7 +1827,6 @@ hr.footer {
see http://en.wikipedia.org/wiki/Hue for more information.
For instance the value 0 represents red, 60 is yellow, 120 is green,
180 is cyan, 240 is blue, 300 purple, and 360 is red again.
The allowed range is 0 to 359.
]]>
</docs>
</option>
......@@ -2746,7 +2743,7 @@ front of it.
</docs>
</option>
</group>
<group name='DEF' docs='Configuration options for the AutoGen Definitions output'>
<group name='AutoGen' docs='Configuration options for the AutoGen Definitions output'>
<option type='bool' id='GENERATE_AUTOGEN_DEF' defval='0'>
<docs>
<![CDATA[
......
......@@ -73,6 +73,10 @@ def transformDocs(doc):
# <br> will be removed later on again, we need it here otherwise splitlines
# will filter the extra line.
doc = doc.replace("<br>", "\n<br>\n")
# a dirty trick to go to the next line in Doxyfile documentation.
# <br/> will be removed later on again, we need it here otherwise splitlines
# will filter the line break.
doc = doc.replace("<br/>", "\n<br/>\n")
#
doc = doc.splitlines()
split_doc = []
......@@ -82,7 +86,8 @@ def transformDocs(doc):
# and start string at next line
docC = []
for line in split_doc:
docC.append(line.strip().replace('\\', '\\\\').
if (line.strip() != "<br/>"):
docC.append(line.strip().replace('\\', '\\\\').
replace('"', '\\"').replace("<br>", ""))
return docC
......@@ -93,11 +98,12 @@ def collectValues(node):
if (n.nodeName == "value"):
if n.nodeType == Node.ELEMENT_NODE:
if n.getAttribute('name') != "":
name = "<code>" + n.getAttribute('name') + "</code>"
desc = n.getAttribute('desc')
if (desc != ""):
name += " " + desc
values.append(name)
if n.getAttribute('show_docu') != "NO":
name = "<code>" + n.getAttribute('name') + "</code>"
desc = n.getAttribute('desc')
if (desc != ""):
name += " " + desc
values.append(name)
return values
......@@ -142,7 +148,7 @@ def prepCDocs(node):
doc += parseDocs(n)
if (type == 'enum'):
values = collectValues(node)
doc += "Possible values are: "
doc += "<br/>Possible values are: "
rng = len(values)
for i in range(rng):
val = values[i]
......@@ -153,19 +159,18 @@ def prepCDocs(node):
else:
doc += "%s, " % (val)
if (defval != ""):
doc += "<br>"
doc += "The default value is: <code>%s</code>." % (defval)
doc += "<br/>The default value is: <code>%s</code>." % (defval)
elif (type == 'int'):
minval = node.getAttribute('minval')
maxval = node.getAttribute('maxval')
doc += "%s: %s, %s: %s, %s: %s." % (" Minimum value", minval,
doc += "<br/>%s: %s, %s: %s, %s: %s." % (" Minimum value", minval,
"maximum value", maxval,
"default value", defval)
elif (type == 'bool'):
if (node.hasAttribute('altdefval')):
doc += "%s: %s." % ("Default value", "system dependent")
doc += "<br/>%s: %s." % ("The default value is", "system dependent")
else:
doc += "%s: %s." % ("Default value", "YES" if (defval == "1") else "NO")
doc += "<br/>%s: %s." % ("The default value is", "YES" if (defval == "1") else "NO")
elif (type == 'list'):
if format == 'string':
values = collectValues(node)
......@@ -181,30 +186,29 @@ def prepCDocs(node):
elif (type == 'string'):
if format == 'dir':
if defval != '':
doc += "The default directory is: <code>%s</code>." % (
doc += "<br/>The default directory is: <code>%s</code>." % (
defval)
elif format == 'file':
abspath = node.getAttribute('abspath')
if defval != '':
if abspath != '1':
doc += "The default file is: <code>%s</code>." % (
doc += "<br/>The default file is: <code>%s</code>." % (
defval)
else:
doc += "%s: %s%s%s." % (
doc += "<br/>%s: %s%s%s." % (
"The default file (with absolute path) is",
"<code>",defval,"</code>")
else:
if abspath == '1':
doc += "The file has to be specified with full path."
doc += "<br/>The file has to be specified with full path."
else: # format == 'string':
if defval != '':
doc += "The default value is: <code>%s</code>." % (
doc += "<br/>The default value is: <code>%s</code>." % (
defval)
# depends handling
if (node.hasAttribute('depends')):
depends = node.getAttribute('depends')
doc += "<br>"
doc += "%s \\ref cfg_%s \"%s\" is set to \\c YES." % (
doc += "<br/>%s \\ref cfg_%s \"%s\" is set to \\c YES." % (
"This tag requires that the tag", depends.lower(), depends.upper())
docC = transformDocs(doc)
......@@ -392,6 +396,7 @@ def parseOptionDoc(node, first):
else:
print "%s, " % (val)
if (defval != ""):
print ""
print ""
print "The default value is: <code>%s</code>." % (defval)
print ""
......@@ -399,15 +404,17 @@ def parseOptionDoc(node, first):
minval = node.getAttribute('minval')
maxval = node.getAttribute('maxval')
print ""
print ""
print "%s: %s%s%s, %s: %s%s%s, %s: %s%s%s." % (
" Minimum value", "<code>", minval, "</code>",
"maximum value", "<code>", maxval, "</code>",
"default value", "<code>", defval, "</code>")
print ""
elif (type == 'bool'):
print ""
print ""
if (node.hasAttribute('altdefval')):
print "Default value is system dependent."
print "The default value is: system dependent."
else:
print "The default value is: <code>%s</code>." % (
"YES" if (defval == "1") else "NO")
......@@ -428,11 +435,13 @@ def parseOptionDoc(node, first):
elif (type == 'string'):
if format == 'dir':
if defval != '':
print ""
print "The default directory is: <code>%s</code>." % (
defval)
elif format == 'file':
abspath = node.getAttribute('abspath')
if defval != '':
print ""
if abspath != '1':
print "The default file is: <code>%s</code>." % (
defval)
......@@ -442,15 +451,18 @@ def parseOptionDoc(node, first):
"<code>",defval,"</code>")
else:
if abspath == '1':
print ""
print "The file has to be specified with full path."
else: # format == 'string':
if defval != '':
print ""
print "The default value is: <code>%s</code>." % (
defval)
print ""
# depends handling
if (node.hasAttribute('depends')):
depends = node.getAttribute('depends')
print ""
print "%s \\ref cfg_%s \"%s\" is set to \\c YES." % (
"This tag requires that the tag", depends.lower(), depends.upper())
return False
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -9780,7 +9780,7 @@ static void usage(const char *name)
msg(" LaTeX: %s -w latex headerFile footerFile styleSheetFile [configFile]\n\n",name);
msg("6) Use doxygen to generate an rtf extensions file\n");
msg(" RTF: %s -e rtf extensionsFile\n\n",name);
msg("If -s is specified the comments in the config file will be omitted.\n");
msg("If -s is specified the comments of the configuration items in the config file will be omitted.\n");
msg("If configName is omitted `Doxyfile' will be used as a default.\n\n");
exit(1);
}
......
......@@ -24,7 +24,9 @@ The format of the configuration file (options and types) is defined
by the file `config.xml`. As part of the build process,
the python script `configgen.py` will create a file configoptions.cpp
from this, which serves as the input for the configuration file parser
that is invoked using Config::parse()
that is invoked using Config::parse(). The script `configgen.py` will also
create the documentation for the configuration items, creating the file
`config.doc`.
Gathering Input files
---------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment