summaryrefslogtreecommitdiffstats
path: root/src/doxygen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/doxygen.cpp')
-rw-r--r--src/doxygen.cpp132
1 files changed, 106 insertions, 26 deletions
diff --git a/src/doxygen.cpp b/src/doxygen.cpp
index 8600a30..e127b8e 100644
--- a/src/doxygen.cpp
+++ b/src/doxygen.cpp
@@ -100,6 +100,9 @@
#include "context.h"
#include "fileparser.h"
+// provided by the generated file resources.cpp
+extern void initResources();
+
#define RECURSE_ENTRYTREE(func,var) \
do { if (var->children()) { \
EntryNavListIterator eli(*var->children()); \
@@ -1007,6 +1010,7 @@ static Definition *buildScopeFromQualifiedName(const QCString name,
while (i<level)
{
int idx=getScopeFragment(name,p,&l);
+ if (idx==-1) return prevScope;
QCString nsName = name.mid(idx,l);
if (nsName.isEmpty()) return prevScope;
if (!fullScope.isEmpty()) fullScope+="::";
@@ -1334,7 +1338,7 @@ static void addClassToContext(EntryNav *rootNav)
{
tArgList = getTemplateArgumentsFromName(fullName,root->tArgLists);
}
- cd=new ClassDef(root->fileName,root->startLine,root->startColumn,
+ cd=new ClassDef(tagInfo?tagName:root->fileName,root->startLine,root->startColumn,
fullName,sec,tagName,refFileName,TRUE,root->spec&Entry::Enum);
Debug::print(Debug::Classes,0," New class `%s' (sec=0x%08x)! #tArgLists=%d tagInfo=%p\n",
fullName.data(),sec,root->tArgLists ? (int)root->tArgLists->count() : -1, tagInfo);
@@ -1761,7 +1765,7 @@ static void buildNamespaceList(EntryNav *rootNav)
tagFileName = tagInfo->fileName;
}
//printf("++ new namespace %s lang=%s tagName=%s\n",fullName.data(),langToString(root->lang).data(),tagName.data());
- NamespaceDef *nd=new NamespaceDef(root->fileName,root->startLine,
+ NamespaceDef *nd=new NamespaceDef(tagInfo?tagName:root->fileName,root->startLine,
root->startColumn,fullName,tagName,tagFileName,
root->type,root->spec&Entry::Published);
nd->setDocumentation(root->doc,root->docFile,root->docLine); // copy docs to definition
@@ -2131,10 +2135,15 @@ static void findUsingDeclImports(EntryNav *rootNav)
//printf("found member %s\n",mni->memberName());
MemberDef *newMd = 0;
{
+ QCString fileName = root->fileName;
+ if (fileName.isEmpty() && rootNav->tagInfo())
+ {
+ fileName = rootNav->tagInfo()->tagName;
+ }
ArgumentList *templAl = md->templateArguments();
ArgumentList *al = md->templateArguments();
newMd = new MemberDef(
- root->fileName,root->startLine,root->startColumn,
+ fileName,root->startLine,root->startColumn,
md->typeString(),memName,md->argsString(),
md->excpString(),root->protection,root->virt,
md->isStatic(),Member,md->memberType(),
@@ -2320,9 +2329,15 @@ static MemberDef *addVariableToClass(
}
}
+ QCString fileName = root->fileName;
+ if (fileName.isEmpty() && rootNav->tagInfo())
+ {
+ fileName = rootNav->tagInfo()->tagName;
+ }
+
// new member variable, typedef or enum value
MemberDef *md=new MemberDef(
- root->fileName,root->startLine,root->startColumn,
+ fileName,root->startLine,root->startColumn,
root->type,name,root->args,root->exception,
prot,Normal,root->stat,related,
mtype,root->tArgLists ? root->tArgLists->getLast() : 0,0);
@@ -2555,11 +2570,18 @@ static MemberDef *addVariableToFile(
}
}
}
+
+ QCString fileName = root->fileName;
+ if (fileName.isEmpty() && rootNav->tagInfo())
+ {
+ fileName = rootNav->tagInfo()->tagName;
+ }
+
Debug::print(Debug::Variables,0,
" new variable, nd=%s!\n",nd?nd->name().data():"<global>");
// new global variable, enum value or typedef
MemberDef *md=new MemberDef(
- root->fileName,root->startLine,root->startColumn,
+ fileName,root->startLine,root->startColumn,
root->type,name,root->args,0,
Public, Normal,root->stat,Member,
mtype,root->tArgLists ? root->tArgLists->getLast() : 0,0);
@@ -3067,8 +3089,13 @@ static void addInterfaceOrServiceToServiceOrSingleton(
enum MemberType const type = (rootNav->section()==Entry::EXPORTED_INTERFACE_SEC)
? MemberType_Interface
: MemberType_Service;
+ QCString fileName = root->fileName;
+ if (fileName.isEmpty() && rootNav->tagInfo())
+ {
+ fileName = rootNav->tagInfo()->tagName;
+ }
MemberDef *const md = new MemberDef(
- root->fileName, root->startLine, root->startColumn, root->type, rname,
+ fileName, root->startLine, root->startColumn, root->type, rname,
"", "", root->protection, root->virt, root->stat, Member,
type, 0, root->argList);
md->setTagInfo(rootNav->tagInfo());
@@ -3239,13 +3266,19 @@ static void addMethodToClass(EntryNav *rootNav,ClassDef *cd,
name=name.left(i);
}
+ QCString fileName = root->fileName;
+ if (fileName.isEmpty() && rootNav->tagInfo())
+ {
+ fileName = rootNav->tagInfo()->tagName;
+ }
+
//printf("root->name=`%s; root->args=`%s' root->argList=`%s'\n",
// root->name.data(),root->args.data(),argListToString(root->argList).data()
// );
// adding class member
MemberDef *md=new MemberDef(
- root->fileName,root->startLine,root->startColumn,
+ fileName,root->startLine,root->startColumn,
root->type,name,root->args,root->exception,
root->protection,root->virt,
root->stat && root->relatesType != MemberOf,
@@ -5218,7 +5251,7 @@ static void addListReferences()
addRefItem(xrefItems,
name,
theTranslator->trPage(TRUE,TRUE),
- name,pd->title(),0);
+ name,pd->title(),0,0);
}
}
@@ -5235,7 +5268,7 @@ static void addListReferences()
addRefItem(xrefItems,
name,
theTranslator->trDir(TRUE,TRUE),
- name,dd->displayName(),0);
+ name,dd->displayName(),0,0);
}
}
@@ -7034,7 +7067,7 @@ static void findEnums(EntryNav *rootNav)
if (cd && !name.isEmpty()) // found a enum inside a compound
{
- //printf("Enum `%s'::`%s'\n",cd->name(),name.data());
+ //printf("Enum `%s'::`%s'\n",cd->name().data(),name.data());
fd=0;
mnsd=Doxygen::memberNameSDict;
isGlobal=FALSE;
@@ -7067,17 +7100,17 @@ static void findEnums(EntryNav *rootNav)
if (!isGlobal) md->setMemberClass(cd); else md->setFileDef(fd);
md->setBodySegment(root->bodyLine,root->endBodyLine);
md->setBodyDef(rootNav->fileDef());
- md->setMemberSpecifiers(root->spec); // UNO IDL "published"
+ md->setMemberSpecifiers(root->spec);
md->setEnumBaseType(root->args);
- //printf("Enum %s definition at line %d of %s: protection=%d\n",
- // root->name.data(),root->bodyLine,root->fileName.data(),root->protection);
+ //printf("Enum %s definition at line %d of %s: protection=%d scope=%s\n",
+ // root->name.data(),root->bodyLine,root->fileName.data(),root->protection,cd?cd->name().data():"<none>");
md->addSectionsToDefinition(root->anchors);
md->setMemberGroupId(root->mGrpId);
md->enableCallGraph(root->callGraph);
md->enableCallerGraph(root->callerGraph);
//printf("%s::setRefItems(%d)\n",md->name().data(),root->sli?root->sli->count():-1);
md->setRefItems(root->sli);
- //printf("found enum %s nd=%p\n",name.data(),nd);
+ //printf("found enum %s nd=%p\n",md->name().data(),nd);
bool defSet=FALSE;
QCString baseType = root->args;
@@ -7251,26 +7284,35 @@ static void addEnumValuesToEnums(EntryNav *rootNav)
{
SrcLangExt sle;
if (
- (sle=rootNav->lang())==SrcLangExt_CSharp ||
- sle==SrcLangExt_Java ||
+ (sle=rootNav->lang())==SrcLangExt_CSharp ||
+ sle==SrcLangExt_Java ||
sle==SrcLangExt_XML ||
(root->spec&Entry::Strong)
)
{
- // Unlike classic C/C++ enums, for C++11, C# & Java enum
- // values are only visible inside the enum scope, so we must create
+ // Unlike classic C/C++ enums, for C++11, C# & Java enum
+ // values are only visible inside the enum scope, so we must create
// them here and only add them to the enum
e->loadEntry(g_storage);
Entry *root = e->entry();
//printf("md->qualifiedName()=%s rootNav->name()=%s tagInfo=%p name=%s\n",
// md->qualifiedName().data(),rootNav->name().data(),rootNav->tagInfo(),root->name.data());
+ QCString qualifiedName = substitute(rootNav->name(),"::",".");
+ if (!scope.isEmpty() && rootNav->tagInfo())
+ {
+ qualifiedName=substitute(scope,"::",".")+"."+qualifiedName;
+ }
if (substitute(md->qualifiedName(),"::",".")== // TODO: add function to get canonical representation
- substitute(rootNav->name(),"::",".") || // enum value scope matches that of the enum
- rootNav->tagInfo() // be less strict for tag files as members can have incomplete scope
- )
+ qualifiedName // enum value scope matches that of the enum
+ )
{
+ QCString fileName = root->fileName;
+ if (fileName.isEmpty() && rootNav->tagInfo())
+ {
+ fileName = rootNav->tagInfo()->tagName;
+ }
MemberDef *fmd=new MemberDef(
- root->fileName,root->startLine,root->startColumn,
+ fileName,root->startLine,root->startColumn,
root->type,root->name,root->args,0,
Public, Normal,root->stat,Member,
MemberType_EnumValue,0,0);
@@ -8401,7 +8443,7 @@ static void findDefineDocumentation(EntryNav *rootNav)
if (rootNav->tagInfo() && !root->name.isEmpty()) // define read from a tag file
{
- MemberDef *md=new MemberDef("<tagfile>",1,1,
+ MemberDef *md=new MemberDef(rootNav->tagInfo()->tagName,1,1,
"#define",root->name,root->args,0,
Public,Normal,FALSE,Member,MemberType_Define,0,0);
md->setTagInfo(rootNav->tagInfo());
@@ -8626,7 +8668,7 @@ static void buildPageList(EntryNav *rootNav)
"page",
name,
title,
- 0
+ 0,0
);
rootNav->releaseEntry();
@@ -9159,6 +9201,33 @@ static void readTagFile(Entry *root,const char *tl)
}
//----------------------------------------------------------------------------
+static void copyLatexStyleSheet()
+{
+ QStrList latexExtraStyleSheet = Config_getList("LATEX_EXTRA_STYLESHEET");
+ for (uint i=0; i<latexExtraStyleSheet.count(); ++i)
+ {
+ QCString fileName(latexExtraStyleSheet.at(i));
+ if (!fileName.isEmpty())
+ {
+ QFileInfo fi(fileName);
+ if (!fi.exists())
+ {
+ err("Style sheet '%s' specified by LATEX_EXTRA_STYLESHEET does not exist!\n",fileName.data());
+ }
+ else
+ {
+ QCString destFileName = Config_getString("LATEX_OUTPUT")+"/"+fi.fileName().data();
+ if (!checkExtension(fi.fileName().data(), latexStyleExtension))
+ {
+ destFileName += latexStyleExtension;
+ }
+ copyFile(fileName, destFileName);
+ }
+ }
+ }
+}
+
+//----------------------------------------------------------------------------
static void copyStyleSheet()
{
QCString &htmlStyleSheet = Config_getString("HTML_STYLESHEET");
@@ -9187,6 +9256,10 @@ static void copyStyleSheet()
{
err("Style sheet '%s' specified by HTML_EXTRA_STYLESHEET does not exist!\n",fileName.data());
}
+ else if (fi.fileName()=="doxygen.css" || fi.fileName()=="tabs.css" || fi.fileName()=="navtree.css")
+ {
+ err("Style sheet %s specified by HTML_EXTRA_STYLESHEET is already a built-in stylesheet. Please use a different name\n",fi.fileName().data());
+ }
else
{
QCString destFileName = Config_getString("HTML_OUTPUT")+"/"+fi.fileName().data();
@@ -9247,8 +9320,9 @@ static ParserInterface *getParserForFile(const char *fn)
{
QCString fileName=fn;
QCString extension;
+ int sep = fileName.findRev('/');
int ei = fileName.findRev('.');
- if (ei!=-1)
+ if (ei!=-1 && (sep==-1 || ei>sep)) // matches dir/file.ext but not dir.1/file
{
extension=fileName.right(fileName.length()-ei);
}
@@ -9297,6 +9371,10 @@ static void parseFile(ParserInterface *parser,
msg("Reading %s...\n",fn);
readInputFile(fileName,preBuf);
}
+ if (preBuf.data() && preBuf.curPos()>0 && *(preBuf.data()+preBuf.curPos()-1)!='\n')
+ {
+ preBuf.addChar('\n'); // add extra newline to help parser
+ }
BufStr convBuf(preBuf.curPos()+1024);
@@ -9914,6 +9992,7 @@ static const char *getArg(int argc,char **argv,int &optind)
void initDoxygen()
{
+ initResources();
const char *lang = portable_getenv("LC_ALL");
if (lang) portable_setenv("LANG",lang);
setlocale(LC_ALL,"");
@@ -10883,7 +10962,7 @@ void parseInput()
QCString htmlOutput;
bool &generateHtml = Config_getBool("GENERATE_HTML");
- if (generateHtml)
+ if (generateHtml || g_useOutputTemplate /* TODO: temp hack */)
htmlOutput = createOutputDirectory(outputDirectory,"HTML_OUTPUT","/html");
QCString docbookOutput;
@@ -11360,6 +11439,7 @@ void generateOutput()
g_outputList->add(new LatexGenerator);
LatexGenerator::init();
+ copyLatexStyleSheet();
// copy static stuff
copyExtraFiles("LATEX_EXTRA_FILES","LATEX_OUTPUT");
}