--- classlist.cpp	Tue Feb 20 14:27:33 2007
+++ classlist.cpp	Wed Oct 03 12:13:15 2007
@@ -99,7 +99,8 @@
             ol.startMemberList();
             found=TRUE;
           }
-          if (!Config_getString("GENERATE_TAGFILE").isEmpty()) 
+          if ((!Config_getString("GENERATE_TAGFILE").isEmpty()) 
+              &&(!(cd->isReference()))) //Don't write references to tagfile
           {
             Doxygen::tagFile << "    <class kind=\"" << cd->compoundTypeString() 
                     << "\">" << convertToXML(cd->name()) << "</class>" << endl;
--- memberdef.cpp	Wed Jul 25 08:20:25 2007
+++ memberdef.cpp	Thu Oct 04 09:39:03 2007
@@ -725,7 +725,10 @@
 QCString MemberDef::getReference() const
 {
   makeResident();
-  if (m_impl->templateMaster)
+  if (this->isReference()){
+    return Definition::getReference();
+  }
+  else if (m_impl->templateMaster)
   {
     return m_impl->templateMaster->getReference();
   }
@@ -1070,7 +1073,8 @@
   if (cd) d=cd; else if (nd) d=nd; else if (fd) d=fd; else d=gd;
 
   // write tag file information of this member
-  if (!Config_getString("GENERATE_TAGFILE").isEmpty())
+  if ((!Config_getString("GENERATE_TAGFILE").isEmpty())
+      &&(!(this->isReference()))) //Don't write external references to the tagfile
   {
     Doxygen::tagFile << "    <member kind=\"";
     switch (m_impl->mtype)
@@ -1117,7 +1121,8 @@
   }
 
   // write search index info
-  if (Config_getBool("SEARCHENGINE"))
+  if (Config_getBool("SEARCHENGINE")
+      &&(!(this->isReference()))) //Don't write external references to the index)
   {
     Doxygen::searchIndex->setCurrentDoc(qualifiedName(),getOutputFileBase(),anchor());
     Doxygen::searchIndex->addWord(localName(),TRUE);
@@ -2676,7 +2681,8 @@
   {
     if (isLinkableInProject() || hasDocumentedEnumValues())
     {
-      if (!Config_getString("GENERATE_TAGFILE").isEmpty())
+      if ((!Config_getString("GENERATE_TAGFILE").isEmpty())
+          &&(!(this->isReference()))) //Don't write references to the tagfile
       {
         Doxygen::tagFile << "    <member kind=\"enumeration\">" << endl;
         Doxygen::tagFile << "      <name>" << convertToXML(name()) << "</name>" << endl; 
--- namespacedef.cpp	Sun Jul 01 12:07:08 2007
+++ namespacedef.cpp	Thu Oct 04 12:06:17 2007
@@ -122,10 +122,15 @@
 {
   if (classSDict->find(cd->name())==0)
   {
-    if (Config_getBool("SORT_BRIEF_DOCS"))
+    if (Config_getBool("SORT_BRIEF_DOCS")){
       classSDict->inSort(cd->name(),cd);
-    else
+    }
+    else{
       classSDict->append(cd->name(),cd);
+    }
+    if ((this->isReference())&&(!(cd->isReference()))){
+        this->clearReference();
+    }
   }
 }
 
@@ -133,10 +138,15 @@
 {
   if (namespaceSDict->find(nd->name())==0)
   {
-    if (Config_getBool("SORT_MEMBER_DOCS"))
+    if (Config_getBool("SORT_MEMBER_DOCS")){
       namespaceSDict->inSort(nd->name(),nd);
-    else
+    }
+    else{
       namespaceSDict->append(nd->name(),nd);
+    }
+    if ((this->isReference())&&(!(nd->isReference()))){
+        this->clearReference();
+    }
   }
 }
 
@@ -169,6 +179,13 @@
   }
 }
 
+void NamespaceDef::clearReference()
+{
+    this->setReference("");
+    this->fileName = "namespace";
+    this->fileName += this->name();
+}
+
 void NamespaceDef::insertMember(MemberDef *md)
 {
   if (md->isHidden()) return;
@@ -179,6 +196,10 @@
     m_memberLists.append(allMemberList);
   }
   allMemberList->append(md); 
+
+  if ((this->isReference()) && (!(md->isReference()))){
+      this->clearReference();
+  }
   //::addNamespaceMemberNameToIndex(md);
   //static bool sortBriefDocs=Config_getBool("SORT_BRIEF_DOCS");
   switch(md->memberType())
@@ -663,7 +684,8 @@
         name = nd->displayName();
       }
       ol.writeObjectLink(nd->getReference(),nd->getOutputFileBase(),0,name);
-      if (!Config_getString("GENERATE_TAGFILE").isEmpty()) 
+      if ((!Config_getString("GENERATE_TAGFILE").isEmpty()) 
+          &&(!(nd->isReference()))) //Don't write external references to the tagfile
       {
         Doxygen::tagFile << "    <namespace>" << convertToXML(nd->name()) << "</namespace>" << endl;
       }
