From 5a7cb5383abbd105c22dca28171806bd2a5a9cda Mon Sep 17 00:00:00 2001
From: dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>
Date: Mon, 20 May 2002 14:35:05 +0000
Subject: Release-1.2.16

---
 INSTALL                   |  4 ++--
 README                    |  4 ++--
 VERSION                   |  2 +-
 doc/Doxyfile              |  1 +
 doc/Makefile.latex        | 16 +++++++-------
 doc/config.doc            |  9 ++++++++
 doc/docblocks.doc         | 42 ++++++++++++++++++------------------
 doc/doxygen_manual.tex    |  5 +++--
 doc/faq.doc               |  5 ++++-
 doc/install.doc           |  9 ++++----
 doc/language.doc          |  2 +-
 doc/preprocessing.doc     | 11 +++++++---
 doc/trouble.doc           |  2 +-
 packages/rpm/doxygen.spec |  2 +-
 src/classdef.cpp          |  4 ++--
 src/code.l                |  7 +++++-
 src/commentcnv.l          | 35 ++++++++++++++++++++++++------
 src/debug.cpp             |  2 ++
 src/debug.h               |  3 ++-
 src/doxygen.cpp           | 54 +++++++++++++++++++++++++++++++++--------------
 src/latexgen.cpp          |  4 ++++
 src/pre.l                 | 17 ++++++---------
 src/scanner.l             | 25 ++++++++++++----------
 src/util.cpp              | 38 +++++++++++++++++++++++++++++++--
 src/xmlgen.cpp            | 14 +++++++++---
 25 files changed, 217 insertions(+), 100 deletions(-)

diff --git a/INSTALL b/INSTALL
index 0f04999..a1747cd 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,6 +1,6 @@
-DOXYGEN Version 1.2.15-20020512
+DOXYGEN Version 1.2.16
 
 Please read the installation section of the manual for instructions.
 
 --------
-Dimitri van Heesch (12 May 2002)
+Dimitri van Heesch (20 May 2002)
diff --git a/README b/README
index 3d70ffa..aee12ad 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-DOXYGEN Version 1.2.15_20020512
+DOXYGEN Version 1.2.16
 
 Please read INSTALL for compilation instructions.
 
@@ -17,4 +17,4 @@ to subscribe to the lists or to visit the archives.
 
 Enjoy,
 
-Dimitri van Heesch (dimitri@stack.nl) (12 May 2002)
+Dimitri van Heesch (dimitri@stack.nl) (20 May 2002)
diff --git a/VERSION b/VERSION
index 69c4d9d..f69752a 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.2.15-20020512
+1.2.16
diff --git a/doc/Doxyfile b/doc/Doxyfile
index 637b172..e4cb868 100644
--- a/doc/Doxyfile
+++ b/doc/Doxyfile
@@ -51,3 +51,4 @@ DOC_ABSPATH       =
 BIN_ABSPATH       = /usr/local/bin/
 EXT_DOC_PATHS     =
 PDF_HYPERLINKS    = YES
+USE_PDFLATEX      = YES
diff --git a/doc/Makefile.latex b/doc/Makefile.latex
index f824b70..07e453f 100644
--- a/doc/Makefile.latex
+++ b/doc/Makefile.latex
@@ -14,18 +14,18 @@
 
 all: doxygen_manual.pdf
 
-doxygen_manual.pdf: doxygen_manual.ps
-	ps2pdf doxygen_manual.ps doxygen_manual.pdf
+#doxygen_manual.pdf: doxygen_manual.ps
+#	ps2pdf doxygen_manual.ps doxygen_manual.pdf
 
-doxygen_manual.ps: doxygen_manual.dvi
-	dvips -o doxygen_manual.ps doxygen_manual.dvi
+#doxygen_manual.ps: doxygen_manual.dvi
+#	dvips -o doxygen_manual.ps doxygen_manual.dvi
 
-doxygen_manual.dvi: doxygen_manual.tex doxygen.sty
+doxygen_manual.pdf: doxygen_manual.tex doxygen.sty
 	echo "Running latex..."
-	latex doxygen_manual.tex 
+	pdflatex doxygen_manual.tex 
 	echo "Running makeindex..."
 	makeindex doxygen_manual.idx
 	echo "Rerunning latex...."
-	latex doxygen_manual.tex
+	pdflatex doxygen_manual.tex
 clean:
