Orb/Doxygen/src/util.cpp
changeset 1 82f11024044a
parent 0 42188c7ea2d9
equal deleted inserted replaced
0:42188c7ea2d9 1:82f11024044a
  3568                                         bool checkStatics,
  3568                                         bool checkStatics,
  3569                                         FileDef *currentFile,
  3569                                         FileDef *currentFile,
  3570                                         bool checkCV,
  3570                                         bool checkCV,
  3571                                         QList<MemberDef> &members)
  3571                                         QList<MemberDef> &members)
  3572 {
  3572 {
  3573   //printf("  Function with global scope name `%s' args=`%s'\n",memberName.data(),args);
  3573   //printf("\n  findMembersWithSpecificName() - start\n");
       
  3574   //printf("  findMembersWithSpecificName() Function with global scope name `%s' args=`%s'\n",mn->memberName(),args);
  3574   MemberListIterator mli(*mn);
  3575   MemberListIterator mli(*mn);
  3575   MemberDef *md;
  3576   MemberDef *md;
  3576   for (mli.toFirst();(md=mli.current());++mli)
  3577   for (mli.toFirst();(md=mli.current());++mli)
  3577   {
  3578   {
  3578     FileDef  *fd=md->getFileDef();
  3579     FileDef  *fd=md->getFileDef();
  3579     GroupDef *gd=md->getGroupDef();
  3580     GroupDef *gd=md->getGroupDef();
  3580     //printf("  md->name()=`%s' md->args=`%s' fd=%p gd=%p\n",
  3581     //printf("  findMembersWithSpecificName() md->name()=`%s' md->args=`%s' fd=%p gd=%p file=%s\n",
  3581     //    md->name().data(),args,fd,gd);
  3582 	//	md->name().data(),args,fd,gd,fd?fd->absFilePath().data():"");
       
  3583 	//if (gd) printf("  findMembersWithSpecificName() group isLinkable()=%d\n", gd->isLinkable());
       
  3584 	//if (fd) printf("  findMembersWithSpecificName() file  isLinkable()=%d\n", fd->isLinkable());
       
  3585 	//if (md) printf("  findMembersWithSpecificName() memb  isLinkable()=%d\n", md->isLinkable());
  3582     if (
  3586     if (
  3583         ((gd && gd->isLinkable()) || (fd && fd->isLinkable())) && 
  3587         ((gd && gd->isLinkable()) || (fd && fd->isLinkable())) && 
  3584         md->getNamespaceDef()==0 && md->isLinkable() &&
  3588         md->getNamespaceDef()==0 && md->isLinkable() &&
  3585         (!checkStatics || !md->isStatic() || currentFile==0 || fd==currentFile) // statics must appear in the same file
  3589         (!checkStatics || !md->isStatic() || currentFile==0 || fd==currentFile) // statics must appear in the same file
  3586        )
  3590        )
  3587     {
  3591     {
  3588       //printf("    fd=%p gd=%p args=`%s'\n",fd,gd,args);
  3592       //printf("  findMembersWithSpecificName() fd=%p gd=%p args=`%s'\n",fd,gd,args);
  3589       bool match=TRUE;
  3593       bool match=TRUE;
  3590       ArgumentList *argList=0;
  3594       ArgumentList *argList=0;
  3591       if (args && !md->isDefine() && strcmp(args,"()")!=0)
  3595       if (args && !md->isDefine() && strcmp(args,"()")!=0)
  3592       {
  3596       {
  3593         argList=new ArgumentList;
  3597         argList=new ArgumentList;
  3599             checkCV); 
  3603             checkCV); 
  3600         delete argList; argList=0;
  3604         delete argList; argList=0;
  3601       }
  3605       }
  3602       if (match) 
  3606       if (match) 
  3603       {
  3607       {
  3604         //printf("Found match!\n");
  3608         //printf("  findMembersWithSpecificName() Found match!\n");
  3605         members.append(md);
  3609         members.append(md);
  3606       }
  3610       }
  3607     }
  3611     }
  3608   }
  3612   }
       
  3613   //printf("  findMembersWithSpecificName() - done\n");
  3609 }
  3614 }
  3610 
  3615 
  3611 /*!
  3616 /*!
  3612  * Searches for a member definition given its name `memberName' as a string.
  3617  * Searches for a member definition given its name `memberName' as a string.
  3613  * memberName may also include a (partial) scope to indicate the scope
  3618  * memberName may also include a (partial) scope to indicate the scope
  3637     bool forceEmptyScope,
  3642     bool forceEmptyScope,
  3638     FileDef *currentFile,
  3643     FileDef *currentFile,
  3639     bool checkCV
  3644     bool checkCV
  3640     )
  3645     )
  3641 {
  3646 {
       
  3647   //printf("\ngetDefs(): - start\n");
  3642   fd=0, md=0, cd=0, nd=0, gd=0;
  3648   fd=0, md=0, cd=0, nd=0, gd=0;
  3643   if (memberName.isEmpty()) return FALSE; /* empty name => nothing to link */
  3649   if (memberName.isEmpty()) return FALSE; /* empty name => nothing to link */
  3644 
  3650 
  3645   QCString scopeName=scName;
  3651   QCString scopeName=scName;
  3646   //printf("Search for name=%s args=%s in scope=%s\n",
  3652   //printf("getDefs(): Search for name=\"%s\" args=%s in scope=%s\n",
  3647   //          memberName.data(),args,scopeName.data());
  3653   //          memberName.data(),args,scopeName.data());
  3648 
  3654 
  3649   int is,im=0,pm=0;
  3655   int is,im=0,pm=0;
  3650   // strip common part of the scope from the scopeName
  3656   // strip common part of the scope from the scopeName
  3651   while ((is=scopeName.findRev("::"))!=-1 && 
  3657   while ((is=scopeName.findRev("::"))!=-1 && 
  3654       )
  3660       )
  3655   {
  3661   {
  3656     scopeName=scopeName.left(is); 
  3662     scopeName=scopeName.left(is); 
  3657     pm=im+2;
  3663     pm=im+2;
  3658   }
  3664   }
  3659   //printf("result after scope corrections scope=%s name=%s\n",
  3665   //printf("getDefs(): result after scope corrections scope=%s name=%s\n",
  3660   //          scopeName.data(),memberName.data());
  3666   //          scopeName.data(),memberName.data());
  3661 
  3667 
  3662   QCString mName=memberName;
  3668   QCString mName=memberName;
  3663   QCString mScope;
  3669   QCString mScope;
  3664   if (memberName.left(9)!="operator " && // treat operator conversion methods
  3670   if (memberName.left(9)!="operator " && // treat operator conversion methods
  3672   }
  3678   }
  3673 
  3679 
  3674   // handle special the case where both scope name and member scope are equal
  3680   // handle special the case where both scope name and member scope are equal
  3675   if (mScope==scopeName) scopeName.resize(0);
  3681   if (mScope==scopeName) scopeName.resize(0);
  3676 
  3682 
  3677   //printf("mScope=`%s' mName=`%s'\n",mScope.data(),mName.data());
  3683   //printf("getDefs(): mScope=`%s' mName=`%s'\n",mScope.data(),mName.data());
  3678 
  3684 
  3679   MemberName *mn = Doxygen::memberNameSDict->find(mName);
  3685   MemberName *mn = Doxygen::memberNameSDict->find(mName);
  3680   //printf("mName=%s mn=%p\n",mName.data(),mn);
  3686   //printf("getDefs(): mName=%s mn=%p\n",mName.data(),mn);
  3681   if (!forceEmptyScope && mn && !(scopeName.isEmpty() && mScope.isEmpty()))
  3687   if (!forceEmptyScope && mn && !(scopeName.isEmpty() && mScope.isEmpty()))
  3682   {
  3688   {
  3683     //printf("  >member name found\n");
  3689     //printf("getDefs(): >member name found\n");
  3684     int scopeOffset=scopeName.length();
  3690     int scopeOffset=scopeName.length();
  3685     do
  3691     do
  3686     {
  3692     {
  3687       QCString className = scopeName.left(scopeOffset);
  3693       QCString className = scopeName.left(scopeOffset);
  3688       if (!className.isEmpty() && !mScope.isEmpty())
  3694       if (!className.isEmpty() && !mScope.isEmpty())
  3691       }
  3697       }
  3692       else if (!mScope.isEmpty())
  3698       else if (!mScope.isEmpty())
  3693       {
  3699       {
  3694         className=mScope.copy();
  3700         className=mScope.copy();
  3695       }
  3701       }
  3696       //printf("Trying class scope %s\n",className.data());
  3702       //printf("getDefs(): Trying class scope %s\n",className.data());
  3697 
  3703 
  3698       ClassDef *fcd=0;
  3704       ClassDef *fcd=0;
  3699       // todo: fill in correct fileScope!
  3705       // todo: fill in correct fileScope!
  3700       if ((fcd=getResolvedClass(Doxygen::globalScope,0,className)) &&  // is it a documented class
  3706       if ((fcd=getResolvedClass(Doxygen::globalScope,0,className)) &&  // is it a documented class
  3701           fcd->isLinkable() 
  3707           fcd->isLinkable() 
  3702          )
  3708          )
  3703       {
  3709       {
  3704         //printf("  Found fcd=%p\n",fcd);
  3710         //printf("getDefs(): getDefs(): Found fcd=%p\n",fcd);
  3705         MemberListIterator mmli(*mn);
  3711         MemberListIterator mmli(*mn);
  3706         MemberDef *mmd;
  3712         MemberDef *mmd;
  3707         int mdist=maxInheritanceDepth; 
  3713         int mdist=maxInheritanceDepth; 
  3708         ArgumentList *argList=0;
  3714         ArgumentList *argList=0;
  3709         if (args)
  3715         if (args)
  3719           bool match=args==0 || 
  3725           bool match=args==0 || 
  3720             matchArguments2(mmd->getOuterScope(),mmd->getFileDef(),mmdAl.pointer(),
  3726             matchArguments2(mmd->getOuterScope(),mmd->getFileDef(),mmdAl.pointer(),
  3721                 fcd,fcd->getFileDef(),argList,
  3727                 fcd,fcd->getFileDef(),argList,
  3722                 checkCV
  3728                 checkCV
  3723                 );  
  3729                 );  
  3724           //printf("match=%d\n",match);
  3730           //printf("getDefs(): match=%d\n",match);
  3725           if (match)
  3731           if (match)
  3726           {
  3732           {
  3727             ClassDef *mcd=mmd->getClassDef();
  3733             ClassDef *mcd=mmd->getClassDef();
  3728             if (mcd)
  3734             if (mcd)
  3729             {
  3735             {
  3743           delete argList; argList=0;
  3749           delete argList; argList=0;
  3744         }
  3750         }
  3745         if (mdist==maxInheritanceDepth && args && strcmp(args,"()")==0)
  3751         if (mdist==maxInheritanceDepth && args && strcmp(args,"()")==0)
  3746           // no exact match found, but if args="()" an arbitrary member will do
  3752           // no exact match found, but if args="()" an arbitrary member will do
  3747         {
  3753         {
  3748           //printf("  >Searching for arbitrary member\n");
  3754           //printf("getDefs(): >Searching for arbitrary member\n");
  3749           for (mmli.toFirst();(mmd=mmli.current());++mmli)
  3755           for (mmli.toFirst();(mmd=mmli.current());++mmli)
  3750           {
  3756           {
  3751             //if (mmd->isLinkable())
  3757             //if (mmd->isLinkable())
  3752             //{
  3758             //{
  3753             ClassDef *mcd=mmd->getClassDef();
  3759             ClassDef *mcd=mmd->getClassDef();
  3754             //printf("  >Class %s found\n",mcd->name().data());
  3760             //printf("getDefs(): >Class %s found\n",mcd->name().data());
  3755             if (mcd)
  3761             if (mcd)
  3756             {
  3762             {
  3757               int m=minClassDistance(fcd,mcd);
  3763               int m=minClassDistance(fcd,mcd);
  3758               if (m<mdist /* && mcd->isLinkable()*/ )
  3764               if (m<mdist /* && mcd->isLinkable()*/ )
  3759               {
  3765               {
  3760                 //printf("Class distance %d\n",m);
  3766                 //printf("getDefs(): Class distance %d\n",m);
  3761                 mdist=m;
  3767                 mdist=m;
  3762                 cd=mcd;
  3768                 cd=mcd;
  3763                 md=mmd;
  3769                 md=mmd;
  3764               }
  3770               }
  3765             }
  3771             }
  3766             //}
  3772             //}
  3767           }
  3773           }
  3768         }
  3774         }
  3769         //printf("  >Succes=%d\n",mdist<maxInheritanceDepth);
  3775         //printf("getDefs(): >Success=%d\n",mdist<maxInheritanceDepth);
  3770         if (mdist<maxInheritanceDepth) 
  3776         if (mdist<maxInheritanceDepth) 
  3771         {
  3777         {
  3772           if (!md->isLinkable()) 
  3778           if (!md->isLinkable()) 
  3773           {
  3779           {
       
  3780 			//printf("getDefs(): >Success but not isLinkable=%d\n", md->isLinkable());
  3774             md=0; // avoid returning things we cannot link to
  3781             md=0; // avoid returning things we cannot link to
  3775             cd=0;
  3782             cd=0;
  3776             return FALSE; // match found, but was not linkable
  3783             return FALSE; // match found, but was not linkable
  3777           }
  3784           }
  3778           else
  3785           else
  3779           {
  3786           {
  3780             gd=md->getGroupDef();
  3787             gd=md->getGroupDef();
  3781             if (gd) cd=0;
  3788             if (gd) cd=0;
       
  3789 			//printf("getDefs(): >Success, isLinkable=%d\n", md->isLinkable());
  3782             return TRUE; /* found match */
  3790             return TRUE; /* found match */
  3783           }
  3791           }
  3784         }
  3792         }
  3785       } 
  3793       } 
  3786       /* go to the parent scope */
  3794       /* go to the parent scope */
  3834 
  3842 
  3835     if (mmd)
  3843     if (mmd)
  3836     {
  3844     {
  3837       md = mmd;
  3845       md = mmd;
  3838       cd = mmd->getClassDef();
  3846       cd = mmd->getClassDef();
       
  3847 	  //printf("getDefs(): >Success, mmd=%s\n", mmd->name().data());
  3839       return TRUE;
  3848       return TRUE;
  3840     }
  3849     }
  3841   }
  3850   }
  3842 
  3851 
  3843 
  3852 
  3844   // maybe an namespace, file or group member ?
  3853   // maybe an namespace, file or group member ?
  3845   //printf("Testing for global function scopeName=`%s' mScope=`%s' :: mName=`%s'\n",
  3854   //printf("getDefs(): Testing for global function scopeName=`%s' mScope=`%s' :: mName=`%s'\n",
  3846   //              scopeName.data(),mScope.data(),mName.data());
  3855   //              scopeName.data(),mScope.data(),mName.data());
  3847   if ((mn=Doxygen::functionNameSDict->find(mName))) // name is known
  3856   if ((mn=Doxygen::functionNameSDict->find(mName))) // name is known
  3848   {
  3857   {
  3849     //printf("  >function name found\n");
  3858     //printf("getDefs(): >function name found\n");
  3850     NamespaceDef *fnd=0;
  3859     NamespaceDef *fnd=0;
  3851     int scopeOffset=scopeName.length();
  3860     int scopeOffset=scopeName.length();
  3852     do
  3861     do
  3853     {
  3862     {
  3854       QCString namespaceName = scopeName.left(scopeOffset);
  3863       QCString namespaceName = scopeName.left(scopeOffset);
  3858       }
  3867       }
  3859       else if (!mScope.isEmpty())
  3868       else if (!mScope.isEmpty())
  3860       {
  3869       {
  3861         namespaceName=mScope.copy();
  3870         namespaceName=mScope.copy();
  3862       }
  3871       }
  3863       //printf("Trying namespace %s\n",namespaceName.data());
  3872       //printf("getDefs(): Trying namespace %s\n",namespaceName.data());
  3864       if (!namespaceName.isEmpty() && 
  3873       if (!namespaceName.isEmpty() && 
  3865           (fnd=Doxygen::namespaceSDict->find(namespaceName)) &&
  3874           (fnd=Doxygen::namespaceSDict->find(namespaceName)) &&
  3866           fnd->isLinkable()
  3875           fnd->isLinkable()
  3867          )
  3876          )
  3868       {
  3877       {
  3869         //printf("Function inside existing namespace `%s'\n",namespaceName.data());
  3878         //printf("getDefs(): Function inside existing namespace `%s'\n",namespaceName.data());
  3870         bool found=FALSE;
  3879         bool found=FALSE;
  3871         MemberListIterator mmli(*mn);
  3880         MemberListIterator mmli(*mn);
  3872         MemberDef *mmd;
  3881         MemberDef *mmd;
  3873         for (mmli.toFirst();((mmd=mmli.current()) && !found);++mmli)
  3882         for (mmli.toFirst();((mmd=mmli.current()) && !found);++mmli)
  3874         {
  3883         {
  3875           //printf("mmd->getNamespaceDef()=%p fnd=%p\n",
  3884           //printf("getDefs(): mmd->getNamespaceDef()=%p fnd=%p\n",
  3876           //    mmd->getNamespaceDef(),fnd);
  3885           //    mmd->getNamespaceDef(),fnd);
  3877           if (mmd->getNamespaceDef()==fnd /* && mmd->isLinkable() */ )
  3886           if (mmd->getNamespaceDef()==fnd /* && mmd->isLinkable() */ )
  3878           { // namespace is found
  3887           { // namespace is found
  3879             bool match=TRUE;
  3888             bool match=TRUE;
  3880             ArgumentList *argList=0;
  3889             ArgumentList *argList=0;
  3916         }
  3925         }
  3917         if (found) 
  3926         if (found) 
  3918         {
  3927         {
  3919           if (!md->isLinkable()) 
  3928           if (!md->isLinkable()) 
  3920           {
  3929           {
       
  3930 			//printf("getDefs(): >Success, but isLinkable=%d\n", md->isLinkable());
  3921             md=0; // avoid returning things we cannot link to
  3931             md=0; // avoid returning things we cannot link to
  3922             nd=0;
  3932             nd=0;
  3923             return FALSE; // match found but not linkable
  3933             return FALSE; // match found but not linkable
  3924           }
  3934           }
  3925           else
  3935           else
  3926           {
  3936           {
  3927             gd=md->getGroupDef();
  3937             gd=md->getGroupDef();
  3928             if (gd && gd->isLinkable()) nd=0; else gd=0;
  3938             if (gd && gd->isLinkable()) nd=0; else gd=0;
       
  3939 			//printf("getDefs(): >Success, isLinkable=%d\n", md->isLinkable());
  3929             return TRUE;
  3940             return TRUE;
  3930           }
  3941           }
  3931         }
  3942         }
  3932       }
  3943       }
  3933       if (scopeOffset==0)
  3944       if (scopeOffset==0)
  3993         // no exact match found, but if args="()" an arbitrary 
  4004         // no exact match found, but if args="()" an arbitrary 
  3994         // member will do
  4005         // member will do
  3995         md=mn->last();
  4006         md=mn->last();
  3996         while (md /* && md->isLinkable()*/)
  4007         while (md /* && md->isLinkable()*/)
  3997         {
  4008         {
  3998           //printf("Found member `%s'\n",md->name().data());
  4009           //printf("getDefs(): Found member `%s'\n",md->name().data());
  3999           //printf("member is linkable md->name()=`%s'\n",md->name().data());
  4010           //printf("getDefs(): member is linkable md->name()=`%s'\n",md->name().data());
  4000           fd=md->getFileDef();
  4011           fd=md->getFileDef();
  4001           gd=md->getGroupDef();
  4012           gd=md->getGroupDef();
  4002           if (
  4013           if (
  4003               (gd && gd->isLinkable()) || (fd && fd->isLinkable()) 
  4014               (gd && gd->isLinkable()) || (fd && fd->isLinkable()) 
  4004              )
  4015              )
  4006             members.append(md);
  4017             members.append(md);
  4007           }
  4018           }
  4008           md=mn->prev();
  4019           md=mn->prev();
  4009         }
  4020         }
  4010       }
  4021       }
  4011       //printf("found %d candidate members\n",members.count());
  4022       //printf("getDefs(): found %d candidate members\n",members.count());
  4012       if (members.count()>0) // at least one match
  4023       if (members.count()>0) // at least one match
  4013       {
  4024       {
  4014         md=members.last();
  4025         md=members.last();
  4015       }
  4026       }
  4016       if (md) // found a matching global member
  4027       if (md) // found a matching global member
  4017       {
  4028       {
  4018         fd=md->getFileDef();
  4029         fd=md->getFileDef();
  4019         gd=md->getGroupDef();
  4030         gd=md->getGroupDef();
  4020         //printf("fd=%p gd=%p gd->isLinkable()=%d\n",fd,gd,gd->isLinkable());
  4031 		//printf("getDefs(): fd=%p gd=%p gd->isLinkable()=%d\n",fd,gd,gd?gd->isLinkable():-1);
  4021         if (gd && gd->isLinkable()) fd=0; else gd=0;
  4032         if (gd && gd->isLinkable()) fd=0; else gd=0;
  4022         return TRUE;
  4033         return TRUE;
  4023       }
  4034       }
  4024     }
  4035     }
  4025   }
  4036   }
  4026 
  4037 
  4027   // no nothing found
  4038   // no nothing found
       
  4039   //printf("getDefs(): End of routine\n");
  4028   return FALSE;
  4040   return FALSE;
  4029 }
  4041 }
  4030 
  4042 
  4031 /*!
  4043 /*!
  4032  * Searches for a scope definition given its name as a string via parameter
  4044  * Searches for a scope definition given its name as a string via parameter
  4550   FindFileCacheElem(FileDef *fd,bool ambig) : fileDef(fd), isAmbig(ambig) {}
  4562   FindFileCacheElem(FileDef *fd,bool ambig) : fileDef(fd), isAmbig(ambig) {}
  4551   FileDef *fileDef;
  4563   FileDef *fileDef;
  4552   bool isAmbig;
  4564   bool isAmbig;
  4553 };
  4565 };
  4554 
  4566 
  4555 static QCache<FindFileCacheElem> g_findFileDefCache(5000);
  4567 //static QCache<FindFileCacheElem> g_findFileDefCache(5000);
  4556 
  4568 
  4557 FileDef *findFileDef(const FileNameDict *fnDict,const char *n,bool &ambig)
  4569 FileDef *findFileDef(const FileNameDict *fnDict,const char *n,bool &ambig)
  4558 {
  4570 {
       
  4571   //Debug::print(Debug::IncludeGraph, 0, "findFileDef() Dict=%p Looking for: %s\n", fnDict, n);
  4559   ambig=FALSE;
  4572   ambig=FALSE;
  4560   if (n==0) return 0;
  4573   if (n==0) return 0;
  4561 
  4574 
       
  4575   /*
  4562   QCString key;
  4576   QCString key;
  4563   key.sprintf("%p:",fnDict);
  4577   key.sprintf("%p:",fnDict);
  4564   key+=n;
  4578   key+=n;
  4565 
  4579 
  4566   g_findFileDefCache.setAutoDelete(TRUE);
  4580   g_findFileDefCache.setAutoDelete(TRUE);
  4567   FindFileCacheElem *cachedResult = g_findFileDefCache.find(key);
  4581   FindFileCacheElem *cachedResult = g_findFileDefCache.find(key);
  4568   if (cachedResult)
  4582   if (cachedResult)
  4569   {
  4583   {
  4570     ambig = cachedResult->isAmbig;
  4584     ambig = cachedResult->isAmbig;
       
  4585 	Debug::print(Debug::IncludeGraph, 0, "findFileDef() In cache: %p\n", cachedResult->fileDef);
  4571     return cachedResult->fileDef;
  4586     return cachedResult->fileDef;
  4572   }
  4587   }
  4573   else
  4588   else
  4574   {
  4589   {
  4575     cachedResult = new FindFileCacheElem(0,FALSE);
  4590     cachedResult = new FindFileCacheElem(0,FALSE);
  4576   }
  4591   }
  4577 
  4592   */
  4578   QCString name=convertToQCString(QDir::cleanDirPath(n));
  4593   QCString name=convertToQCString(QDir::cleanDirPath(n));
  4579   QCString path;
  4594   QCString path;
  4580   int slashPos;
  4595   int slashPos;
  4581   FileName *fn;
  4596   FileName *fn;
  4582   if (name.isEmpty()) goto exit;
  4597   if (name.isEmpty()) goto exit;
  4584   if (slashPos!=-1)
  4599   if (slashPos!=-1)
  4585   {
  4600   {
  4586     path=name.left(slashPos+1);
  4601     path=name.left(slashPos+1);
  4587     name=name.right(name.length()-slashPos-1); 
  4602     name=name.right(name.length()-slashPos-1); 
  4588   }
  4603   }
       
  4604   //Debug::print(Debug::IncludeGraph, 0, "findFileDef() path=`%s' name=`%s'\n",path.data(),name.data());
  4589   //printf("findFileDef path=`%s' name=`%s'\n",path.data(),name.data());
  4605   //printf("findFileDef path=`%s' name=`%s'\n",path.data(),name.data());
  4590   if (name.isEmpty()) goto exit;
  4606   if (name.isEmpty()) goto exit;
  4591   if ((fn=(*fnDict)[name]))
  4607   if ((fn=(*fnDict)[name]))
  4592   {
  4608   {
  4593     if (fn->count()==1)
  4609     if (fn->count()==1)
  4594     {
  4610     {
  4595       FileDef *fd = fn->getFirst();
  4611       FileDef *fd = fn->getFirst();
  4596       if (path.isEmpty() || fd->getPath().right(path.length())==path)
  4612       if (path.isEmpty() || fd->getPath().right(path.length())==path)
  4597       {
  4613       {
  4598         cachedResult->fileDef = fd;
  4614         /*
       
  4615 		cachedResult->fileDef = fd;
  4599         g_findFileDefCache.insert(key,cachedResult);
  4616         g_findFileDefCache.insert(key,cachedResult);
       
  4617 		*/
       
  4618 		//Debug::print(Debug::IncludeGraph, 0, "findFileDef() In dictionary: %p\n", fd);
  4600         return fd;
  4619         return fd;
  4601       }
  4620       }
  4602     }
  4621     }
  4603     else // file name alone is ambigious
  4622     else // file name alone is ambigious
  4604     {
  4623     {
  4616           lastMatch=fd; 
  4635           lastMatch=fd; 
  4617         }
  4636         }
  4618       }
  4637       }
  4619 
  4638 
  4620       ambig=(count>1);
  4639       ambig=(count>1);
  4621       cachedResult->isAmbig = ambig;
  4640       /*
       
  4641 	  cachedResult->isAmbig = ambig;
  4622       cachedResult->fileDef = lastMatch;
  4642       cachedResult->fileDef = lastMatch;
  4623       g_findFileDefCache.insert(key,cachedResult);
  4643       g_findFileDefCache.insert(key,cachedResult);
       
  4644 	  */
       
  4645 	  //Debug::print(Debug::IncludeGraph, 0, "findFileDef() ambiguos: %p\n", lastMatch);
  4624       return lastMatch;
  4646       return lastMatch;
  4625     }
  4647     }
  4626   }
  4648   }
  4627 exit:
  4649 exit:
       
  4650   /*
  4628   g_findFileDefCache.insert(key,cachedResult);
  4651   g_findFileDefCache.insert(key,cachedResult);
       
  4652   */
       
  4653   //Debug::print(Debug::IncludeGraph, 0, "findFileDef() failed\n");
  4629   return 0;
  4654   return 0;
  4630 }
  4655 }
  4631 
  4656 
  4632 //----------------------------------------------------------------------
  4657 //----------------------------------------------------------------------
  4633 
  4658