1981 rootNav->changeSection(Entry::EMPTY_SEC); |
1981 rootNav->changeSection(Entry::EMPTY_SEC); |
1982 return md; |
1982 return md; |
1983 } |
1983 } |
1984 |
1984 |
1985 //---------------------------------------------------------------------- |
1985 //---------------------------------------------------------------------- |
|
1986 /** Recursively dumps the include files.*/ |
|
1987 void dumpIncludeGraphRecursive(const FileDef *fd, const QCString &prefix) |
|
1988 { |
|
1989 if (fd && fd->includeFileList()) { |
|
1990 QList<IncludeInfo> *incList = fd->includeFileList(); |
|
1991 IncludeInfo *ii; |
|
1992 for (ii=incList->first(); ii != 0; ii=incList->next()) { |
|
1993 FileDef *incFd = ii->fileDef; |
|
1994 if (incFd) { |
|
1995 Debug::print(Debug::IncludeGraph, 0, "%sInc: %s\n", prefix.data(), incFd->absFilePath().data()); |
|
1996 dumpIncludeGraphRecursive(incFd, " "+prefix); |
|
1997 } |
|
1998 } |
|
1999 } |
|
2000 } |
|
2001 |
|
2002 /** Dumps the include files.*/ |
|
2003 void dumpIncludeGraph() |
|
2004 { |
|
2005 if (Debug::isFlagSet(Debug::IncludeGraph)) { |
|
2006 Debug::print(Debug::IncludeGraph, 0, "Include Graph:\n"); |
|
2007 FileNameListIterator incFnli(*Doxygen::inputNameList); |
|
2008 FileName *incFnLoop; |
|
2009 for (;(incFnLoop=incFnli.current()); ++incFnli) { |
|
2010 FileNameIterator incFni(*incFnLoop); |
|
2011 FileDef *fd; |
|
2012 for (;(fd=incFni.current()); ++incFni) { |
|
2013 Debug::print(Debug::IncludeGraph, 0, "File: %s\n", fd->absFilePath().data()); |
|
2014 dumpIncludeGraphRecursive(fd, " "); |
|
2015 } |
|
2016 } |
|
2017 } |
|
2018 } |
|
2019 |
|
2020 /** Recursively searches the supplied FileDef for an filename that |
|
2021 matches the rootFileName and returns the FileDef* of the include file or |
|
2022 0 on failure. |
|
2023 @param fd The FileDef to search. |
|
2024 @param rootFileName The filename to match on. |
|
2025 */ |
|
2026 static FileDef* findIncludeMatch(const FileDef *fd, const QCString &rootFileName) |
|
2027 { |
|
2028 if (fd && fd->includeFileList()) { |
|
2029 // Search the include dependency list for a file that matches root->fileName |
|
2030 QList<IncludeInfo> *incList = fd->includeFileList(); |
|
2031 IncludeInfo *ii; |
|
2032 for (ii=incList->first(); ii != 0; ii=incList->next()) { |
|
2033 FileDef *incFd = ii->fileDef; |
|
2034 // NOTE: this test stops only direct recursion, not indirect recursion |
|
2035 if (incFd && incFd != fd) { |
|
2036 if (incFd->absFilePath() == rootFileName) { |
|
2037 return incFd; |
|
2038 } else { |
|
2039 // Depth first search |
|
2040 FileDef *recurseFd = findIncludeMatch(incFd, rootFileName); |
|
2041 if (recurseFd) { |
|
2042 return recurseFd; |
|
2043 } |
|
2044 } |
|
2045 } |
|
2046 } |
|
2047 } |
|
2048 return 0; |
|
2049 } |
|
2050 |
|
2051 /** Adds an include file represented by fd to the list of input files |
|
2052 add it to the Doxygen::inputNameList so that the back ends can see it |
|
2053 as 'forced include'. |
|
2054 @param fd The FileDef that describes the file to include. |
|
2055 */ |
|
2056 static void addIncludeFileToInput(FileDef *fd) |
|
2057 { |
|
2058 FileNameListIterator incFnli(*Doxygen::inputNameList); |
|
2059 FileName *incFnLoop; |
|
2060 for (;(incFnLoop=incFnli.current()); ++incFnli) { |
|
2061 FileNameIterator incFni(*incFnLoop); |
|
2062 FileDef *listFd; |
|
2063 for (;(listFd=incFni.current()); ++incFni) { |
|
2064 // TODO: Test for file name not FileDef address |
|
2065 if (listFd == fd) { |
|
2066 // Already have it |
|
2067 return; |
|
2068 } |
|
2069 } |
|
2070 } |
|
2071 //printf("Forcing include file onto inputNameList: %s\n", incFd->absFilePath().data()); |
|
2072 //FileName *fn = Doxygen::inputNameList->first(); |
|
2073 FileNameList *fnList = Doxygen::inputNameList; |
|
2074 FileName *incFn = new FileName(fd->absFilePath(), fd->name()); |
|
2075 incFn->append(fd); |
|
2076 fnList->inSort(incFn); |
|
2077 //printf("Forced include file pushed onto inputNameList %p: %s\n", fnList, fd->absFilePath().data()); |
|
2078 } |
1986 |
2079 |
1987 static MemberDef *addVariableToFile( |
2080 static MemberDef *addVariableToFile( |
1988 EntryNav *rootNav, |
2081 EntryNav *rootNav, |
1989 MemberDef::MemberType mtype, |
2082 MemberDef::MemberType mtype, |
1990 const QCString &scope, |
2083 const QCString &scope, |
2168 |
2261 |
2169 // add member to the file (we do this even if we have already inserted |
2262 // add member to the file (we do this even if we have already inserted |
2170 // it into the namespace. |
2263 // it into the namespace. |
2171 if (fd) |
2264 if (fd) |
2172 { |
2265 { |
2173 md->setFileDef(fd); |
2266 //printf("Setting FileDef %s\n", fd->fileName().data()); |
2174 fd->insertMember(md); |
2267 if (root->fileName != fd->absFilePath()) { |
|
2268 //printf("addVariableToFile() Missmatch Name=\"%s\" Root=%s, FileDef=%s\n", |
|
2269 // name.data(), |
|
2270 // root->fileName.data(), |
|
2271 // fd->absFilePath().data() |
|
2272 // ); |
|
2273 // Now search the include dependency list for a file that matches root->fileName |
|
2274 FileDef *incFd = findIncludeMatch(fd, root->fileName); |
|
2275 if (incFd) { |
|
2276 //printf("Found include file match on: %s\n", incFd->absFilePath().data()); |
|
2277 // If found add this FileDef* to the member and add the MemberDef* to the FileDef |
|
2278 md->setFileDef(incFd); |
|
2279 incFd->insertMember(md); |
|
2280 md->setBodyDef(incFd); |
|
2281 // If this FileDef is not in Doxygen::inputNameList and |
|
2282 // Config_getBool("OUTPUT_INCLUDES") is true then |
|
2283 // add it to the Doxygen::inputNameList so that the back ends |
|
2284 // can see it as 'forced include'. |
|
2285 if (Config_getBool("OUTPUT_INCLUDES")) { |
|
2286 addIncludeFileToInput(incFd); |
|
2287 } |
|
2288 } else { |
|
2289 printf("Warning: addVariableToFile() failed to resolve missmatch Name=\"%s\" Root=%s, FileDef=%s\n", |
|
2290 name.data(), |
|
2291 root->fileName.data(), |
|
2292 fd->absFilePath().data() |
|
2293 ); |
|
2294 //md->setFileDef(fd); |
|
2295 //fd->insertMember(md); |
|
2296 } |
|
2297 } else { |
|
2298 //printf("addVariableToFile() Match OK FileDef=%s\n", fd->absFilePath().data()); |
|
2299 md->setFileDef(fd); |
|
2300 fd->insertMember(md); |
|
2301 } |
2175 } |
2302 } |
2176 |
2303 |
2177 // add member definition to the list of globals |
2304 // add member definition to the list of globals |
2178 if (mn) |
2305 if (mn) |
2179 { |
2306 { |
2643 // strip redundant template specifier for constructors |
2777 // strip redundant template specifier for constructors |
2644 if ((fd==0 || getLanguageFromFileName(fd->name())==SrcLangExt_Cpp) && |
2778 if ((fd==0 || getLanguageFromFileName(fd->name())==SrcLangExt_Cpp) && |
2645 name.left(9)!="operator " && (i=name.find('<'))!=-1 && name.find('>')!=-1) |
2779 name.left(9)!="operator " && (i=name.find('<'))!=-1 && name.find('>')!=-1) |
2646 { |
2780 { |
2647 name=name.left(i); |
2781 name=name.left(i); |
|
2782 } |
|
2783 if (Config_getBool("PREPROCESS_INCLUDES")) { |
|
2784 // If we are preprocessing the #included files we might have seen |
|
2785 // this member more than once so we |
|
2786 // only add a member where one did not exist before |
|
2787 QCString myDefName = name; |
|
2788 myDefName.append(root->args); |
|
2789 if(cd->hasFunction(myDefName, root->protection)) { |
|
2790 //if (Doxygen::memberNameSDict->find(name)) { |
|
2791 //printf("addMethodToClass() rejecting: %p %d %s::%s\n", cd, root->protection, cd->name().data(), myDefName.data()); |
|
2792 return; |
|
2793 } |
|
2794 //printf("addMethodToClass() accepting: %p %d %s::%s\n", cd, root->protection, cd->name().data(), myDefName.data()); |
2648 } |
2795 } |
2649 |
2796 |
2650 //printf("root->name=`%s; root->args=`%s' root->argList=`%s'\n", |
2797 //printf("root->name=`%s; root->args=`%s' root->argList=`%s'\n", |
2651 // root->name.data(),root->args.data(),argListToString(root->argList).data() |
2798 // root->name.data(),root->args.data(),argListToString(root->argList).data() |
2652 // ); |
2799 // ); |
8525 else // no preprocessing |
8695 else // no preprocessing |
8526 { |
8696 { |
8527 msg("Reading %s...\n",s->data()); |
8697 msg("Reading %s...\n",s->data()); |
8528 readInputFile(fileName,preBuf); |
8698 readInputFile(fileName,preBuf); |
8529 } |
8699 } |
8530 msg("Have input for \"%s\", size=%d bytes.\n", s->data(), preBuf.size()); |
8700 reportParseFileSize(s, preBuf); |
8531 BufStr convBuf(preBuf.curPos()+1024); |
8701 BufStr convBuf(preBuf.curPos()+1024); |
8532 |
8702 |
8533 // convert multi-line C++ comments to C style comments |
8703 // convert multi-line C++ comments to C style comments |
8534 convertCppComments(&preBuf,&convBuf,fileName); |
8704 convertCppComments(&preBuf,&convBuf,fileName); |
8535 |
8705 |