-	rm -f *.ps *.dvi *.aux *.toc *.idx *.ind *.ilg *.log
+	rm -f *.ps *.dvi *.aux *.toc *.idx *.ind *.ilg *.log *.pdf
diff --git a/doc/config.doc b/doc/config.doc
index d85a7c9..3269d49 100644
--- a/doc/config.doc
+++ b/doc/config.doc
@@ -79,6 +79,7 @@ followed by the descriptions of the tags grouped by category.
 <li> \refitem cfg_cols_in_alpha_index COLS_IN_ALPHA_INDEX
 <li> \refitem cfg_compact_latex COMPACT_LATEX 
 <li> \refitem cfg_compact_rtf COMPACT_RTF
+<li> \refitem cfg_details_at_top DETAILS_AT_TOP 
 <li> \refitem cfg_disable_index DISABLE_INDEX 
 <li> \refitem cfg_distribute_group_doc DISTRIBUTE_GROUP_DOC
 <li> \refitem cfg_doc_abspath DOC_ABSPATH 
@@ -400,6 +401,14 @@ followed by the descriptions of the tags grouped by category.
   comment as the brief description. If set to NO (the default), the 
   Javadoc-style will behave just like the Qt-style comments.
 
+\anchor cfg_details_at_top
+<dt>\c DETAILS_AT_TOP <dd>
+ \addindex DETAILS_AT_TOP
+  If the DETAILS_AT_TOP tag is set to YES then Doxygen
+  will output the detailed description near the top, like JavaDoc.
+  If set to NO, the detailed description appears after the member
+  documentation.
+
 \anchor cfg_inherit_docs
 <dt>\c INHERIT_DOCS <dd>
  \addindex INHERIT_DOCS
diff --git a/doc/docblocks.doc b/doc/docblocks.doc
index e0c9161..804187a 100644
--- a/doc/docblocks.doc
+++ b/doc/docblocks.doc
@@ -63,40 +63,32 @@ In both cases the intermediate *'s are optional, so
 is also valid.
 
 <li> A third alternative is to use a block of at least two C++ comment 
-lines, where the first starts with an additional slash or an 
+lines, where each line starts with an additional slash or an 
 exclamation mark. Here are examples of the two cases:
 
 \verbatim
 ///
-// ... text ...
-//
+/// ... text ...
+///
 \endverbatim
 
 or
 
 \verbatim
 //!
-// ... text ...
-//
+//!... text ...
+//!
 \endverbatim
 
 <li>
 
-One could also repeat the special markers for each line as shown in
-the following examples:
-
-\verbatim
-/// 
-/// ... text ....
-///
-\endverbatim
-
-or 
+Some people like to make their comment blocks more visible in the
+documentation. For this purpose you can use the following:
 
 \verbatim
-//!
-//! ... text ...
-//!
+/////////////////////////////////////////////////
+/// ... text ...
+/////////////////////////////////////////////////
 \endverbatim
 
 </ol>
@@ -117,7 +109,8 @@ Here is an example:
  */
 \endverbatim
 
-<li>If \ref cfg_javadoc_autobrief "JAVADOC_AUTOBRIEF" is set to YES in the configuration file, 
+<li>If \ref cfg_javadoc_autobrief "JAVADOC_AUTOBRIEF" is set to \c YES 
+    in the configuration file, 
     then using JavaDoc style comment
     blocks will automatically start a brief description which ends at the
     first dot followed by a space or new line. Here is an example:
@@ -127,6 +120,11 @@ Here is an example:
  *  here.
  */
 \endverbatim
+The option has the same effect for multi-line special C++ comments:
+\verbatim
+/// Brief description which ends at this dot. Details follow
+/// here.
+\endverbatim
 
 <li>A third option is to use a special C++ style comment which does not 
     span more than one line. Here are two examples:
@@ -145,7 +143,9 @@ or
 \endverbatim
 
 Note the blank line in the last example, which is required to separate the 
-brief description from the block containing the detailed description.
+brief description from the block containing the detailed description. The
+\ref cfg_javadoc_autobrief "JAVADOC_AUTOBRIEF" should also be set to \c NO
+for this case.
 
 </ol>
 
@@ -215,7 +215,7 @@ implementer of the members more direct access to the documentation.
 As a compromise the brief description could be placed before the
 declaration and the detailed description before the member definition.
 
-\subsection memberdoc Documenting members afterwards
+\subsection memberdoc Putting documentation after members 
 
 If you want to document the members of a file, struct, union, class, or enum,
 and you want to put the documentation for these members inside the compound,
