diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/classdef.cpp | 2 | ||||
-rw-r--r-- | src/code.l | 37 | ||||
-rw-r--r-- | src/definition.cpp | 42 | ||||
-rw-r--r-- | src/definition.h | 23 | ||||
-rw-r--r-- | src/doc.l | 103 | ||||
-rw-r--r-- | src/doxygen.cpp | 102 | ||||
-rw-r--r-- | src/doxygen.h | 4 | ||||
-rw-r--r-- | src/entry.cpp | 45 | ||||
-rw-r--r-- | src/entry.h | 14 | ||||
-rw-r--r-- | src/filedef.cpp | 2 | ||||
-rw-r--r-- | src/groupdef.cpp | 2 | ||||
-rw-r--r-- | src/memberdef.cpp | 2 | ||||
-rw-r--r-- | src/namespacedef.cpp | 2 | ||||
-rw-r--r-- | src/outputgen.h | 2 | ||||
-rw-r--r-- | src/outputlist.h | 4 | ||||
-rw-r--r-- | src/page.h | 7 | ||||
-rw-r--r-- | src/pre.l | 4 | ||||
-rw-r--r-- | src/reflist.cpp | 44 | ||||
-rw-r--r-- | src/reflist.h | 22 | ||||
-rw-r--r-- | src/rtfgen.cpp | 4 | ||||
-rw-r--r-- | src/scanner.l | 271 | ||||
-rw-r--r-- | src/util.cpp | 155 | ||||
-rw-r--r-- | src/util.h | 6 | ||||
-rw-r--r-- | src/xmlgen.cpp | 1 |
24 files changed, 510 insertions, 390 deletions
diff --git a/src/classdef.cpp b/src/classdef.cpp index 9f8f4df..0f7672b 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -2462,7 +2462,7 @@ QCString ClassDef::className() const void ClassDef::addListReferences() { - addRefItem(todoId(),testId(),bugId(), + addRefItem(specialListItems(), theTranslator->trClass(TRUE,TRUE), getOutputFileBase(),name() ); @@ -1020,6 +1020,7 @@ TYPEKW ("bool"|"char"|"double"|"float"|"int"|"long"|"short"|"signed"|"unsigned" %x SkipSharp %x ReadInclude %x TemplDecl +%x CallEnd %% @@ -1565,19 +1566,17 @@ TYPEKW ("bool"|"char"|"double"|"float"|"int"|"long"|"short"|"signed"|"unsigned" g_code->codify(yytext); if (--g_bracketCount<=0) { - if (!g_insideBody) - { - g_theVarContext.popScope(); - } - g_name.resize(0);g_args.resize(0); - g_parmType.resize(0);g_parmName.resize(0); - BEGIN( Body ); + BEGIN( CallEnd ); } } +<CallEnd>[ \t\n]* { codifyLines(yytext); } + /* <MemberCall2,FuncCall>")"[ \t\n]*[;:] { + */ +<CallEnd>[;:] { codifyLines(yytext); g_bracketCount=0; - if (yytext[yyleng-1]==';') g_searchingForBody=FALSE; + if (*yytext==';') g_searchingForBody=FALSE; if (!g_inClass && !g_type.isEmpty()) { g_theVarContext.addVariable(g_type,g_name); @@ -1585,7 +1584,7 @@ TYPEKW ("bool"|"char"|"double"|"float"|"int"|"long"|"short"|"signed"|"unsigned" g_parmType.resize(0);g_parmName.resize(0); g_theCallContext.popScope(); g_theCallContext.setClass(0); - if (yytext[yyleng-1]==';' || g_insideBody) + if (*yytext==';' || g_insideBody) { if (!g_insideBody) { @@ -1600,7 +1599,10 @@ TYPEKW ("bool"|"char"|"double"|"float"|"int"|"long"|"short"|"signed"|"unsigned" BEGIN( SkipInits ); } } + /* <MemberCall2,FuncCall>")"({BN}"const"|"volatile")*{BN}*"{" { + */ +<CallEnd>({BN}"const"|"volatile")*{BN}*"{" { if (g_insideBody) { g_theVarContext.pushScope(); @@ -1617,18 +1619,17 @@ TYPEKW ("bool"|"char"|"double"|"float"|"int"|"long"|"short"|"signed"|"unsigned" { g_scopeStack.push(INNERBLOCK); } - g_code->codify(")"); yytext[yyleng-1]='\0'; - QCString cv(yytext+1); + QCString cv(yytext); if (!cv.stripWhiteSpace().isEmpty()) { startFontClass("keyword"); - codifyLines(yytext+1); + codifyLines(yytext); endFontClass(); } else // just whitespace { - codifyLines(yytext+1); + codifyLines(yytext); } g_code->codify("{"); if (g_searchingForBody) @@ -1641,6 +1642,16 @@ TYPEKW ("bool"|"char"|"double"|"float"|"int"|"long"|"short"|"signed"|"unsigned" g_type.resize(0); g_name.resize(0); BEGIN( Body ); } +<CallEnd>. { + unput(*yytext); + if (!g_insideBody) + { + g_theVarContext.popScope(); + } + g_name.resize(0);g_args.resize(0); + g_parmType.resize(0);g_parmName.resize(0); + BEGIN( Body ); + } <SkipInits>";" { g_code->codify(yytext); g_type.resize(0); g_name.resize(0); diff --git a/src/definition.cpp b/src/definition.cpp index e21778e..4dafb51 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -52,6 +52,7 @@ Definition::Definition(const char *df,int dl, m_bugId=0; m_outerScope=Doxygen::globalScope; m_partOfGroups=0; + m_specialListItems=0; } Definition::~Definition() @@ -60,6 +61,7 @@ Definition::~Definition() delete m_sourceRefByDict; delete m_sourceRefsDict; delete m_partOfGroups; + delete m_specialListItems; } void Definition::addSectionsToDefinition(QList<QCString> *anchorList) @@ -561,4 +563,44 @@ void Definition::makePartOfGroup(GroupDef *gd) m_partOfGroups->append(gd); } +void Definition::setRefItems(const QList<ListItemInfo> *sli) +{ + if (sli) + { + // deep copy the list + if (m_specialListItems==0) + { + m_specialListItems=new QList<ListItemInfo>; + m_specialListItems->setAutoDelete(TRUE); + } + QListIterator<ListItemInfo> slii(*sli); + ListItemInfo *lii; + for (slii.toFirst();(lii=slii.current());++slii) + { + m_specialListItems->append(new ListItemInfo(*lii)); + } + } +} + +int Definition::getSpecialListId(const char *listName) const +{ + if (m_specialListItems) + { + QListIterator<ListItemInfo> slii(*m_specialListItems); + ListItemInfo *lii; + for (slii.toFirst();(lii=slii.current());++slii) + { + if (strcmp(lii->type,listName)==0) + { + return lii->itemId; + } + } + } + return -1; +} + +const QList<ListItemInfo> *Definition::specialListItems() const +{ + return m_specialListItems; +} diff --git a/src/definition.h b/src/definition.h index 3ea3f56..91ebfd7 100644 --- a/src/definition.h +++ b/src/definition.h @@ -30,6 +30,7 @@ class MemberSDict; class MemberDef; class GroupDef; class GroupList; +class ListItemInfo; /*! The common base class of all entity definitions found in the sources. */ class Definition @@ -103,15 +104,17 @@ class Definition void addSourceReferencedBy(MemberDef *d); void addSourceReferences(MemberDef *d); - void setRefItems(int todoId,int testId,int bugId) - { - if (todoId!=0) m_todoId=todoId; - if (testId!=0) m_testId=testId; - if (bugId!=0) m_bugId=bugId; - } - int todoId() const { return m_todoId; } - int testId() const { return m_testId; } - int bugId() const { return m_bugId; } + //{ + // if (todoId!=0) m_todoId=todoId; + // if (testId!=0) m_testId=testId; + // if (bugId!=0) m_bugId=bugId; + //} + //int todoId() const { return m_todoId; } + //int testId() const { return m_testId; } + //int bugId() const { return m_bugId; } + void setRefItems(const QList<ListItemInfo> *sli); + int getSpecialListId(const char *listName) const; + const QList<ListItemInfo> *specialListItems() const; /*! returns the file in which this definition was found */ QCString getDefFileName() const { return m_defFileName; } @@ -165,7 +168,7 @@ class Definition QCString m_docFile; int m_briefLine; QCString m_briefFile; - + QList<ListItemInfo> *m_specialListItems; }; class DefinitionList : public QList<Definition> @@ -1072,6 +1072,40 @@ bool findDocsForMemberOrCompound(const char *commandName, } /* ----------------------------------------------------------------- */ + +static void writeSpecialItem(const char *commandString) +{ + QCString cmd = commandString; // format "\test 20" or "\todo 4" + int sepPos=cmd.find(' '); + QCString listName = cmd.mid(1,cmd.length()-sepPos-1); // i.e. "test" or "todo" + RefList *refList = Doxygen::specialLists->find(cmd.mid(1,sepPos-1)); + ASSERT(refList!=0); + if (Config_getBool(refList->optionName())) + { + QCString numStr=cmd.right(cmd.length()-sepPos-1); // i.e. "20" or "4" + bool ok; int num = numStr.toUInt(&ok); + RefItem *item = refList->getRefItem(num); + ASSERT(item!=0); + if (insideItemList) + { + forceEndItemList(); + } + endArgumentList(); + if (inBlock()) endBlock(); + currentListIndent.push("P"); + outDoc->startSimpleSect(refList->sectionType(), + refList->listName(), + item->listAnchor, + refList->sectionTitle()+": " + ); + outDoc->writeDescItem(); + internalParseDocument(item->text); + outDoc->endSimpleSect(); + currentListIndent.pop(); + } +} + +/* ----------------------------------------------------------------- */ #undef YY_INPUT #define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size); @@ -1655,71 +1689,10 @@ LINKMASK [a-z_A-Z0-9:#.,~&*/\[\]<>()\-\+]+({B}*("const"|"volatile"))? outDoc->writeDescItem(); } } -<DocScan>"\\todo "[0-9]+ { // this tag is generated in an earlier pass - if (Config_getBool("GENERATE_TODOLIST")) - { - QCString numStr=yytext; - numStr=numStr.right(numStr.length()-6); - bool ok; int num = numStr.toUInt(&ok); - RefItem *item = todoList.getRefItem(num); - ASSERT(item!=0); - if (insideItemList) - { - forceEndItemList(); - } - endArgumentList(); - if (inBlock()) endBlock(); - currentListIndent.push("P"); - outDoc->startSimpleSect(BaseOutputDocInterface::Todo,"todo",item->listAnchor,theTranslator->trTodo()+": "); - outDoc->writeDescItem(); - internalParseDocument(item->text); - outDoc->endSimpleSect(); - currentListIndent.pop(); - } - } -<DocScan>"\\test "[0-9]+ { // this tag is generated in an earlier pass - if (Config_getBool("GENERATE_TESTLIST")) - { - QCString numStr=yytext; - numStr=numStr.right(numStr.length()-6); - bool ok; int num = numStr.toUInt(&ok); - RefItem *item = testList.getRefItem(num); - ASSERT(item!=0); - if (insideItemList) - { - forceEndItemList(); - } - endArgumentList(); - if (inBlock()) endBlock(); - currentListIndent.push("P"); - outDoc->startSimpleSect(BaseOutputDocInterface::Test,"test",item->listAnchor,theTranslator->trTest()+": "); - outDoc->writeDescItem(); - internalParseDocument(item->text); - outDoc->endSimpleSect(); - currentListIndent.pop(); - } - } -<DocScan>"\\bug "[0-9]+ { // this tag is generated in an earlier pass - if (Config_getBool("GENERATE_BUGLIST")) - { - QCString numStr=yytext; - numStr=numStr.right(numStr.length()-5); - bool ok; int num = numStr.toUInt(&ok); - RefItem *item = bugList.getRefItem(num); - ASSERT(item!=0); - if (insideItemList) - { - forceEndItemList(); - } - endArgumentList(); - if (inBlock()) endBlock(); - currentListIndent.push("P"); - outDoc->startSimpleSect(BaseOutputDocInterface::Bug,"bug",item->listAnchor,theTranslator->trBug()+": "); - outDoc->writeDescItem(); - internalParseDocument(item->text); - outDoc->endSimpleSect(); - currentListIndent.pop(); - } +<DocScan>"\\todo "[0-9]+ | /* generated labels */ +<DocScan>"\\test "[0-9]+ | +<DocScan>"\\bug "[0-9]+ { + writeSpecialItem(yytext); } <DocScan>{CMD}"deprecated"{BSEP} { if (insideItemList) diff --git a/src/doxygen.cpp b/src/doxygen.cpp index ba0fc99..e6951fe 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -110,6 +110,9 @@ PageInfo *Doxygen::mainPage = 0; QTextStream Doxygen::tagFile; NamespaceDef *Doxygen::globalScope = new NamespaceDef("<globalScope>",1,"<globalScope>"); +QDict<RefList> *Doxygen::specialLists = new QDict<RefList>; // dictionary of cross-referenced item lists + + static StringList inputFiles; static StringDict excludeNameDict(1009); // sections static QDict<void> compoundKeywordDict(7); // keywords recognised as compounds @@ -198,8 +201,9 @@ static void addRelatedPage(Entry *root) if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict[g->groupname])) break; } addRelatedPage(root->name,root->args,root->doc,root->anchors, - root->fileName,root->startLine,root->todoId, - root->testId,root->bugId,gd,root->tagInfo + root->fileName,root->startLine, + root->sli, + gd,root->tagInfo ); } @@ -236,7 +240,7 @@ static void buildGroupList(Entry *root) gd->documentation() + "\n\n" + root->doc, root->docFile, root->docLine ); gd->addSectionsToDefinition(root->anchors); - gd->setRefItems(root->todoId,root->testId,root->bugId); + gd->setRefItems(root->sli); addGroupToGroups(root,gd); } } @@ -251,7 +255,7 @@ static void buildGroupList(Entry *root) gd->setDocumentation(root->doc,root->docFile,root->docLine); gd->addSectionsToDefinition(root->anchors); Doxygen::groupSDict.append(root->name,gd); - gd->setRefItems(root->todoId,root->testId,root->bugId); + gd->setRefItems(root->sli); } } EntryListIterator eli(*root->sublist); @@ -312,7 +316,7 @@ static void buildFileList(Entry *root) fd->setDocumentation(root->doc,root->docFile,root->docLine,FALSE); fd->setBriefDescription(root->brief,root->briefFile,root->briefLine); fd->addSectionsToDefinition(root->anchors); - fd->setRefItems(root->todoId,root->testId,root->bugId); + fd->setRefItems(root->sli); QListIterator<Grouping> gli(*root->groups); Grouping *g; for (;(g=gli.current());++gli) @@ -628,7 +632,7 @@ static void addClassToContext(Entry *root) fd->insertClass(cd); } addClassToGroups(root,cd); - cd->setRefItems(root->todoId,root->testId,root->bugId); + cd->setRefItems(root->sli); if (!root->subGrouping) cd->setSubGrouping(FALSE); if (cd->templateArguments()==0) @@ -696,7 +700,7 @@ static void addClassToContext(Entry *root) if (!root->subGrouping) cd->setSubGrouping(FALSE); addClassToGroups(root,cd); - cd->setRefItems(root->todoId,root->testId,root->bugId); + cd->setRefItems(root->sli); // see if the class is found inside a namespace bool found=addNamespace(root,cd); @@ -855,7 +859,7 @@ static void buildNamespaceList(Entry *root) // insert the namespace in the file definition if (fd) fd->insertNamespace(nd); addNamespaceToGroups(root,nd); - nd->setRefItems(root->todoId,root->testId,root->bugId); + nd->setRefItems(root->sli); } else // fresh namespace { @@ -871,7 +875,7 @@ static void buildNamespaceList(Entry *root) //printf("Adding namespace to group\n"); addNamespaceToGroups(root,nd); - nd->setRefItems(root->todoId,root->testId,root->bugId); + nd->setRefItems(root->sli); bool ambig; // file definition containing the namespace nd @@ -1013,7 +1017,7 @@ static void findUsingDirectives(Entry *root) nd->insertUsedFile(root->fileName); // add class to the list Doxygen::namespaceSDict.inSort(root->name,nd); - nd->setRefItems(root->todoId,root->testId,root->bugId); + nd->setRefItems(root->sli); } } } @@ -1234,7 +1238,7 @@ static MemberDef *addVariableToClass( // add the member to the class } cd->insertMember(md); - md->setRefItems(root->todoId,root->testId,root->bugId); + md->setRefItems(root->sli); //TODO: insert FileDef instead of filename strings. cd->insertUsedFile(root->fileName); @@ -1332,7 +1336,7 @@ static MemberDef *addVariableToFile( // variable already in the scope { addMemberDocs(root,md,def,0,FALSE); - md->setRefItems(root->todoId,root->testId,root->bugId); + md->setRefItems(root->sli); return md; } @@ -1383,7 +1387,7 @@ static MemberDef *addVariableToFile( // md->setMemberGroup(memberGroupDict[root->mGrpId]); //} - md->setRefItems(root->todoId,root->testId,root->bugId); + md->setRefItems(root->sli); if (nd && !nd->name().isEmpty() && nd->name().at(0)!='@') { nd->insertMember(md); @@ -1777,7 +1781,7 @@ void addMethodToClass(Entry *root,ClassDef *cd, addMemberToGroups(root,md); root->section = Entry::EMPTY_SEC; - md->setRefItems(root->todoId,root->testId,root->bugId); + md->setRefItems(root->sli); } @@ -2048,7 +2052,7 @@ static void buildFunctionList(Entry *root) } } - md->setRefItems(root->todoId,root->testId,root->bugId); + md->setRefItems(root->sli); if (nd && !nd->name().isEmpty() && nd->name().at(0)!='@') { // add member to namespace @@ -2304,11 +2308,8 @@ static void transferFunctionDocumentation() // mdec->setGroupDef(mdef->getGroupDef(),mdef->getGroupPri(),mdef->docFile(),mdef->docLine(),mdef->hasDocumentation()); //} - - int todoId = QMAX(mdec->todoId(),mdef->todoId()); - int testId = QMAX(mdec->testId(),mdef->testId()); - int bugId = QMAX(mdec->bugId() ,mdef->bugId() ); - mdec->setRefItems(todoId,testId,bugId); + mdec->setRefItems(mdef->specialListItems()); + mdef->setRefItems(mdec->specialListItems()); } } } @@ -3381,7 +3382,7 @@ static void addListReferences() PageInfo *pi=0; for (pdi.toFirst();(pi=pdi.current());++pdi) { - addRefItem(pi->todoId,pi->testId,pi->bugId, + addRefItem(pi->specialListItems, theTranslator->trPage(TRUE,TRUE), pi->name,pi->title); } @@ -3497,7 +3498,7 @@ static void addMemberDocs(Entry *root, md->setBodyDef(fd); } - md->setRefItems(root->todoId,root->testId,root->bugId); + md->setRefItems(root->sli); } //md->setDefFile(root->fileName); @@ -4355,7 +4356,7 @@ static void findMember(Entry *root, mn->append(md); cd->insertMember(md); cd->insertUsedFile(root->fileName); - md->setRefItems(root->todoId,root->testId,root->bugId); + md->setRefItems(root->sli); } } else // unrelated function with the same name as a member @@ -4502,7 +4503,7 @@ static void findMember(Entry *root, mn->append(md); cd->insertMember(md); cd->insertUsedFile(root->fileName); - md->setRefItems(root->todoId,root->testId,root->bugId); + md->setRefItems(root->sli); addMemberToGroups(root,md); //printf("Adding member=%s\n",md->name().data()); if (newMemberName) @@ -4744,7 +4745,7 @@ static void findEnums(Entry *root) //{ // md->setMemberGroup(memberGroupDict[root->mGrpId]); //} - md->setRefItems(root->todoId,root->testId,root->bugId); + md->setRefItems(root->sli); if (nd && !nd->name().isEmpty() && nd->name().at(0)!='@') { if (Config_getBool("HIDE_SCOPE_NAMES")) @@ -5517,7 +5518,7 @@ static void findDefineDocumentation(Entry *root) md->setBodyDef(findFileDef(Doxygen::inputNameDict,root->fileName,ambig)); md->addSectionsToDefinition(root->anchors); md->setMaxInitLines(root->initLines); - md->setRefItems(root->todoId,root->testId,root->bugId); + md->setRefItems(root->sli); if (root->mGrpId!=-1) md->setMemberGroupId(root->mGrpId); addMemberToGroups(root,md); } @@ -5553,7 +5554,7 @@ static void findDefineDocumentation(Entry *root) bool ambig; md->setBodyDef(findFileDef(Doxygen::inputNameDict,root->fileName,ambig)); md->addSectionsToDefinition(root->anchors); - md->setRefItems(root->todoId,root->testId,root->bugId); + md->setRefItems(root->sli); if (root->mGrpId!=-1) md->setMemberGroupId(root->mGrpId); addMemberToGroups(root,md); } @@ -5599,7 +5600,7 @@ static void buildPageList(Entry *root) { QCString title=root->args.stripWhiteSpace(); if (title.isEmpty()) title=theTranslator->trMainPage(); - addRefItem(root->todoId,root->testId,root->bugId,"page", + addRefItem(root->sli,"page", Config_getBool("GENERATE_TREEVIEW")?"main":"index", title ); @@ -5759,15 +5760,16 @@ static void resolveUserReferences() // name (not from the todo/test/bug list, but from the file in which they // are defined). We correct this here by looking at the generated section // labels! - if (si->label.left(5)=="_todo" || si->label.left(5)=="_test") + QDictIterator<RefList> rli(*Doxygen::specialLists); + RefList *rl; + for (rli.toFirst();(rl=rli.current());++rli) { - si->fileName=si->label.mid(1,4); // extract "todo" or "test" - si->generated=TRUE; - } - else if (si->label.left(4)=="_bug") - { - si->fileName="bug"; - si->generated=TRUE; + QCString label="_"+rl->listName(); // "_todo", "_test", ... + if (si->label==label) + { + si->generated=TRUE; + break; + } } } } @@ -6677,6 +6679,7 @@ void initDoxygen() #endif initPreprocessor(); + } void readConfiguration(int argc, char **argv) @@ -6955,6 +6958,33 @@ void readConfiguration(int argc, char **argv) /* Set the global html file extension. */ htmlFileExtension = Config_getString("HTML_FILE_EXTENSION"); htmlFileExtensionLength = htmlFileExtension.length(); + + /* init the special lists */ + Doxygen::specialLists->setAutoDelete(TRUE); + Doxygen::specialLists->insert("todo", + new RefList("todo", + "GENERATE_TODOLIST", + theTranslator->trTodoList(), + theTranslator->trTodo(), + BaseOutputDocInterface::Todo + ) + ); + Doxygen::specialLists->insert("test", + new RefList("test", + "GENERATE_TESTLIST", + theTranslator->trTestList(), + theTranslator->trTest(), + BaseOutputDocInterface::Test + ) + ); + Doxygen::specialLists->insert("bug", + new RefList("bug", + "GENERATE_BUGLIST", + theTranslator->trBugList(), + theTranslator->trBug(), + BaseOutputDocInterface::Bug + ) + ); } void parseInput() diff --git a/src/doxygen.h b/src/doxygen.h index 1dfafc2..f97c23c 100644 --- a/src/doxygen.h +++ b/src/doxygen.h @@ -32,6 +32,7 @@ #include "formula.h" #include "section.h" #include "membergroup.h" +#include "reflist.h" //#include "packagedef.h" class PageSList; @@ -81,7 +82,6 @@ class Doxygen static QTextStream tagFile; static SectionDict sectionDict; static StringDict namespaceAliasDict; - //static GroupList groupList; static GroupSDict groupSDict; static NamespaceSDict namespaceSDict; static FormulaList formulaList; @@ -92,8 +92,8 @@ class Doxygen static QIntDict<QCString> memberHeaderDict; // dictionary of the member groups heading static QIntDict<QCString> memberDocDict; // dictionary of the member groups heading static QDict<void> expandAsDefinedDict; - //static PackageSDict packageDict; static NamespaceDef *globalScope; + static QDict<RefList> *specialLists; // array of special lists: todo, test, bug ... }; void initDoxygen(); diff --git a/src/entry.cpp b/src/entry.cpp index 13378e9..8db6cd1 100644 --- a/src/entry.cpp +++ b/src/entry.cpp @@ -41,6 +41,7 @@ Entry::Entry() //mtArgList = 0; mGrpId = -1; tagInfo = 0; + sli = 0; groupDocType = GROUPDOC_NORMAL; reset(); } @@ -80,9 +81,9 @@ Entry::Entry(const Entry &e) memSpec = e.memSpec; initializer = e.initializer; initLines = e.initLines; - todoId = e.todoId; - testId = e.testId; - bugId = e.bugId; + //todoId = e.todoId; + //testId = e.testId; + //bugId = e.bugId; tagInfo = e.tagInfo; sublist = new QList<Entry>; sublist->setAutoDelete(TRUE); @@ -158,7 +159,21 @@ Entry::Entry(const Entry &e) // //printf("appending argument %s %s\n",a->type.data(),a->name.data()); // } //} - + if (e.sli) + { + sli = new QList<ListItemInfo>; + sli->setAutoDelete(TRUE); + QListIterator<ListItemInfo> slii(*e.sli); + ListItemInfo *ili; + for (slii.toFirst();(ili=slii.current());++slii) + { + sli->append(new ListItemInfo(*ili)); + } + } + else + { + sli=0; + } } Entry::~Entry() @@ -173,6 +188,7 @@ Entry::~Entry() delete tArgLists; //delete mtArgList; delete tagInfo; + delete sli; num--; } @@ -224,9 +240,9 @@ void Entry::reset() bodyLine = -1; endBodyLine = -1; mGrpId = -1; - todoId = 0; - testId = 0; - bugId = 0; + //todoId = 0; + //testId = 0; + //bugId = 0; section = EMPTY_SEC; mtype = Method; virt = Normal; @@ -244,6 +260,7 @@ void Entry::reset() argList->clear(); if (tagInfo) { delete tagInfo; tagInfo=0; } if (tArgLists) { delete tArgLists; tArgLists=0; } + if (sli) { delete sli; sli=0; } //if (mtArgList) { delete mtArgList; mtArgList=0; } } @@ -351,3 +368,17 @@ bool ArgumentList::hasDocumentation() const } return hasDocs; } + +void Entry::addSpecialListItem(const char *listName,int itemId) +{ + if (sli==0) + { + sli = new QList<ListItemInfo>; + sli->setAutoDelete(TRUE); + } + ListItemInfo *ili=new ListItemInfo; + ili->type = listName; + ili->itemId = itemId; + sli->append(ili); +} + diff --git a/src/entry.h b/src/entry.h index 4020a96..f814ef4 100644 --- a/src/entry.h +++ b/src/entry.h @@ -25,6 +25,12 @@ enum Protection { Public, Protected, Private } ; enum Specifier { Normal, Virtual, Pure } ; enum MethodTypes { Method, Signal, Slot, DCOP, Property }; +struct ListItemInfo +{ + const char *type; + int itemId; +}; + /*! \brief This class stores information about an inheritance relation */ struct BaseInfo @@ -229,6 +235,7 @@ class Entry Entry(const Entry &); ~Entry(); int getSize(); + void addSpecialListItem(const char *listName,int index); /*! Adds entry \e as a child to this entry */ void addSubEntry (Entry* e) ; @@ -276,9 +283,10 @@ class Entry QList<QCString> *anchors; //!< list of anchors defined in this entry QCString fileName; //!< file this entry was extracted from int startLine; //!< start line of entry in the source - int todoId; //!< id of the todo list item of this entry - int testId; //!< id of the test list item of this entry - int bugId; //!< id of the bug list item of this entry + //int todoId; //!< id of the todo list item of this entry + //int testId; //!< id of the test list item of this entry + //int bugId; //!< id of the bug list item of this entry + QList<ListItemInfo> *sli; //!< special lists (test/todo/bug/..) this entry is in TagInfo *tagInfo; //!< tag file info static int num; //!< counts the total number of entries enum diff --git a/src/filedef.cpp b/src/filedef.cpp index b48ba25..2f79a6b 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -660,7 +660,7 @@ bool FileDef::generateSourceFile() const void FileDef::addListReferences() { - addRefItem(todoId(),testId(),bugId(), + addRefItem(specialListItems(), theTranslator->trFile(TRUE,TRUE), getOutputFileBase(),name() ); diff --git a/src/groupdef.cpp b/src/groupdef.cpp index e1b27da..3380b59 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -754,7 +754,7 @@ QCString GroupDef::getOutputFileBase() const void GroupDef::addListReferences() { - addRefItem(todoId(),testId(),bugId(), + addRefItem(specialListItems(), theTranslator->trGroup(TRUE,TRUE), getOutputFileBase(),name() ); diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 99f9b4b..930e915 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -1703,7 +1703,7 @@ void MemberDef::addListReference(Definition *d) } } //printf("*** addListReference %s todo=%d test=%d bug=%d\n",name().data(),todoId(),testId(),bugId()); - addRefItem(todoId(),testId(),bugId(),memLabel, + addRefItem(specialListItems(),memLabel, d->getOutputFileBase()+":"+anchor(),memName,argsString()); } diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp index 56c92ca..34f9f7d 100644 --- a/src/namespacedef.cpp +++ b/src/namespacedef.cpp @@ -364,7 +364,7 @@ Definition *NamespaceDef::findInnerCompound(const char *n) void NamespaceDef::addListReferences() { - addRefItem(todoId(),testId(),bugId(), + addRefItem(specialListItems(), theTranslator->trNamespace(TRUE,TRUE), getOutputFileBase(),name() ); diff --git a/src/outputgen.h b/src/outputgen.h index f10afc7..7b6a082 100644 --- a/src/outputgen.h +++ b/src/outputgen.h @@ -224,8 +224,6 @@ class BaseOutputDocInterface virtual void writeRing(char) = 0; virtual void writeSharpS() = 0; virtual void writeCCedil(char) = 0; - virtual void startDescList(SectionTypes t) = 0; - virtual void endDescList() = 0; virtual void startSimpleSect(SectionTypes t,const char *file, const char *anchor,const char *title) = 0; virtual void endSimpleSect() = 0; diff --git a/src/outputlist.h b/src/outputlist.h index 79f02d3..0a2beb4 100644 --- a/src/outputlist.h +++ b/src/outputlist.h @@ -327,10 +327,6 @@ class OutputList : public OutputDocInterface { forall(&OutputGenerator::startMemberDescription); } void endMemberDescription() { forall(&OutputGenerator::endMemberDescription); } - void startDescList(SectionTypes t) - { forall(&OutputGenerator::startDescList,t); } - void endDescList() - { forall(&OutputGenerator::endDescList); } void startSimpleSect(SectionTypes t,const char *file,const char *anchor, const char *title) { forall(&OutputGenerator::startSimpleSect,t,file,anchor,title); } @@ -25,7 +25,7 @@ class PageInfo public: PageInfo(const char *f, int l,const char *n,const char *d,const char *t) : defFileName(f), defLine(l), name(n), - doc(d), title(t), todoId(0), testId(0),sectionDict(0), m_inGroup(0) {} + doc(d), title(t), sectionDict(0),specialListItems(0),m_inGroup(0) {} // where the page definition was found QCString defFileName; @@ -87,16 +87,13 @@ class PageInfo } } - // ids - int todoId; - int testId; - int bugId; void makePartOfGroup(GroupDef *gd) { m_inGroup = gd; } GroupDef *getGroupDef() const { return m_inGroup; } // is this page part of a group SectionDict *sectionDict; + QList<ListItemInfo> *specialListItems; private: GroupDef *m_inGroup; @@ -1106,7 +1106,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) BEGIN(CopyLine); } } -<CopyLine>"extern"{BN}*"\"C\""*{BN}*"{" { +<CopyLine>"extern"{BN}{0,80}"\"C\""*{BN}{0,80}"{" { QCString text=yytext; g_yyLineNr+=text.contains('\n'); outputArray(yytext,yyleng); @@ -1148,7 +1148,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) outputChar(*yytext); BEGIN( CopyLine ); } -<CopyLine>{ID}/{BN}*"(" { +<CopyLine>{ID}/{BN}{0,80}"(" { Define *def=0; //def=g_fileDefineDict->find(yytext); //printf("Search for define %s found=%d g_includeStack.isEmpty()=%d " diff --git a/src/reflist.cpp b/src/reflist.cpp index 2469d65..9d23e04 100644 --- a/src/reflist.cpp +++ b/src/reflist.cpp @@ -18,19 +18,33 @@ #include "reflist.h" +#if 0 /*! The one and only todo list */ RefList todoList; /*! The test criteria list */ RefList testList; /*! The bug list */ RefList bugList; +#endif -/*! Create a todo list */ -RefList::RefList() +/*! Create a list of items that are cross referenced with documentation blocks + * @param listName String representing the name of the list. + * @param optionName String representation of the option enabling the list. + * @param pageTitle String representing the title of the list page. + * @param secTitle String representing the title of the section. + * @param type Type of the section. + */ +RefList::RefList(const char *listName,const char *optionName,const char *pageTitle, + const char *secTitle,BaseOutputDocInterface::SectionTypes type) { m_dict = 0; m_dictIterator = 0; m_id = 0; + m_listName = listName; + m_optionName = optionName; + m_pageTitle = pageTitle; + m_secTitle = secTitle; + m_type = type; } /*! Destroy the todo list. Currently not called! */ @@ -84,3 +98,29 @@ RefItem *RefList::getNextRefItem() return m_dictIterator ? m_dictIterator->operator++() : 0; } +/*! Returns the name of the list as set in the constructor. */ +QCString RefList::listName() const +{ + return m_listName; +} + +QCString RefList::optionName() const +{ + return m_optionName; +} + +QCString RefList::pageTitle() const +{ + return m_pageTitle; +} + +QCString RefList::sectionTitle() const +{ + return m_secTitle; +} + +BaseOutputDocInterface::SectionTypes RefList::sectionType() const +{ + return m_type; +} + diff --git a/src/reflist.h b/src/reflist.h index 692e108..cb60dc2 100644 --- a/src/reflist.h +++ b/src/reflist.h @@ -21,6 +21,7 @@ #include "qtbc.h" #include <qintdict.h> +#include "outputgen.h" /*! This struct represents an item in the list of references. */ struct RefItem @@ -39,18 +40,31 @@ class RefList RefItem *getRefItem(int todoItemId); RefItem *getFirstRefItem(); RefItem *getNextRefItem(); + QCString listName() const; + QCString optionName() const; + QCString pageTitle() const; + QCString sectionTitle() const; + BaseOutputDocInterface::SectionTypes sectionType() const; - RefList(); + RefList(const char *listName,const char *optionName, + const char *pageTitle,const char *secTitle, + BaseOutputDocInterface::SectionTypes type + ); ~RefList(); private: int m_id; + QCString m_listName; + QCString m_optionName; + QCString m_pageTitle; + QCString m_secTitle; QIntDict<RefItem> *m_dict; QIntDictIterator<RefItem> *m_dictIterator; + BaseOutputDocInterface::SectionTypes m_type; }; -extern RefList todoList; -extern RefList testList; -extern RefList bugList; +//extern RefList todoList; +//extern RefList testList; +//extern RefList bugList; #endif diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp index a6d5a9f..0b11da5 100644 --- a/src/rtfgen.cpp +++ b/src/rtfgen.cpp @@ -42,13 +42,13 @@ const int indentLevels = 10; -struct ListItemInfo +struct RTFListItemInfo { bool isEnum; int number; }; -static ListItemInfo listItemInfo[indentLevels]; +static RTFListItemInfo listItemInfo[indentLevels]; static QCString title; static QCString subject; static QCString comments; diff --git a/src/scanner.l b/src/scanner.l index 29c1861..9a76eab 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -86,12 +86,12 @@ static int roundCount = 0 ; static int curlyCount = 0 ; static int squareCount = 0 ; static int padCount = 0 ; -static int todoStartContext = 0; -static QCString todoString; -static int testStartContext = 0; -static QCString testString; -static int bugStartContext = 0; -static QCString bugString; +static int slStartContext = 0; +static QCString slString; +//static int testStartContext = 0; +//static QCString testString; +//static int bugStartContext = 0; +//static QCString bugString; static Entry* current_root = 0 ; static Entry* global_root = 0 ; static Entry* current = 0 ; @@ -200,6 +200,7 @@ static void initEntry() } } + //----------------------------------------------------------------------------- /// remove any automatic grouping and add new one (if given) @@ -232,8 +233,11 @@ static int newMemberGroupId() return curGroupId++; } +// forward declarations static void startGroup(); +static void startGroupInDoc(); static void endGroup(); + //----------------------------------------------------------------------------- static void lineCount() @@ -426,6 +430,45 @@ static void prependScope() } } +//----------------------------------------------------------------------------- + +static void addSpecialItem(const char *listName) +{ + ListItemInfo *lii=0; + RefList *refList = Doxygen::specialLists->find(listName); + ASSERT(refList!=0); + if (current->sli) + { + QListIterator<ListItemInfo> slii(*current->sli); + for (slii.toFirst();(lii=slii.current());++slii) + { + if (strcmp(lii->type,listName)==0) break; + } + } + if (lii) // already found item of same type before + { + RefItem *item = refList->getRefItem(lii->itemId); + item->text += " <p>"; + item->text += current->brief; + } + else // new item + { + int itemId = refList->addRefItem(); + char anchorLabel[12]; + sprintf(anchorLabel,"_%s%06d",listName,itemId); + RefItem *item = refList->getRefItem(itemId); + item->text = current->brief.copy(); + item->listAnchor = anchorLabel; + current->addSpecialListItem(listName,itemId); + QCString cmdString; + cmdString.sprintf("\\%s %d\n",listName,itemId); + current->doc += cmdString; + sectionType=SectionInfo::Anchor; + sectionLabel=anchorLabel; + addSection(); + } + current->brief = slString.copy(); // restore orginial brief desc. +} /* ----------------------------------------------------------------- */ #undef YY_INPUT #define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size); @@ -444,10 +487,11 @@ static int yyread(char *buf,int max_size) %} + /* start command character */ CMD ("\\"|"@") SECTIONCMD {CMD}("image"|"author"|"internal"|"version"|"date"|"deprecated"|"param"|"exception"|"return"[s]?|"retval"|"bug"|"warning"|"par"|"sa"|"see"|"pre"|"post"|"invariant"|"note"|"remark"[s]?|"todo"|"test"|"ingroup"|"latexonly"|"htmlonly"|"{"|"verbatim"|"dotfile"|"defgroup"|"addtogroup"|"weakgroup") BN [ \t\n\r] -BL [ \t\r]*"\n" +BL [ \t\r]*"\n" B [ \t] BS ^(({B}*"//")?)(({B}*"*"+)?){B}* FILESCHAR [a-z_A-Z0-9\\:\\\/\-\+] @@ -1450,7 +1494,13 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) } } <FindMembers,FindFields,ReadInitializer>"//"([!/]?){B}*{CMD}"}"|"/*"([!*]?){B}*{CMD}"}"{B}*"*/" { + if (memberGroupId==NOGROUP && autoGroupStack.isEmpty()) + { + warn(yyFileName,yyLineNr, + "Warning: end of group without matching begin."); + } endGroup(); + memberGroupHeader.resize(0); } <FindMembers>"=" { current->bodyLine = yyLineNr; @@ -1957,7 +2007,8 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) } <ReadBody>. { current->program += yytext ; } -<FindMembers>("("({BN}*{ID}{BN}*"::")*({BN}*"*"{BN}*)+)+ { +<FindMembers>"("/({BN}*{ID}{BN}*"::")*{ID}{BN}*")"{BN}*"(" | /* typedef void (A::func_t)(args...) */ +<FindMembers>("("({BN}*{ID}{BN}*"::")*({BN}*"*"{BN}*)+)+ { /* typedef void (A::*ptr_t)(args...) */ current->bodyLine = yyLineNr; lineCount(); addType(current); @@ -3145,6 +3196,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) current->fileName = yyFileName; current->startLine = yyLineNr; yyLineNr++; + startGroupInDoc(); BEGIN( lastDocContext ); } <Doc,JavaDoc>{CMD}"name"{B}+ { @@ -3169,23 +3221,23 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) current->brief+=yytext; } <AfterDoc,AfterDocLine,LineDoc,Doc,JavaDoc,ClassDoc,PageDoc>{CMD}"todo"/[^a-z_A-Z0-9] { - todoStartContext = YY_START; + slStartContext = YY_START; lastBriefContext = TodoParam; // this is where we will continue at the end of the argument - todoString = current->brief.copy(); // these will be swapped later on. + slString = current->brief.copy(); // these will be swapped later on. current->brief.resize(0); BEGIN(ClassDocBrief); } <AfterDoc,AfterDocLine,LineDoc,Doc,JavaDoc,ClassDoc,PageDoc>{CMD}"test"/[^a-z_A-Z0-9] { - testStartContext = YY_START; + slStartContext = YY_START; lastBriefContext = TestParam; // this is where we will continue at the end of the argument - testString = current->brief.copy(); // these will be swapped later on. + slString = current->brief.copy(); // these will be swapped later on. current->brief.resize(0); BEGIN(ClassDocBrief); } <AfterDoc,AfterDocLine,LineDoc,Doc,JavaDoc,ClassDoc,PageDoc>{CMD}"bug"/[^a-z_A-Z0-9] { - bugStartContext = YY_START; + slStartContext = YY_START; lastBriefContext = BugParam; // this is where we will continue at the end of the argument - bugString = current->brief.copy(); // these will be swapped later on. + slString = current->brief.copy(); // these will be swapped later on. current->brief.resize(0); BEGIN(ClassDocBrief); } @@ -3193,91 +3245,25 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) <TodoParam>"//" | <TodoParam>"/*" | <TodoParam>. { - if (current->todoId!=0) - { - RefItem *item = todoList.getRefItem(current->todoId); - item->text += " <p>"; - item->text += current->brief; - } - else - { - int todoItemId = todoList.addRefItem(); - char anchorLabel[12]; - sprintf(anchorLabel,"_todo%06d",todoItemId); - RefItem *item = todoList.getRefItem(todoItemId); - item->text = current->brief.copy(); - item->listAnchor = anchorLabel; - current->todoId = todoItemId; - QCString todoCmdString; - todoCmdString.sprintf("\\todo %d\n",todoItemId); - current->doc += todoCmdString; - sectionType=SectionInfo::Anchor; - sectionLabel=anchorLabel; - addSection(); - } - unput(*yytext); - current->brief = todoString.copy(); // restore orginial brief desc. - BEGIN(todoStartContext); + addSpecialItem("todo"); + int i;for (i=yyleng-1;i>=0;i--) unput(yytext[i]); + BEGIN(slStartContext); } <TestParam>\n | <TestParam>"//" | <TestParam>"/*" | <TestParam>. { - if (current->testId!=0) - { - RefItem *item = testList.getRefItem(current->testId); - item->text += " <p>"; - item->text += current->brief; - } - else - { - int testItemId = testList.addRefItem(); - char anchorLabel[12]; - sprintf(anchorLabel,"_test%06d",testItemId); - RefItem *item = testList.getRefItem(testItemId); - item->text = current->brief.copy(); - item->listAnchor = anchorLabel; - current->testId = testItemId; - QCString testCmdString; - testCmdString.sprintf("\\test %d\n",testItemId); - current->doc += testCmdString; - sectionType=SectionInfo::Anchor; - sectionLabel=anchorLabel; - addSection(); - } - unput(*yytext); - current->brief = testString.copy(); // restore orginial brief desc. - BEGIN(testStartContext); + addSpecialItem("test"); + int i;for (i=yyleng-1;i>=0;i--) unput(yytext[i]); + BEGIN(slStartContext); } <BugParam>\n | <BugParam>"//" | <BugParam>"/*" | <BugParam>. { - if (current->bugId!=0) - { - RefItem *item = bugList.getRefItem(current->bugId); - item->text += " <p>"; - item->text += current->brief; - } - else - { - int bugItemId = bugList.addRefItem(); - char anchorLabel[12]; - sprintf(anchorLabel,"_bug%06d",bugItemId); - RefItem *item = bugList.getRefItem(bugItemId); - item->text = current->brief.copy(); - item->listAnchor = anchorLabel; - current->bugId = bugItemId; - QCString bugCmdString; - bugCmdString.sprintf("\\bug %d\n",bugItemId); - current->doc += bugCmdString; - sectionType=SectionInfo::Anchor; - sectionLabel=anchorLabel; - addSection(); - } - unput(*yytext); - current->brief = bugString.copy(); // restore orginial brief desc. - BEGIN(bugStartContext); + addSpecialItem("bug"); + int i;for (i=yyleng-1;i>=0;i--) unput(yytext[i]); + BEGIN(slStartContext); } <ExampleDocArg1>{FILE} { current->name = stripQuotes(yytext); @@ -3453,11 +3439,13 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) <GroupHeader>"*/" { unput('/');unput('*'); //printf("Found memberGroup=`%s'\n",memberGroupHeader.data()); + startGroupInDoc(); newDocState(); } <GroupHeader>\n { yyLineNr++; //printf("Found memberGroup=`%s'\n",memberGroupHeader.data()); + startGroupInDoc(); newDocState(); } <StoreGroupDocs>"$" { @@ -3619,27 +3607,19 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) BEGIN( GroupName ); } <ClassDoc,Doc,JavaDoc>{CMD}"{" { - if (current->section==Entry::GROUPDOC_SEC ) - { - autoGroupStack.push(new Grouping(current->name, - current->groupingPri() - )); - } - else if (current->section == Entry::MEMBERGRP_SEC) + if (memberGroupId==NOGROUP && current->section==Entry::GROUPDOC_SEC) { - memberGroupId = newMemberGroupId(); - memberGroupRelates = current->relates.copy(); - memberGroupInside = current->inside.copy(); - current->mGrpId = memberGroupId; - lastMemberGroupLine = yyLineNr; - } - else - { - warn(yyFileName,yyLineNr,"Warning: @{ may only be used in a group block!\n"); + startGroupInDoc(); } } <ClassDoc,Doc,JavaDoc>{CMD}"}" { + if (memberGroupId==NOGROUP && autoGroupStack.isEmpty()) + { + warn(yyFileName,yyLineNr, + "Warning: end of group without matching begin."); + } endGroup(); + memberGroupHeader.resize(0); } <ExampleDoc,PageDoc,ClassDoc>. { current->doc += yytext; } <Doc,JavaDoc,LineDoc,ExampleDoc,PageDoc,ClassDoc>^{B}*"//" @@ -3841,17 +3821,17 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) yyLineNr++; } <SkipSection>"//"|"*/" -<ClassDoc,Doc,JavaDoc,AfterDoc,PageDoc,ExampleDoc>{CMD}"elseif"/[^a-z_A-Z0-9] { +<ClassDoc,LineDoc,Doc,JavaDoc,AfterDoc,PageDoc,ExampleDoc>{CMD}"elseif"/[^a-z_A-Z0-9] { // previous section enabled => skip now depthIf=1; BEGIN(SkipSection); } -<ClassDoc,Doc,JavaDoc,AfterDoc,PageDoc,ExampleDoc>{CMD}"else"/[^a-z_A-Z0-9] { +<ClassDoc,LineDoc,Doc,JavaDoc,AfterDoc,PageDoc,ExampleDoc>{CMD}"else"/[^a-z_A-Z0-9] { // section was enabled => skip now depthIf=1; BEGIN(SkipSection); } -<ClassDoc,Doc,JavaDoc,AfterDoc,PageDoc,ExampleDoc>{CMD}"endif"/[^a-z_A-Z0-9] { +<ClassDoc,LineDoc,Doc,JavaDoc,AfterDoc,PageDoc,ExampleDoc>{CMD}"endif"/[^a-z_A-Z0-9] { // section enabled => absorb endif } @@ -3914,8 +3894,8 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) <ClassDocBrief>"\n" { // allow \todo in brief description if (lastBriefContext==TodoParam && - (todoStartContext==LineDoc || - todoStartContext==AfterDocLine + (slStartContext==LineDoc || + slStartContext==AfterDocLine ) ) { @@ -3924,8 +3904,8 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) } else if (lastBriefContext==TestParam && - (testStartContext==LineDoc || - testStartContext==AfterDocLine + (slStartContext==LineDoc || + slStartContext==AfterDocLine ) ) { @@ -3934,8 +3914,8 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) } else if (lastBriefContext==BugParam && - (bugStartContext==LineDoc || - bugStartContext==AfterDocLine + (slStartContext==LineDoc || + slStartContext==AfterDocLine ) ) { @@ -4307,12 +4287,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) static void startGroup() { - if (memberGroupId!=NOGROUP) - { - warn(yyFileName,yyLineNr,"Warning: ignoring nested member group. " - "Previous command was found at line %d.",lastMemberGroupLine); - } - else if (!lastDefGroup.groupname.isEmpty()) + if (!lastDefGroup.groupname.isEmpty()) { setCurrentGroup( &lastDefGroup.groupname, lastDefGroup.pri ); autoGroupStack.push(new Grouping(lastDefGroup)); @@ -4320,12 +4295,21 @@ static void startGroup() } else { + if (memberGroupId!=NOGROUP) + { + //warn(yyFileName,yyLineNr,"Warning: ignoring nested member group. " + // "Previous command was found at line %d.",lastMemberGroupLine); + endGroup(); + } if (memberGroupHeader.isEmpty()) { // warn( yyFileName, yyLineNr, "Warning: member group does not have a header" ); memberGroupHeader="[NOHEADER]"; } memberGroupId = newMemberGroupId(); + Doxygen::memberHeaderDict.insert(memberGroupId, + new QCString(memberGroupHeader.stripWhiteSpace()) + ); memberGroupRelates = current->relates.copy(); memberGroupInside = current->inside.copy(); current->mGrpId = memberGroupId; @@ -4333,18 +4317,39 @@ static void startGroup() } } -static void endGroup() +static void startGroupInDoc() { - if (memberGroupId==NOGROUP && autoGroupStack.isEmpty()) + if (current->section==Entry::GROUPDOC_SEC ) /* scope for a non-member group: @defgroup */ { - warn(yyFileName,yyLineNr, - "Warning: end of group without matching begin."); + autoGroupStack.push(new Grouping(current->name, + current->groupingPri() + )); } - else if (memberGroupId!=NOGROUP) // end of member group + else if (current->section == Entry::MEMBERGRP_SEC) /* scope for a member group: @name */ { + if (memberGroupId!=NOGROUP) + { + endGroup(); + } + memberGroupId = newMemberGroupId(); Doxygen::memberHeaderDict.insert(memberGroupId, new QCString(memberGroupHeader.stripWhiteSpace()) ); + memberGroupRelates = current->relates.copy(); + memberGroupInside = current->inside.copy(); + current->mGrpId = memberGroupId; + lastMemberGroupLine = yyLineNr; + } + else + { + warn(yyFileName,yyLineNr,"Warning: @{ may only be used in a group block!\n"); + } +} + +static void endGroup() +{ + if (memberGroupId!=NOGROUP) // end of member group + { Doxygen::memberDocDict.insert(memberGroupId, new QCString(memberGroupDocs) ); @@ -4356,7 +4361,6 @@ static void endGroup() current->mGrpId=NOGROUP; current->relates.resize(0); } - memberGroupHeader.resize(0); memberGroupDocs.resize(0); } else if (!autoGroupStack.isEmpty()) // end of group @@ -4366,12 +4370,19 @@ static void endGroup() if( parent ) { setCurrentGroup( &parent->groupname, parent->pri ); } else { - setCurrentGroup( NULL, Grouping::GROUPING_LOWEST ); + setCurrentGroup( 0, Grouping::GROUPING_LOWEST ); } delete current; } } +static void forceEndGroup() +{ + while (memberGroupId!=NOGROUP || !autoGroupStack.isEmpty()) endGroup(); +} + +//---------------------------------------------------------------------------- + static void newDocState() { if (tmpDocType!=-1) @@ -4451,9 +4462,11 @@ static void parseCompounds(Entry *rt) memberGroupInside.resize(0); scanYYlex() ; + forceEndGroup(); delete current; current=0; ce->program.resize(0); + if (depthIf>0) { warn(yyFileName,yyLineNr,"Documentation block ended in the middle of a conditional section!"); @@ -4482,10 +4495,14 @@ void parseMain(Entry *rt) scanYYrestart( scanYYin ); BEGIN( FindMembers ); scanYYlex(); + + forceEndGroup(); + if (depthIf>0) { warn(yyFileName,yyLineNr,"Documentation block ended in the middle of a conditional section!"); } + rt->program.resize(0); delete current; current=0; parseCompounds(rt); diff --git a/src/util.cpp b/src/util.cpp index 57e7149..8af87d8 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -3375,7 +3375,8 @@ found: void addRelatedPage(const char *name,const QCString &ptitle, const QCString &doc,QList<QCString> *anchors, const char *fileName,int startLine, - int todoId,int testId,int bugId,GroupDef *gd, + const QList<ListItemInfo> *sli, + GroupDef *gd, TagInfo *tagInfo ) { @@ -3395,9 +3396,22 @@ void addRelatedPage(const char *name,const QCString &ptitle, QCString title=ptitle.stripWhiteSpace(); pi=new PageInfo(fileName,startLine,baseName,doc,title); - pi->todoId=todoId; - pi->testId=testId; - pi->bugId=bugId; + + if (sli) + { + if (pi->specialListItems==0) + { + pi->specialListItems=new QList<ListItemInfo>; + pi->specialListItems->setAutoDelete(TRUE); + } + QListIterator<ListItemInfo> slii(*sli); + ListItemInfo *lii; + for (slii.toFirst();(lii=slii.current());++slii) + { + pi->specialListItems->append(new ListItemInfo(*lii)); + } + } + if (tagInfo) { pi->reference = tagInfo->tagName; @@ -3447,100 +3461,45 @@ void addRelatedPage(const char *name,const QCString &ptitle, //---------------------------------------------------------------------------- -void addRefItem(int todoId,int testId,int bugId,const char *prefix, - const char *name,const char *title,const char *args) -{ - - //printf("addRefItem(%s) todoId=%d testId=%d bugId=%d\n",name,todoId,testId,bugId); - - //////////////////////////////////////////////////////////// - // add item to the todo list - //////////////////////////////////////////////////////////// - - if (todoId>0 && Config_getBool("GENERATE_TODOLIST")) - { - RefItem *item = todoList.getRefItem(todoId); - ASSERT(item!=0); - if (item->written) return; - - QCString doc; - doc += "<dl><dt>\\anchor "; - doc += item->listAnchor; - doc += "\n"; - doc += prefix; - doc += " \\_internalref "; - doc += name; - doc += " \""; - doc += title; - doc += "\""; - if (args) doc += args; - doc += "</dt>\n<dd>"; - doc += item->text; - doc += "</dd></dl>\n"; - //printf("Todo page: %s\n",doc.data()); - addRelatedPage("todo",theTranslator->trTodoList(),doc,0,"generated",1,0,0,0); - - item->written=TRUE; - } - - //////////////////////////////////////////////////////////// - // add item to the test list - //////////////////////////////////////////////////////////// - - if (testId>0 && Config_getBool("GENERATE_TESTLIST")) - { - RefItem *item = testList.getRefItem(testId); - ASSERT(item!=0); - if (item->written) return; - - QCString doc; - doc += "<dl><dt>\\anchor "; - doc += item->listAnchor; - doc += "\n"; - doc += prefix; - doc += " \\_internalref "; - doc += name; - doc += " \""; - doc += title; - doc += "\""; - if (args) doc += args; - doc += "</dt>\n<dd>"; - doc += item->text; - doc += "</dd></dl>\n"; - //printf("Test page: %s\n",doc.data()); - addRelatedPage("test",theTranslator->trTestList(),doc,0,"generated",1,0,0,0); - - item->written=TRUE; - } - - //////////////////////////////////////////////////////////// - // add item to the bug list - //////////////////////////////////////////////////////////// - - if (bugId>0 && Config_getBool("GENERATE_BUGLIST")) - { - RefItem *item = bugList.getRefItem(bugId); - ASSERT(item!=0); - if (item->written) return; - - QCString doc; - doc += "<dl><dt>\\anchor "; - doc += item->listAnchor; - doc += "\n"; - doc += prefix; - doc += " \\_internalref "; - doc += name; - doc += " \""; - doc += title; - doc += "\""; - if (args) doc += args; - doc += "</dt>\n<dd>"; - doc += item->text; - doc += "</dd></dl>\n"; - //printf("Bug page: %s\n",doc.data()); - addRelatedPage("bug",theTranslator->trBugList(),doc,0,"generated",1,0,0,0); - - item->written=TRUE; +void addRefItem(const QList<ListItemInfo> *sli, + const char *prefix, + const char *name,const char *title,const char *args) +{ + if (sli) + { + QListIterator<ListItemInfo> slii(*sli); + ListItemInfo *lii; + for (slii.toFirst();(lii=slii.current());++slii) + { + RefList *refList = Doxygen::specialLists->find(lii->type); + ASSERT(refList!=0); + //printf("addRefItem(%s) todoId=%d testId=%d bugId=%d\n",name,todoId,testId,bugId); + + if (Config_getBool(refList->optionName())) + { + RefItem *item = refList->getRefItem(lii->itemId); + ASSERT(item!=0); + if (item->written) return; + + QCString doc(1000); + doc += "<dl><dt>\\anchor "; + doc += item->listAnchor; + doc += "\n"; + doc += prefix; + doc += " \\_internalref "; + doc += name; + doc += " \""; + doc += title; + doc += "\""; + if (args) doc += args; + doc += "</dt>\n<dd>"; + doc += item->text; + doc += "</dd></dl>\n"; + //printf("Todo page: %s\n",doc.data()); + addRelatedPage(refList->listName(),refList->pageTitle(),doc,0,"generated",1,0,0,0); + item->written=TRUE; + } + } } } @@ -43,6 +43,7 @@ class MemberGroupSDict; class Definition; struct TagInfo; class MemberNameInfoSDict; +class ListItemInfo; //-------------------------------------------------------------------- @@ -169,12 +170,13 @@ QCString resolveTypeDef(Definition *d,const QCString &name, QCString mergeScopes(const QCString &leftScope,const QCString &rightScope); int getScopeFragment(const QCString &s,int p,int *l); int filterCRLF(char *buf,int len); -void addRefItem(int todoId,int testId,int bugId,const char *prefix, +void addRefItem(const QList<ListItemInfo> *sli,const char *prefix, const char *name,const char *title,const char *args=0); void addRelatedPage(const char *name,const QCString &ptitle, const QCString &doc,QList<QCString> *anchors, const char *fileName,int startLine, - int todoId,int testId,int bugId,GroupDef *gd=0, + const QList<ListItemInfo> *sli, + GroupDef *gd=0, TagInfo *tagInfo=0 ); QCString escapeCharsInString(const char *name,bool allowDots); diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp index 8dbd3c1..9c694a8 100644 --- a/src/xmlgen.cpp +++ b/src/xmlgen.cpp @@ -429,7 +429,6 @@ class XMLGenerator : public OutputDocInterface XML_DB(("(startSimpleSect)\n")); m_t << "<simplesect kind=\"" << sectionTypeToString(st) << "\">"; startNestedPar(); - m_inParStack.top() = TRUE; } void endSimpleSect() { |