diff --git a/doc/doxygen_manual.tex b/doc/doxygen_manual.tex
index 2b718e3..8e9068e 100644
--- a/doc/doxygen_manual.tex
+++ b/doc/doxygen_manual.tex
@@ -12,7 +12,7 @@
 % Documents produced by Doxygen are derivative works derived from the
 % input used in their production; they are not affected by this license.
 
-\documentclass[a4paper,ps2pdf]{article}
+\documentclass[a4paper]{article}
 \usepackage{a4wide}
 \usepackage{makeidx}
 \usepackage{fancyhdr}
@@ -23,7 +23,8 @@
 \usepackage{multicol}
 \usepackage{times}
 \usepackage{alltt}
-\usepackage[pagebackref=true,
+\usepackage[pdftex,
+            pagebackref=true,
             colorlinks=true,
             linkcolor=blue
            ]{hyperref}
diff --git a/doc/faq.doc b/doc/faq.doc
index 77ba440..b9821bf 100644
--- a/doc/faq.doc
+++ b/doc/faq.doc
@@ -195,7 +195,10 @@ more than 16K input character in one go. I've seen this happening
 on a very large generated file (>16K lines), where the built-in preprocessor 
 converted it into an empty file (with >16K of newlines). Another case
 where this might happen is if you have lines in your code with more than
-16K characters.
+16K characters. 
+
+If you have ran into such a case and want me to fix it, you
+should send me a code fragment that triggers the message.
 
 <li><b>How did doxygen get it's name?</b>
 
diff --git a/doc/install.doc b/doc/install.doc
index 7472355..979d5e2 100644
--- a/doc/install.doc
+++ b/doc/install.doc
@@ -212,15 +212,14 @@ Now install doxygen as described above.
 
 <b>Bison problems</b>
 
-Versions 1.31 and 1.32 of bison contain a "bug" that results in a 
-compiler error like this:
+Versions 1.31 to 1.34 of bison contain a "bug" that results in a 
+compiler errors like this:
 
 ce_parse.cpp:348: member `class CPPValue yyalloc::yyvs' with 
 constructor not allowed in union
 
-There is no real solution to this problem, but it is discussed on the
-bison mailing list. I recomment to use version 1.29 until the problems 
-with bison are resolved.
+This problem has been solved in version 1.35 (versions before 1.31 
+will also work).
 
 <b>Latex problems</b>
 
diff --git a/doc/language.doc b/doc/language.doc
index 8ed1c95..242f8d3 100644
--- a/doc/language.doc
+++ b/doc/language.doc
@@ -25,7 +25,7 @@ Doxygen has built-in support for multiple languages. This means
 that the text fragments that doxygen generates can be produced in
 languages other than English (the default) at configuration time.
 
-Currently (version 1.2.15-20020430), 26 languages 
+Currently (version 1.2.15-20020512), 26 languages 
 are supported (sorted alphabetically): 
 Brazilian Portuguese, Chinese, Chinesetraditional, Croatian, Czech, 
 Danish, Dutch, English, Finnish, French, 
diff --git a/doc/preprocessing.doc b/doc/preprocessing.doc
index 9b7e8bc..ff44316 100644
--- a/doc/preprocessing.doc
+++ b/doc/preprocessing.doc
@@ -28,7 +28,7 @@ So if you have the following code fragment
 #define VERSION 200
 #define CONST_STRING const char *
 
-#if VERSION >= 200
+#if VERSION < 200
   static CONST_STRING version = "2.xx";
 #else
   static CONST_STRING version = "1.xx";
@@ -46,8 +46,13 @@ Then by default doxygen will feed the following to its parser:
 
 You can disable all preprocessing by setting 
 \ref cfg_enable_preprocessing "ENABLE_PREPROCESSING" to \c 
-NO in the configuation file. In the case above doxygen will then reads
-both statements!
+NO in the configuation file. In the case above doxygen will then read
+both statements, i.e:
+
+\verbatim
+  static CONST_STRING version = "2.xx";
+  static CONST_STRING version = "1.xx";
+\endverbatim
 
 In case you want to expand the \c CONST_STRING macro, you should set the
 \ref cfg_macro_expansion "MACRO_EXPANSION" tag in the config file 
diff --git a/doc/trouble.doc b/doc/trouble.doc
index bfac14a..fbfe36b 100644
--- a/doc/trouble.doc
+++ b/doc/trouble.doc
@@ -104,6 +104,6 @@ If you send only a (vague) description of a bug, you are usually not very
 helpful and will costs me much more time to figure out what you mean. 
 In the worst-case your bug report may even be completely ignored by me! 
 
-My e-mail address: <a href="mailto:dimitri@stack.nl">dimitri@stack.nl</a> 
+My e-mail address: dimitri@stack.nl 
 */
 
diff --git a/packages/rpm/doxygen.spec b/packages/rpm/doxygen.spec
index 3afc291..3726fdd 100644
--- a/packages/rpm/doxygen.spec
+++ b/packages/rpm/doxygen.spec
@@ -1,6 +1,6 @@
 Summary: A documentation system for C/C++.
 Name: doxygen
-Version: 1.2.15_20020512
+Version: 1.2.16
 Release: 1
 Epoch: 1
 Source0: ftp://ftp.stack.nl/pub/users/dimitri/%{name}-%{version}.src.tar.gz
diff --git a/src/classdef.cpp b/src/classdef.cpp
index 31ea207..f82cbf0 100644
--- a/src/classdef.cpp
+++ b/src/classdef.cpp
@@ -2318,8 +2318,8 @@ void ClassDef::addMembersToTemplateInstance(ClassDef *cd,const char *templSpec)
       //printf("%s->setMemberClass(%p)\n",imd->name().data(),this);
       imd->setMemberClass(this);
       imd->setTemplateMaster(md);
-      //imd->setDocumentation(md->documentation());
-      //imd->setBriefDescription(md->briefDescription());
+      imd->setDocumentation(md->documentation(),md->docFile(),md->docLine());
+      imd->setBriefDescription(md->briefDescription(),md->briefFile(),md->briefLine());
       imd->setMemberSpecifiers(md->getMemberSpecifiers());
       insertMember(imd);
       //printf("Adding member=%s %s%s to class %s templSpec %s\n",
diff --git a/src/code.l b/src/code.l
index 878cda9..533f2dd 100644
--- a/src/code.l
+++ b/src/code.l
@@ -1701,7 +1701,12 @@ TYPEKW  ("bool"|"char"|"double"|"float"|"int"|"long"|"short"|"signed"|"unsigned"
 					  g_memCallContext = YY_START;
   					  BEGIN( MemberCall ); 
   					}
-<SkipComment>"//"			{
+<SkipComment>"/*"("!"?)"*/"		{ 
+  					  g_code->codify(yytext);
+					  endFontClass();
+  					  BEGIN( g_lastCContext ) ; 
+					}
+<SkipComment>"//"|"/*"			{
   					  g_code->codify(yytext);
   					}
 <SkipComment>[^*/\n]+			{
diff --git a/src/commentcnv.l b/src/commentcnv.l
index d2da72c..de7e8a7 100644
--- a/src/commentcnv.l
+++ b/src/commentcnv.l
@@ -23,6 +23,8 @@
 #include <stdlib.h>
 
 #include "bufstr.h"
+#include "debug.h"
+#include "message.h"
 
 static BufStr *g_inBuf;
 static BufStr *g_outBuf;
@@ -97,12 +99,17 @@ static int yyread(char *buf,int max_size)
 <Scan>\n                           { /* new line */ 
                                      copyToOutput(yytext,yyleng); 
                                    }
-<Scan>("//!"|"///").*\n/[ \t]*"//" { /* start C++ style special comment block */
-                                     copyToOutput("/*!",3); 
-				     copyToOutput(yytext+3,yyleng-3); 
+<Scan>("//!"|"///").*\n/[ \t]*"//"[\/!][^\/] { /* start C++ style special comment block */
+  				     int i=3;
+				     if (yytext[2]=='/')
+				     {
+				       while (i<yyleng && yytext[i]=='/') i++;
+				     }
+                                     copyToOutput("/**",3); 
+				     copyToOutput(yytext+i,yyleng-i); 
 				     BEGIN(SComment); 
                                    }
-<Scan>"//".*\n			   { /* one line C++ comment */ 
+<Scan>"//"[\/!].*\n		   { /* one line C++ comment */ 
   				     copyToOutput(yytext,yyleng); 
 				   }
 <Scan>"/*"			   { /* start of a C comment */
@@ -155,10 +162,22 @@ static int yyread(char *buf,int max_size)
                                      copyToOutput(yytext,yyleng); 
 				     BEGIN(Scan); 
                                    }
-<SComment>^[ \t]*"//".*/\n	   { /* second line of special comment */
+<SComment>^[ \t]*"///"[\/]*\n      {
+                                     replaceCommentMarker(yytext,yyleng); 
+  				   }
+<SComment>^[ \t]*"///"[^\/\n].*/\n   { 
+                                     replaceCommentMarker(yytext,yyleng); 
+  				   }
+<SComment>^[ \t]*"//!".*/\n        { /* second line of special comment */
                                      replaceCommentMarker(yytext,yyleng); 
                                    }
-<SComment>\n[ \t]*"//".*/\n	   { /* other line of special comment */
+<SComment>\n[ \t]*"///"[\/]*\n     {
+                                     replaceCommentMarker(yytext,yyleng); 
+                                   }
+<SComment>\n[ \t]*"///"[^\/\n].*/\n  { 
+                                     replaceCommentMarker(yytext,yyleng); 
+  				   }
+<SComment>\n[ \t]*"//!".*/\n       { /* other line of special comment */
                                      replaceCommentMarker(yytext,yyleng); 
                                    }
 <SComment>\n			   { /* end of special comment */
@@ -176,6 +195,10 @@ void convertCppComments(BufStr *inBuf,BufStr *outBuf)
   g_inBufPos = 0;
   BEGIN(Scan);
   yylex();
+  if (Debug::isFlagSet(Debug::CommentCnv))
+  {
+    msg("-------------\n%s\n-------------\n",g_outBuf->data());
+  }
 }
 
 //----------------------------------------------------------------------------
diff --git a/src/debug.cpp b/src/debug.cpp
index 4afbfb1..8932622 100644
--- a/src/debug.cpp
+++ b/src/debug.cpp
@@ -48,6 +48,8 @@ static int labelToEnumValue(const char *l)
     return Debug::Preprocessor;
   else if (label=="Classes")
     return Debug::Classes;
+  else if (label=="CommentCnv")
+    return Debug::CommentCnv;
   else
     return 0;
 }
diff --git a/src/debug.h b/src/debug.h
index b78b98f..22c463b 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -27,7 +27,8 @@ class Debug
                      Functions    = 0x00000002, 
                      Variables    = 0x00000004,
                      Preprocessor = 0x00000008,
-                     Classes      = 0x00000010
+                     Classes      = 0x00000010,
+                     CommentCnv   = 0x00000020
                    };
     static void print(DebugMask mask,int prio,const char *fmt,...);
     static void setFlag(const char *label);
diff --git a/src/doxygen.cpp b/src/doxygen.cpp
index 6c1aff5..7f6b12e 100644
--- a/src/doxygen.cpp
+++ b/src/doxygen.cpp
@@ -2772,6 +2772,13 @@ static bool findClassRelation(
   //}
   //printf("\n");
 
+  QCString biName=bi->name;
+  bool explicitGlobalScope=FALSE;
+  if (biName.left(2)=="::") // explicit global scope
+  {
+     biName=biName.right(biName.length()-2);
+     explicitGlobalScope=TRUE;
+  }
 
   Entry *parentNode=root->parent;
   bool lastParent=FALSE;
@@ -2779,13 +2786,13 @@ static bool findClassRelation(
      // (in case of nested classes)
   {
     QCString scopeName= parentNode ? parentNode->name.data() : "";
-    int scopeOffset=scopeName.length();
+    int scopeOffset=explicitGlobalScope ? 0 : scopeName.length();
     do // try all parent scope prefixes, starting with the largest scope
     {
-      //printf("scopePrefix=`%s' bi->name=`%s'\n",
-      //    scopeName.left(scopeOffset).data(),bi->name.data());
+      //printf("scopePrefix=`%s' biName=`%s'\n",
+      //    scopeName.left(scopeOffset).data(),biName.data());
 
-      QCString baseClassName=bi->name;
+      QCString baseClassName=biName;
       if (scopeOffset>0)
       {
         baseClassName.prepend(scopeName.left(scopeOffset)+"::");
@@ -2794,7 +2801,7 @@ static bool findClassRelation(
                           (removeRedundantWhiteSpace(baseClassName));
       bool baseClassIsTypeDef;
       QCString templSpec;
-      ClassDef *baseClass=getResolvedClass(cd,baseClassName,&baseClassIsTypeDef,&templSpec);
+      ClassDef *baseClass=getResolvedClass(explicitGlobalScope ? 0 : cd,baseClassName,&baseClassIsTypeDef,&templSpec);
       //printf("baseClassName=%s baseClass=%p cd=%p\n",baseClassName.data(),baseClass,cd);
       //printf("    root->name=`%s' baseClassName=`%s' baseClass=%s templSpec=%s\n",
       //                    root->name.data(),
@@ -2807,7 +2814,7 @@ static bool findClassRelation(
       //   ) // Check for base class with the same name.
       //     // If found then look in the outer scope for a match
       //     // and prevent recursion.
-      if (!isRecursiveBaseClass(root->name,baseClassName))
+      if (!isRecursiveBaseClass(root->name,baseClassName) || explicitGlobalScope)
       {
         Debug::print(
             Debug::Classes,0,"    class relation %s inherited by %s found (%s and %s)\n",
@@ -2849,6 +2856,7 @@ static bool findClassRelation(
           }
         }
 
+        //printf("cd=%p baseClass=%p\n",cd,baseClass);
         bool found=baseClass!=0 && (baseClass!=cd || mode==TemplateInstances);
         NamespaceDef *nd=cd->getNamespaceDef();
         if (!found && (i=baseClassName.findRev("::"))!=-1)
@@ -2887,7 +2895,7 @@ static bool findClassRelation(
                 ClassDef *ucd;
                 for (cli.toFirst(); (ucd=cli.current()) && !found; ++cli)
                 {
-                  if (rightScopeMatch(ucd->name(),bi->name))
+                  if (rightScopeMatch(ucd->name(),biName))
                   {
                     baseClass = ucd;
                     found = TRUE;
@@ -2921,7 +2929,7 @@ static bool findClassRelation(
                 ClassDef *ucd;
                 for (cli.toFirst(); (ucd=cli.current()) && !found; ++cli)
                 {
-                  if (rightScopeMatch(ucd->name(),bi->name))
+                  if (rightScopeMatch(ucd->name(),biName))
                   {
                     baseClass = ucd;
                     found = TRUE;
@@ -2939,7 +2947,7 @@ static bool findClassRelation(
                 ClassDef *ucd;
                 for (cli.toFirst(); (ucd=cli.current()) && !found; ++cli)
                 {
-                  if (rightScopeMatch(ucd->name(),bi->name))
+                  if (rightScopeMatch(ucd->name(),biName))
                   {
                     baseClass = ucd;
                     found = TRUE;
@@ -2949,10 +2957,10 @@ static bool findClassRelation(
             }
           }
         }
-        bool isATemplateArgument = templateNames!=0 && templateNames->find(bi->name)!=0;
-        if (/*!isATemplateArgument &&*/ found)
+        bool isATemplateArgument = templateNames!=0 && templateNames->find(biName)!=0;
+        if (found)
         {
-          Debug::print(Debug::Classes,0,"    Documented class `%s' templSpec=%s\n",bi->name.data(),templSpec.data());
+          Debug::print(Debug::Classes,0,"    Documented class `%s' templSpec=%s\n",biName.data(),templSpec.data());
           // add base class to this class
 
           // if templSpec is not empty then we should "instantiate"
@@ -2971,7 +2979,7 @@ static bool findClassRelation(
           else if (mode==DocumentedOnly)
           {
             QCString usedName;
-            if (baseClassIsTypeDef) usedName=bi->name;
+            if (baseClassIsTypeDef) usedName=biName;
             cd->insertBaseClass(baseClass,usedName,bi->prot,bi->virt,templSpec);
             // add this class as super class to the base class
             baseClass->insertSubClass(cd,bi->prot,bi->virt,templSpec);
@@ -2982,7 +2990,7 @@ static bool findClassRelation(
         {
           Debug::print(Debug::Classes,0,
                        "    New undocumented base class `%s' baseClassName=%s\n",
-                       bi->name.data(),baseClassName.data()
+                       biName.data(),baseClassName.data()
                       );
           baseClass=0;
           if (isATemplateArgument)
@@ -3004,7 +3012,7 @@ static bool findClassRelation(
             if (isArtificial) baseClass->setClassIsArtificial();
           }
           // add base class to this class
-          cd->insertBaseClass(baseClass,bi->name,bi->prot,bi->virt,templSpec);
+          cd->insertBaseClass(baseClass,biName,bi->prot,bi->virt,templSpec);
           // add this class as super class to the base class
           baseClass->insertSubClass(cd,bi->prot,bi->virt,templSpec);
           // the undocumented base was found in this file
@@ -3014,8 +3022,22 @@ static bool findClassRelation(
         }
         else
         {
-          Debug::print(Debug::Classes,0,"    Base class `%s' not found\n",bi->name.data());
+          Debug::print(Debug::Classes,0,"    Base class `%s' not found\n",biName.data());
+        }
+      }
+      else
+      {
+        if (mode!=TemplateInstances)
+        {
+          warn(root->fileName,root->startLine,
+              "Detected potential recursive class relation "
+              "between class %s and base class %s!\n",
+              root->name.data(),baseClassName.data()
+              );
         }
+        // for mode==TemplateInstance this case is quite common and
+        // indicates a relation between a template class and a template 
+        // instance with the same name.
       }
       if (scopeOffset==0)
       {
diff --git a/src/latexgen.cpp b/src/latexgen.cpp
index 6665d1f..58e6044 100644
--- a/src/latexgen.cpp
+++ b/src/latexgen.cpp
@@ -1757,7 +1757,10 @@ void LatexGenerator::startDotFile(const char *name,bool hasCaption)
     +baseName;
   writeDotGraphFromFile(name,outName,EPS);
   if (hasCaption)
+  {
     t << "\\begin{figure}[H]" << endl;
+    t << "\\begin{center}" << endl;
+  }
   else
     t << "\\mbox{";
   t << "\\includegraphics";
@@ -1781,6 +1784,7 @@ void LatexGenerator::endDotFile(bool hasCaption)
   if (hasCaption)
   {
     t << "}" << endl;
+    t << "\\end{center}" << endl;
     t << "\\end{figure}" << endl;
   }
 }
diff --git a/src/pre.l b/src/pre.l
index f429133..7af3435 100644
--- a/src/pre.l
+++ b/src/pre.l
@@ -1549,16 +1549,16 @@ CHARLIT   (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
 					  else // define is a guard => hide
 					  {
 					    //printf("Found a guard %s\n",yytext);
-  					    Define *def=0;
-					    if (g_includeStack.isEmpty()) 
-					    {
-					      addDefine();
-					    }
-					    if ((def=g_fileDefineDict->find(g_defName))==0)
+  					    Define *def=g_fileDefineDict->find(g_defName);
+					    //if (g_includeStack.isEmpty()) 
+					    //{
+					    //  addDefine();
+					    //}
+					    if (def==0) // new define name for this file
 					    {
 					      g_fileDefineDict->insert(g_defName,newDefine());
 					    }
-					    else if (def)// name already exists
+					    else // name already exists
 					    {
 					      if (def->undef) // undefined name
 					      {
@@ -1574,9 +1574,6 @@ CHARLIT   (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
 					        //printf("Error: define %s is defined more than once!\n",g_defName.data());
 					      }
 					    }
-					    QCString tmp=(QCString)"#define "+g_defName;
-					    outputArray(tmp.data(),tmp.length());
-  					    //outputChar('\n');
 					    g_lastGuardName.resize(0);
 					    BEGIN(Start);
 					  }
diff --git a/src/scanner.l b/src/scanner.l
index 8bfa406..79fe0f1 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -2652,18 +2652,20 @@ CHARLIT   (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
 <BasesProt>{BN}				{ lineCount(); }
 <BasesProt>.				{ unput(*yytext); BEGIN(Bases); }
 <Bases>("::")?{BN}*({ID}{BN}*"::"{BN}*)*{ID}	{ 
-  					  QCString bName = yytext;
-					  bName = bName.stripWhiteSpace();
-  					  bool globalScope = bName.at(0)==':' && baseName.isEmpty();
-  					  if (!globalScope)
-  					    baseName += bName;
-					  else
-					    baseName += (bName.data()+2);
+  					  //QCString bName = yytext;
+					  //bName = bName.stripWhiteSpace();
+  					  //bool globalScope = bName.at(0)==':' && baseName.isEmpty();
+  					  //if (!globalScope)
+  					  //  baseName += bName;
+					  //else
+					  //  baseName += (bName.data()+2);
+  					  baseName+=yytext;
 					  current->args += ' ';
-					  if (!globalScope)
-					    current->args += bName;
-					  else
-					    current->args += (bName.data()+2);
+					  //if (!globalScope)
+					  //  current->args += bName;
+					  //else
+					  //  current->args += (bName.data()+2);
+					  current->args += yytext;
 					}
 <Bases>{BN}*{ID}("."{ID})*		{ // Java style class
     					  QCString name = yytext;
@@ -4149,6 +4151,7 @@ CHARLIT   (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
 <JavaDoc,LineDoc,ClassDocBrief,AfterDocBrief,AfterDocLine>"\\"[a-z_A-Z][a-z_A-Z0-9]*[\\] { // directory type of text
   					  current->brief+=yytext;
   					}
+<LineDoc,AfterDocLine,CopyArgCommentLine>{CMD}("brief"|"short") {}
 <JavaDoc,LineDoc,ClassDocBrief,AfterDocBrief,AfterDocLine,CopyArgCommentLine>{CMD}[a-z_A-Z][a-z_A-Z0-9]* 	{
   					  QCString *pValue=Doxygen::aliasDict[yytext+1];
 					  if (pValue)
diff --git a/src/util.cpp b/src/util.cpp
index 1b7b78c..83dd2a2 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -2166,8 +2166,15 @@ bool getScopeDefs(const char *docScope,const char *scope,
   //printf("getScopeDefs: docScope=`%s' scope=`%s'\n",docScope,scope);
   if (scopeName.isEmpty()) return FALSE;
 
+  bool explicitGlobalScope=FALSE;
+  if (scopeName.at(0)==':' && scopeName.at(1)==':')
+  {
+    scopeName=scopeName.right(scopeName.length()-2);  
+    explicitGlobalScope=TRUE;
+  }
+  
   QCString docScopeName=docScope;
-  int scopeOffset=docScopeName.length();
+  int scopeOffset=explicitGlobalScope ? 0 : docScopeName.length();
 
   do // for each possible docScope (from largest to and including empty)
   {
@@ -2195,6 +2202,14 @@ bool getScopeDefs(const char *docScope,const char *scope,
   return FALSE;
 }
 
+static bool isLowerCase(QCString &s)
+{
+  char *p=s.data();
+  int c;
+  while ((c=*p++)) if (!islower(c)) return FALSE;
+  return TRUE; 
+}
+
 /*!
  * generate a reference to a class, namespace or member.
  * `scName' is the name of the scope that contains the documentation 
@@ -2229,7 +2244,26 @@ bool generateRef(OutputDocInterface &od,const char *scName,
   {
     ClassDef *cd=0;
     NamespaceDef *nd=0;
-    if (linkText.isEmpty()) linkText=tmpName;
+
+    if (linkText.isEmpty())
+    {
+      linkText=tmpName;
+      // strip :: prefix if present
+      if (linkText.at(0)==':' && linkText.at(1)==':')
+      {
+        linkText=linkText.right(linkText.length()-2);
+      }
+    }
+
+    if (scopePos==-1 && isLowerCase(tsName))
+    { // link to lower case only name => do not try to autolink 
+      od.docify(linkText);
+      // text has been written, stop now.
+      return FALSE;
+    }
+
+    //printf("scName=%s tmpName=%s\n",scName,tmpName.data());
+    
     // check if this is a class or namespace reference
     if (scName!=tmpName && getScopeDefs(scName,name,cd,nd))
     {
diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp
index 435c7dc..60eb9f3 100644
--- a/src/xmlgen.cpp
+++ b/src/xmlgen.cpp
@@ -224,9 +224,12 @@ class XMLGenerator : public OutputDocInterface
 
     void docify(const char *s) 
     {
-      XML_DB(("(docify \"%s\")\n",s));
-      startParMode();
-      writeXMLString(m_t,s);
+      if (m_outputEnabled)
+      {
+        XML_DB(("(docify \"%s\")\n",s));
+        startParMode();
+        writeXMLString(m_t,s);
+      }
     }
     void writeChar(char c) 
     {
@@ -779,10 +782,12 @@ class XMLGenerator : public OutputDocInterface
     void startPageRef() 
     {
       XML_DB(("(startPageRef)\n"));
+      m_outputEnabled = FALSE;
     }
     void endPageRef(const char *,const char *) 
     {
       XML_DB(("(endPageRef)\n"));
+      m_outputEnabled = TRUE;
     }
     void writeLineNumber(const char *extRef,const char *compId,
                          const char *anchorId,int l)
@@ -886,6 +891,7 @@ class XMLGenerator : public OutputDocInterface
       m_t.setDevice(&m_b);
       m_t.setEncoding(QTextStream::Latin1);
       m_inParamList = FALSE;
+      m_outputEnabled = TRUE;
     }
     /*! copy constructor */
     XMLGenerator(const XMLGenerator *xg)
@@ -902,6 +908,7 @@ class XMLGenerator : public OutputDocInterface
       m_inParStack  = xg->m_inParStack;
       m_inListStack = xg->m_inListStack;
       m_inParamList = xg->m_inParamList;
+      m_outputEnabled = xg->m_outputEnabled;
     } 
     /*! destructor */
     virtual ~XMLGenerator()
@@ -935,6 +942,7 @@ class XMLGenerator : public OutputDocInterface
     ValStack<bool> m_inParStack;  
     ValStack<bool> m_inListStack;
     bool m_inParamList;
+    bool m_outputEnabled;
     
     friend void writeXMLCodeBlock(QTextStream &t,FileDef *fd);
 };
-- 
cgit v0.12

