From b9e362903872f0313e6e26154aacc6c185a9b31d Mon Sep 17 00:00:00 2001
From: dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>
Date: Thu, 17 Nov 2011 21:22:48 +0000
Subject: Release-1.7.5.1-20111117

---
 INSTALL                   |    4 +-
 README                    |    4 +-
 configure                 |    2 +-
 doc/docblocks.doc         |    2 +-
 doc/doxygen_manual.tex    |    1 -
 doc/language.doc          |    2 +-
 doc/translator_report.txt |    2 +-
 examples/example.tag      |    7 -
 qtools/Doxyfile           |    2 +-
 src/Makefile.in           |    3 +-
 src/classdef.cpp          |   14 +-
 src/code.l                |   26 +-
 src/config.xml            |   19 +-
 src/configoptions.cpp     |   18 +-
 src/dirdef.cpp            |   14 +-
 src/doctokenizer.l        |    7 +-
 src/dot.cpp               |   43 +-
 src/doxygen.cpp           |  143 +--
 src/doxygen.css           |    5 +-
 src/doxygen_css.h         |    5 +-
 src/entry.h               |    3 +-
 src/filedef.cpp           |   20 +-
 src/fortrancode.l         |    2 +-
 src/fortranscanner.l      |   16 +-
 src/groupdef.cpp          |    2 +-
 src/header.html           |    1 +
 src/header_html.h         |    1 +
 src/htmlgen.cpp           |    5 +-
 src/index.cpp             |  702 +------------
 src/index.h               |    5 +-
 src/layout.cpp            |   24 +-
 src/libdoxygen.pro.in     |    1 +
 src/libdoxygen.t          |   15 +-
 src/memberlist.cpp        |    5 +-
 src/namespacedef.cpp      |   12 +-
 src/navtree.js            |   36 +-
 src/navtree_js.h          |   36 +-
 src/pagedef.cpp           |    3 +-
 src/scanner.l             |   39 +-
 src/search.css            |    5 +
 src/search.js             |   69 ++
 src/search_css.h          |    5 +
 src/search_js.h           |   69 ++
 src/searchindex.cpp       |  771 ++++++++++++++
 src/searchindex.h         |    8 +
 src/sizzle.js             |   10 +
 src/sizzle_js.h           |   10 +
 src/svgpan.js             |    3 +-
 src/svgpan_js.h           |    3 +-
 src/tclscanner.l          | 1041 ++++++++++---------
 src/util.cpp              |    7 +
 src/vhdlcode.l            |   35 +-
 src/vhdldocgen.cpp        | 1795 +++++++++++++++++---------------
 src/vhdldocgen.h          |  102 +-
 src/vhdlscanner.h         |   60 +-
 src/vhdlscanner.l         | 2499 +++++++++++++--------------------------------
 winbuild/Doxygen.vcproj   |   22 +
 winbuild/runbison.bat     |    4 +
 58 files changed, 3656 insertions(+), 4113 deletions(-)

diff --git a/INSTALL b/INSTALL
index 8615b17..12d9eb0 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,7 +1,7 @@
-DOXYGEN Version 1.7.5.1-20111027
+DOXYGEN Version 1.7.5.1-20111117
 
 Please read the installation section of the manual 
 (http://www.doxygen.org/install.html) for instructions.
 
 --------
-Dimitri van Heesch (27 October 2011)
+Dimitri van Heesch (17 November 2011)
diff --git a/README b/README
index 978a647..ace5715 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-DOXYGEN Version 1.7.5.1_20111027
+DOXYGEN Version 1.7.5.1_20111117
 
 Please read INSTALL for compilation instructions.
 
@@ -26,4 +26,4 @@ forum.
 
 Enjoy,
 
-Dimitri van Heesch (dimitri@stack.nl) (27 October 2011)
+Dimitri van Heesch (dimitri@stack.nl) (17 November 2011)
diff --git a/configure b/configure
index b43bf32..42088c1 100755
--- a/configure
+++ b/configure
@@ -20,7 +20,7 @@ doxygen_version_minor=7
 doxygen_version_revision=5.1
 
 #NOTE: Setting version_mmn to "NO" will omit mmn info from the package.
-doxygen_version_mmn=20111027
+doxygen_version_mmn=20111117
 
 bin_dirs=`echo $PATH | sed -e "s/:/ /g"`
 
diff --git a/doc/docblocks.doc b/doc/docblocks.doc
index ea51edd..2e6878d 100644
--- a/doc/docblocks.doc
+++ b/doc/docblocks.doc
@@ -414,7 +414,7 @@ Here is the same example again but now using doxygen style comments:
  \endhtmlonly
 
 Since python looks more like Java than like C or C++, you should set 
-\ref cfg_optimize_output_java "OPTMIZE_OUTPUT_JAVA" to \c YES in the
+\ref cfg_optimize_output_java "OPTIMIZE_OUTPUT_JAVA" to \c YES in the
 config file. 
 
 
diff --git a/doc/doxygen_manual.tex b/doc/doxygen_manual.tex
index 4db934f..9dfd459 100644
--- a/doc/doxygen_manual.tex
+++ b/doc/doxygen_manual.tex
@@ -13,7 +13,6 @@
 % input used in their production; they are not affected by this license.
 
 \documentclass[a4paper]{report}
-\usepackage{a4wide}
 \usepackage{makeidx}
 \usepackage{fancyhdr}
 \usepackage{float}
diff --git a/doc/language.doc b/doc/language.doc
index 51bcfec..a155d48 100644
--- a/doc/language.doc
+++ b/doc/language.doc
@@ -23,7 +23,7 @@ text fragments, generated by doxygen, can be produced in languages other
 than English (the default). The output language is chosen through the
 configuration file (with default name and known as Doxyfile).
 
-Currently (version 1.7.4), 39 languages 
+Currently (version 1.7.5), 39 languages 
 are supported (sorted alphabetically):
 Afrikaans, Arabic, Armenian, Brazilian Portuguese, Catalan, Chinese,
 Chinese Traditional, Croatian, Czech, Danish, Dutch, English,
diff --git a/doc/translator_report.txt b/doc/translator_report.txt
index fd23384..f53d003 100644
--- a/doc/translator_report.txt
+++ b/doc/translator_report.txt
@@ -1,4 +1,4 @@
-(1.7.4)
+(1.7.5)
 
 Doxygen supports the following 39 languages (sorted alphabetically):
 
diff --git a/examples/example.tag b/examples/example.tag
index a38ab5c..593dc85 100644
--- a/examples/example.tag
+++ b/examples/example.tag
@@ -3,12 +3,5 @@
   <compound kind="class">
     <name>Test</name>
     <filename>class_test.html</filename>
-    <member kind="function">
-      <type>void</type>
-      <name>example</name>
-      <anchorfile>class_test.html</anchorfile>
-      <anchor>a47b775f65718978f1ffcd96376f8ecfa</anchor>
-      <arglist>()</arglist>
-    </member>
   </compound>
 </tagfile>
diff --git a/qtools/Doxyfile b/qtools/Doxyfile
index 5934468..c57b15f 100644
--- a/qtools/Doxyfile
+++ b/qtools/Doxyfile
@@ -165,8 +165,8 @@ QHG_LOCATION           =
 GENERATE_ECLIPSEHELP   = YES
 ECLIPSE_DOC_ID         = org.doxygen.qtools
 DISABLE_INDEX          = YES
-ENUM_VALUES_PER_LINE   = 4
 GENERATE_TREEVIEW      = YES
+ENUM_VALUES_PER_LINE   = 4
 USE_INLINE_TREES       = YES
 TREEVIEW_WIDTH         = 250
 EXT_LINKS_IN_WINDOW    = NO
diff --git a/src/Makefile.in b/src/Makefile.in
index 6be0bff..19bcf7a 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -49,6 +49,7 @@ distclean: clean
                ce_parse.cpp ce_parse.h doxytag.cpp tag.cpp commentscan.cpp \
 	       declinfo.cpp defargs.cpp commentcnv.cpp doctokenizer.cpp \
 	       pycode.cpp pyscanner.cpp fortrancode.cpp fortranscanner.cpp \
-	       vhdlscanner.cpp vhdlcode.cpp tclscanner.cpp
+	       vhdlscanner.cpp vhdlcode.cpp tclscanner.cpp vhdlparser.h \
+	       vhdlparser.cpp
 
 FORCE:
diff --git a/src/classdef.cpp b/src/classdef.cpp
index 4dd9860..fd3aedf 100644
--- a/src/classdef.cpp
+++ b/src/classdef.cpp
@@ -1774,7 +1774,7 @@ void ClassDef::writeDeclarationLink(OutputList &ol,bool &found,const char *heade
     {
       ol.writeString(" ");
       ol.insertMemberAlign();
-      VhdlDocGen::writeClassType(this,ol,cname);
+      ol.writeString(VhdlDocGen::getProtectionName((VhdlDocGen::VhdlClasses)protection()));
     }
     ol.endMemberItem();
 
@@ -1962,12 +1962,7 @@ void ClassDef::writeDocumentation(OutputList &ol)
   endTitle(ol,getOutputFileBase(),displayName());
   writeDocumentationContents(ol,pageTitle);
     
-  if (generateTreeView)
-  {
-    writeNavigationPath(ol);
-  }
- 
-  endFile(ol,TRUE);
+  endFileWithNavPath(this,ol);
 
   if (Config_getBool("SEPARATE_MEMBER_PAGES"))
   {
@@ -3153,7 +3148,6 @@ void ClassDef::determineIntfUsageRelation()
 
 QCString ClassDef::compoundTypeString() const
 {
-  if (m_impl->compType==Interface && getLanguage()==SrcLangExt_ObjC) return "class";
   if (getLanguage()==SrcLangExt_Fortran)
   {
     switch (m_impl->compType)
@@ -3175,7 +3169,7 @@ QCString ClassDef::compoundTypeString() const
       case Class:     return "class";
       case Struct:    return "struct";
       case Union:     return "union";
-      case Interface: return "interface";
+      case Interface: return getLanguage()==SrcLangExt_ObjC ? "class" : "interface";
       case Protocol:  return "protocol";
       case Category:  return "category";
       case Exception: return "exception";
@@ -3714,7 +3708,7 @@ void ClassDef::writeMemberDeclarations(OutputList &ol,MemberList::ListType lt,co
   {
     if (getLanguage()==SrcLangExt_VHDL) // use specific declarations function
     {
-      VhdlDocGen::writeVhdlDeclarations(ml,ol,0,this,0);
+      VhdlDocGen::writeVhdlDeclarations(ml,ol,0,this,0,0);
     }
     else // use generic declaration function
     {
diff --git a/src/code.l b/src/code.l
index a4313c4..ffcc64c 100644
--- a/src/code.l
+++ b/src/code.l
@@ -655,7 +655,7 @@ static void setParameterList(MemberDef *md)
   }
 }
 
-static ClassDef *stripClassName(const char *s)
+static ClassDef *stripClassName(const char *s,Definition *d=g_currentDefinition)
 {
   int pos=0;
   QCString type = s;
@@ -667,11 +667,11 @@ static ClassDef *stripClassName(const char *s)
     ClassDef *cd=0;
     if (!g_classScope.isEmpty())
     {
-      cd=getResolvedClass(g_currentDefinition,g_sourceFileDef,g_classScope+"::"+clName);
+      cd=getResolvedClass(d,g_sourceFileDef,g_classScope+"::"+clName);
     }
     if (cd==0)
     {
-      cd=getResolvedClass(g_currentDefinition,g_sourceFileDef,clName);
+      cd=getResolvedClass(d,g_sourceFileDef,clName);
     }
     //printf("stripClass trying `%s' = %p\n",clName.data(),cd);
     if (cd)
@@ -701,7 +701,7 @@ static MemberDef *setCallContextForVar(const QCString &name)
       if (md)
       {
         //printf("name=%s scope=%s\n",locName.data(),scope.data());
-        g_theCallContext.setClass(stripClassName(md->typeString()));
+        g_theCallContext.setClass(stripClassName(md->typeString(),md->getOuterScope()));
         return md;
       }
     }
@@ -714,7 +714,7 @@ static MemberDef *setCallContextForVar(const QCString &name)
 	if (md)
 	{
 	  //printf("name=%s scope=%s\n",locName.data(),scope.data());
-	  g_theCallContext.setClass(stripClassName(md->typeString()));
+	  g_theCallContext.setClass(stripClassName(md->typeString(),md->getOuterScope()));
 	  return md;
 	}
       }
@@ -747,7 +747,7 @@ static MemberDef *setCallContextForVar(const QCString &name)
 	if (g_scopeStack.top()!=CLASSBLOCK)
 	{
           //fprintf(stderr,"class member `%s' mcd=%s\n",name.data(),mcd->name().data());
-	  g_theCallContext.setClass(stripClassName(md->typeString()));
+	  g_theCallContext.setClass(stripClassName(md->typeString(),md->getOuterScope()));
 	}
 	return md;
       }
@@ -763,7 +763,7 @@ static MemberDef *setCallContextForVar(const QCString &name)
       MemberDef *md=mn->getFirst();
       if (!md->isStatic() || md->getBodyDef()==g_sourceFileDef)
       {
-        g_theCallContext.setClass(stripClassName(md->typeString()));
+        g_theCallContext.setClass(stripClassName(md->typeString(),md->getOuterScope()));
         return md;
       }
       return 0;
@@ -782,7 +782,7 @@ static MemberDef *setCallContextForVar(const QCString &name)
 	// defined as external.
         if (!md->isStatic() || md->getBodyDef()==g_sourceFileDef)
         {
-          g_theCallContext.setClass(stripClassName(md->typeString()));
+          g_theCallContext.setClass(stripClassName(md->typeString(),md->getOuterScope()));
 	  //printf("returning member %s in source file %s\n",md->name().data(),g_sourceFileDef->name().data());
           return md;
         }
@@ -801,7 +801,7 @@ static void updateCallContextForSmartPointer()
   MemberDef *md;
   if (cd && (md=cd->isSmartPointer()))
   {
-    ClassDef *ncd = stripClassName(md->typeString());
+    ClassDef *ncd = stripClassName(md->typeString(),md->getOuterScope());
     if (ncd)
     {
       g_theCallContext.setClass(ncd);
@@ -890,7 +890,7 @@ static bool getLinkInScope(const QCString &c,  // scope
     //fprintf(stderr,"d=%p linkable=%d\n",d,d?d->isLinkable():0);
     if (d && d->isLinkable())
     {
-      g_theCallContext.setClass(stripClassName(md->typeString()));
+      g_theCallContext.setClass(stripClassName(md->typeString(),md->getOuterScope()));
       //printf("g_currentDefinition=%p g_currentMemberDef=%p g_insideBody=%d\n",
       //        g_currentDefinition,g_currentMemberDef,g_insideBody);
 
@@ -1106,7 +1106,7 @@ static bool generateClassMemberLink(CodeOutputInterface &ol,MemberDef *xmd,const
     }
   }
 
-  ClassDef *typeClass = stripClassName(removeAnonymousScopes(xmd->typeString()));
+  ClassDef *typeClass = stripClassName(removeAnonymousScopes(xmd->typeString()),xmd->getOuterScope());
   //fprintf(stderr,"%s -> typeName=%p\n",xmd->typeString(),typeClass);
   g_theCallContext.setClass(typeClass);
 
@@ -1219,7 +1219,7 @@ static void generateMemberLink(CodeOutputInterface &ol,const QCString &varName,
 		  vmd->getClassDef()==jcd)
 	      {
 		//printf("Found variable type=%s\n",vmd->typeString());
-		ClassDef *mcd=stripClassName(vmd->typeString());
+		ClassDef *mcd=stripClassName(vmd->typeString(),vmd->getOuterScope());
 		if (mcd && mcd->isLinkable())
 		{
 		  if (generateClassMemberLink(ol,mcd,memName)) return;
@@ -1240,7 +1240,7 @@ static void generateMemberLink(CodeOutputInterface &ol,const QCString &varName,
 	      vmd->getClassDef()==vcd)
 	  {
 	    //printf("Found variable type=%s\n",vmd->typeString());
-	    ClassDef *mcd=stripClassName(vmd->typeString());
+	    ClassDef *mcd=stripClassName(vmd->typeString(),vmd->getOuterScope());
 	    if (mcd && mcd->isLinkable())
 	    {
 	      if (generateClassMemberLink(ol,mcd,memName)) return;
diff --git a/src/config.xml b/src/config.xml
index 159fb1b..5ce921c 100644
--- a/src/config.xml
+++ b/src/config.xml
@@ -209,8 +209,13 @@ For example adding &quot;sideeffect=\par Side Effects:\n&quot; will allow you to
 put the command \sideeffect (or @sideeffect) in the documentation, which 
 will result in a user-defined paragraph with heading &quot;Side Effects:&quot;. 
 You can put \n&apos;s in the value part of an alias to insert newlines. 
-'>
-    </option>
+'/>
+    <option type='list' id='TCL_SUBST' format='string' docs='
+This tag can be used to specify a number of word-keyword mappings (TCL only). 
+A mapping has the form &quot;name=value&quot;. For example adding 
+&quot;class=itcl::class&quot; will allow you to use the command class in the 
+itcl::class meaning.
+'/>
     <option type='bool' id='OPTIMIZE_OUTPUT_FOR_C' docs='
 Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C 
 sources only. Doxygen will then generate output that is more tailored for C. 
@@ -809,7 +814,7 @@ each generated HTML page. If it is left blank doxygen will generate a
 standard header. Note that when using a custom header you are responsible  
 for the proper inclusion of any scripts and style sheets that doxygen 
 needs, which is dependent on the configuration options used. 
-It is adviced to generate a default header using "doxygen -w html 
+It is advised to generate a default header using "doxygen -w html 
 header.html footer.html stylesheet.css YourConfigFile" and then modify 
 that header. Note that the header is subject to change so you typically 
 have to redo this when upgrading to a newer version of doxygen or when 
@@ -826,7 +831,7 @@ style sheet that is used by each HTML page. It can be used to
 fine-tune the look of the HTML output. If the tag is left blank doxygen 
 will generate a default style sheet. Note that doxygen will try to copy 
 the style sheet file to the HTML output directory, so don&apos;t put your own 
-stylesheet in the HTML output directory as well, or it will be erased! 
+style sheet in the HTML output directory as well, or it will be erased! 
 ' defval='' depends='GENERATE_HTML'/>
     <option type='list' id='HTML_EXTRA_FILES' format='file' docs='
 The HTML_EXTRA_FILES tag can be used to specify one or more extra images or 
@@ -838,7 +843,7 @@ the files will be copied as-is; there are no commands or markers available.
 ' depends='GENERATE_HTML'/>
     <option type='int' id='HTML_COLORSTYLE_HUE' docs='
 The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. 
-Doxygen will adjust the colors in the stylesheet and background images 
+Doxygen will adjust the colors in the style sheet and background images 
 according to this color. Hue is specified as an angle on a colorwheel, 
 see http://en.wikipedia.org/wiki/Hue for more information. 
 For instance the value 0 represents red, 60 is yellow, 120 is green, 
@@ -1211,7 +1216,7 @@ programs which support those fields.
 Note: wordpad (write) and others do not support links. 
 ' defval='0' depends='GENERATE_RTF'/>
     <option type='string' id='RTF_STYLESHEET_FILE' format='file' docs='
-Load stylesheet definitions from file. Syntax is similar to doxygen&apos;s 
+Load style sheet definitions from file. Syntax is similar to doxygen&apos;s 
 config file, i.e. a series of assignments. You only have to provide 
 replacements, missing definitions are set to their default value. 
 ' defval='' depends='GENERATE_RTF'/>
@@ -1456,7 +1461,7 @@ set the path where dot can find it.
 If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
 will generate a graph for each documented class showing the direct and 
 indirect inheritance relations. Setting this tag to YES will force the 
-the CLASS_DIAGRAMS tag to NO. 
+CLASS_DIAGRAMS tag to NO. 
 ' defval='1' depends='HAVE_DOT'/>
     <option type='bool' id='COLLABORATION_GRAPH' docs='
 If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
diff --git a/src/configoptions.cpp b/src/configoptions.cpp
index 17514c8..f696b2a 100644
--- a/src/configoptions.cpp
+++ b/src/configoptions.cpp
@@ -294,6 +294,14 @@ void addConfigOptions(Config *cfg)
                  "You can put \\n's in the value part of an alias to insert newlines."
                 );
   //----
+  cl = cfg->addList(
+                 "TCL_SUBST",
+                 "This tag can be used to specify a number of word-keyword mappings (TCL only).\n"
+                 "A mapping has the form \"name=value\". For example adding\n"
+                 "\"class=itcl::class\" will allow you to use the command class in the\n"
+                 "itcl::class meaning."
+                );
+  //----
   cb = cfg->addBool(
                  "OPTIMIZE_OUTPUT_FOR_C",
                  "Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C\n"
@@ -1156,7 +1164,7 @@ void addConfigOptions(Config *cfg)
                  "standard header. Note that when using a custom header you are responsible\n"
                  " for the proper inclusion of any scripts and style sheets that doxygen\n"
                  "needs, which is dependent on the configuration options used.\n"
-                 "It is adviced to generate a default header using \"doxygen -w html\n"
+                 "It is advised to generate a default header using \"doxygen -w html\n"
                  "header.html footer.html stylesheet.css YourConfigFile\" and then modify\n"
                  "that header. Note that the header is subject to change so you typically\n"
                  "have to redo this when upgrading to a newer version of doxygen or when\n"
@@ -1181,7 +1189,7 @@ void addConfigOptions(Config *cfg)
                  "fine-tune the look of the HTML output. If the tag is left blank doxygen\n"
                  "will generate a default style sheet. Note that doxygen will try to copy\n"
                  "the style sheet file to the HTML output directory, so don't put your own\n"
-                 "stylesheet in the HTML output directory as well, or it will be erased!"
+                 "style sheet in the HTML output directory as well, or it will be erased!"
                 );
   cs->setWidgetType(ConfigString::File);
   cs->addDependency("GENERATE_HTML");
@@ -1201,7 +1209,7 @@ void addConfigOptions(Config *cfg)
   ci = cfg->addInt(
                  "HTML_COLORSTYLE_HUE",
                  "The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.\n"
-                 "Doxygen will adjust the colors in the stylesheet and background images\n"
+                 "Doxygen will adjust the colors in the style sheet and background images\n"
                  "according to this color. Hue is specified as an angle on a colorwheel,\n"
                  "see http://en.wikipedia.org/wiki/Hue for more information.\n"
                  "For instance the value 0 represents red, 60 is yellow, 120 is green,\n"
@@ -1807,7 +1815,7 @@ void addConfigOptions(Config *cfg)
   //----
   cs = cfg->addString(
                  "RTF_STYLESHEET_FILE",
-                 "Load stylesheet definitions from file. Syntax is similar to doxygen's\n"
+                 "Load style sheet definitions from file. Syntax is similar to doxygen's\n"
                  "config file, i.e. a series of assignments. You only have to provide\n"
                  "replacements, missing definitions are set to their default value."
                 );
@@ -2198,7 +2206,7 @@ void addConfigOptions(Config *cfg)
                  "If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen\n"
                  "will generate a graph for each documented class showing the direct and\n"
                  "indirect inheritance relations. Setting this tag to YES will force the\n"
-                 "the CLASS_DIAGRAMS tag to NO.",
+                 "CLASS_DIAGRAMS tag to NO.",
                  TRUE
                 );
   cb->addDependency("HAVE_DOT");
diff --git a/src/dirdef.cpp b/src/dirdef.cpp
index bce7ce9..4833c7e 100644
--- a/src/dirdef.cpp
+++ b/src/dirdef.cpp
@@ -426,15 +426,9 @@ void DirDef::writeDocumentation(OutputList &ol)
 
   ol.endContents();
 
-  if (generateTreeView)
-  {
-    writeNavigationPath(ol);
-  }
+  endFileWithNavPath(this,ol);
 
-  endFile(ol,TRUE); 
   ol.popGeneratorState();
-
-
 }
 
 void DirDef::setLevel()
@@ -735,12 +729,8 @@ void DirRelation::writeDocumentation(OutputList &ol)
 
   ol.endContents();
   
-  if (generateTreeView)
-  {
-    m_src->writeNavigationPath(ol);
-  }
+  endFileWithNavPath(m_src,ol);
 
-  endFile(ol,TRUE); 
   ol.popGeneratorState();
 }
 
diff --git a/src/doctokenizer.l b/src/doctokenizer.l
index 3e7b670..3772807 100644
--- a/src/doctokenizer.l
+++ b/src/doctokenizer.l
@@ -301,7 +301,7 @@ LISTITEM {BLANK}*{OPTSTARS}"-"("#")?{WS}
 ENDLIST  {BLANK}*{OPTSTARS}"."{BLANK}*\n
 ATTRIB   {ID}{WS}*("="{WS}*(("\""[^\"]*"\"")|("'"[^\']*"'")|[^ \t\r\n'"><]+))?
 URLCHAR   [a-z_A-Z0-9\!\~\,\:\;\'\$\?\@\&\%\#\.\-\+\/\=]
-URLMASK   ({URLCHAR}+([({]{URLCHAR}*[)}])?)*
+URLMASK   ({URLCHAR}+([({]{URLCHAR}*[)}])?)+
 FILESCHAR [a-z_A-Z0-9\\:\\\/\-\+]
 FILEECHAR [a-z_A-Z0-9\-\+]
 HFILEMASK ("."{FILESCHAR}*{FILEECHAR}+)*
@@ -469,6 +469,11 @@ REFWORD   {LABELID}|{REFWORD2}|{REFWORD3}
 			 }
 			 return TK_COMMAND;
   		       }
+<St_Para>("http:"|"https:"|"ftp:"|"file:"|"news:"){URLMASK}/\. { // URL.
+                         g_token->name=yytext;
+			 g_token->isEMailAddr=FALSE;
+			 return TK_URL;
+                       }
 <St_Para>("http:"|"https:"|"ftp:"|"file:"|"news:"){URLMASK} { // URL
                          g_token->name=yytext;
 			 g_token->isEMailAddr=FALSE;
diff --git a/src/dot.cpp b/src/dot.cpp
index 66ec988..e72bf45 100644
--- a/src/dot.cpp
+++ b/src/dot.cpp
@@ -537,11 +537,12 @@ static bool readSVGSize(const QCString &fileName,int *width,int *height)
     if (numBytes>0)
     {
       buf[numBytes]='\0';
-      if (strncmp(buf,"<!--zoomable-->",15)==0)
+      if (strncmp(buf,"<!--zoomable ",13)==0)
       {
-        //printf("Found zoomable for %s!\n",fileName.data());
         *width=-1;
         *height=-1;
+        sscanf(buf,"<!--zoomable %d",height);
+        //printf("Found zoomable for %s!\n",fileName.data());
         found=TRUE;
       }
       else if (sscanf(buf,"<svg width=\"%dpt\" height=\"%dpt\"",width,height)==2)
@@ -569,18 +570,23 @@ static void writeSVGNotSupported(FTextStream &out)
 static bool writeSVGFigureLink(FTextStream &out,const QCString &relPath,
                            const QCString &baseName,const QCString &absImgName)
 {
-  int width=600,height=450;
+  int width=600,height=600;
   if (!readSVGSize(absImgName,&width,&height))
   {
     return FALSE;
   }
-  if (width==-1 && height==-1)
+  if (width==-1)
   {
+    if (height<=60) 
+      height=60;
+    else 
+      height+=40; // add some extra space for zooming
+    if (height>600) height=600; // clip to maximum height of 600 pixels
     out << "<div class=\"zoom\">";
     //out << "<object type=\"image/svg+xml\" data=\"" 
     //out << "<embed type=\"image/svg+xml\" src=\"" 
     out << "<iframe scrolling=\"no\" frameborder=\"0\" src=\"" 
-        << relPath << baseName << ".svg\" width=\"100%\" height=\"600\">";
+        << relPath << baseName << ".svg\" width=\"100%\" height=\"" << height << "\">";
   }
   else
   {
@@ -595,7 +601,7 @@ static bool writeSVGFigureLink(FTextStream &out,const QCString &relPath,
   //out << "</object>";
   //out << "</embed>";
   out << "</iframe>";
-  if (width==-1 && height==-1)
+  if (width==-1)
   {
     out << "</div>";
   }
@@ -959,7 +965,7 @@ bool DotFilePatcher::run()
           if (foundSize)
           {
             // insert special replacement header for interactive SVGs
-            t << "<!--zoomable-->\n";
+            t << "<!--zoomable " << height << " -->\n";
             t << svgZoomHeader;
             t << "var viewWidth = " << width << ";\n";
             t << "var viewHeight = " << height << ";\n";
@@ -1492,7 +1498,6 @@ static QCString convertLabel(const QCString &l)
   return result;
 }
 
-#if 0
 static QCString escapeTooltip(const QCString &tooltip)
 {
   QCString result;
@@ -1503,13 +1508,12 @@ static QCString escapeTooltip(const QCString &tooltip)
   {
     switch(c)
     {
-      case '\\': result+="\\\\"; break;
-      default:   result+=c; break;
+      case '"': result+="\\\""; break;
+      default: result+=c; break;
     }
   }
   return result;
 }
-#endif
 
 static void writeBoxMemberList(FTextStream &t,
             char prot,MemberList *ml,ClassDef *scope,
@@ -1653,7 +1657,7 @@ void DotNode::writeBox(FTextStream &t,
     }
     if (!m_tooltip.isEmpty())
     {
-      t << ",tooltip=\"" << /*escapeTooltip(m_tooltip)*/ m_tooltip << "\"";
+      t << ",tooltip=\"" << escapeTooltip(m_tooltip) << "\"";
     }
   }
   t << "];" << endl; 
@@ -2010,6 +2014,9 @@ void DotGfxHierarchyTable::writeGraph(FTextStream &out,
 {
   //printf("DotGfxHierarchyTable::writeGraph(%s)\n",name);
   //printf("m_rootNodes=%p count=%d\n",m_rootNodes,m_rootNodes->count());
+  
+  static bool vhdl = Config_getBool("OPTIMIZE_OUTPUT_VHDL");
+
   if (m_rootSubgraphs->count()==0) return;
 
   QDir d(path);
@@ -2028,6 +2035,18 @@ void DotGfxHierarchyTable::writeGraph(FTextStream &out,
   for (dnli.toFirst();(n=dnli.current());++dnli)
   {
     QCString baseName;
+
+    if (vhdl)
+    {   
+      QCString l=n->m_url;
+      l=VhdlDocGen::convertFileNameToClassName(l);
+      ClassDef *cd=Doxygen::classSDict->find(l);
+      if (cd==0) continue;
+      // only entities are shown
+      if ((VhdlDocGen::VhdlClasses)cd->protection()!=VhdlDocGen::ENTITYCLASS)
+        continue;
+    }
+
     QCString imgExt = Config_getEnum("DOT_IMAGE_FORMAT");
     baseName.sprintf("inherit_graph_%d",count++);
     //baseName = convertNameToFile(baseName);
diff --git a/src/doxygen.cpp b/src/doxygen.cpp
index 809696a..1979e1b 100644
--- a/src/doxygen.cpp
+++ b/src/doxygen.cpp
@@ -5890,15 +5890,15 @@ static void findMember(EntryNav *rootNav,
           if (count==0 && !(isFriend && funcType=="class"))
           {
             int candidates=0;
-            ClassDef *ccd = 0, *ecd = 0;
-            MemberDef *cmd = 0, *emd = 0;
+            ClassDef *ecd = 0, *ucd = 0;
+            MemberDef *emd = 0, *umd = 0;
             if (mn->count()>0)
             {
               //printf("Assume template class\n");
               for (mni.toFirst();(md=mni.current());++mni)
               {
-                ccd=md->getClassDef();
-                cmd=md;
+                ClassDef *ccd=md->getClassDef();
+                MemberDef *cmd=md;
                 //printf("ccd->name()==%s className=%s\n",ccd->name().data(),className.data());
                 if (ccd!=0 && rightScopeMatch(ccd->name(),className)) 
                 {
@@ -5911,8 +5911,19 @@ static void findMember(EntryNav *rootNav,
                   }
                   if (md->argsString()==argListToString(root->argList,TRUE,FALSE))
                   { // exact argument list match -> remember
-                    ecd = ccd;
-                    emd = cmd;
+                    ucd = ecd = ccd;
+                    umd = emd = cmd;
+                    Debug::print(Debug::FindMembers,0,
+                     "7. new candidate className=%s scope=%s args=%s exact match\n",
+                         className.data(),ccd->name().data(),md->argsString());
+                  }
+                  else // arguments do not match, but member name and scope do -> remember
+                  {
+                    ucd = ccd;
+                    umd = cmd;
+                    Debug::print(Debug::FindMembers,0,
+                     "7. new candidate className=%s scope=%s args=%s no match\n",
+                         className.data(),ccd->name().data(),md->argsString());
                   }
                   candidates++;
                 }
@@ -5921,11 +5932,11 @@ static void findMember(EntryNav *rootNav,
             static bool strictProtoMatching = Config_getBool("STRICT_PROTO_MATCHING");
             if (!strictProtoMatching)
             {
-              if (candidates==1 && ccd && cmd)
+              if (candidates==1 && ucd && umd)
               {
                 // we didn't find an actual match on argument lists, but there is only 1 member with this
                 // name in the same scope, so that has to be the one. 
-                addMemberDocs(rootNav,cmd,funcDecl,0,overloaded,0);
+                addMemberDocs(rootNav,umd,funcDecl,0,overloaded,0);
                 return;
               }
               else if (candidates>1 && ecd && emd)
@@ -8587,120 +8598,6 @@ static QCString fixSlashes(QCString &s)
 
 
 //----------------------------------------------------------------------------
-// generate files for the search engine
-
-//static void generateSearchIndex()
-//{
-//  if (Config_getBool("SEARCHENGINE") && Config_getBool("GENERATE_HTML"))
-//  {
-//    // create search index
-//    QCString fileName;
-//    writeSearchButton(Config_getString("HTML_OUTPUT"));
-//
-//#if !defined(_WIN32)
-//    // create cgi script
-//    fileName = Config_getString("HTML_OUTPUT")+"/"+Config_getString("CGI_NAME");
-//    QFile f(fileName);
-//    if (f.open(IO_WriteOnly))
-//    {
-//      QTextStream t(&f);
-//      t << "#!/bin/sh"   << endl
-//        << "DOXYSEARCH=" << Config_getString("BIN_ABSPATH") << "/doxysearch" << endl
-//        << "DOXYPATH=\"" << Config_getString("DOC_ABSPATH") << " ";
-//
-//      QStrList &extDocPaths=Config_getList("EXT_DOC_PATHS");
-//      char *s= extDocPaths.first();
-//      while (s)
-//      {
-//        t << s << " ";
-//        s=extDocPaths.next();
-//      }
-//
-//      t << "\"" << endl 
-//        << "if [ -f $DOXYSEARCH ]" << endl
-//        << "then" << endl
-//        << "  $DOXYSEARCH $DOXYPATH" << endl 
-//        << "else" << endl
-//        << "  echo \"Content-Type: text/html\"" << endl
-//        << "  echo \"\"" << endl
-//        << "  echo \"<h2>error: $DOXYSEARCH not found. Check cgi script!</h2>\"" << endl
-//        << "fi" << endl;
-//
-//      f.close();
-//      struct stat stat_struct;
-//      stat(fileName,&stat_struct);
-//      chmod(fileName,stat_struct.st_mode|S_IXUSR|S_IXGRP|S_IXOTH);
-//    }
-//    else
-//    {
-//      err("error: Cannot open file %s for writing\n",fileName.data());
-//    }
-//#else /* Windows platform */
-//    // create cgi program
-//    fileName = Config_getString("CGI_NAME").copy();
-//    if (fileName.right(4)==".cgi") 
-//      fileName=fileName.left(fileName.length()-4);
-//    fileName+=".c";
-//    fileName.prepend(Config_getString("HTML_OUTPUT")+"/");
-//    QFile f(fileName);
-//    if (f.open(IO_WriteOnly))
-//    {
-//      QTextStream t(&f);
-//      t << "#include <stdio.h>" << endl;
-//      t << "#include <stdlib.h>" << endl;
-//      t << "#include <process.h>" << endl;
-//      t << endl;
-//      t << "const char *DOXYSEARCH = \"" << 
-//           fixSlashes(Config_getString("BIN_ABSPATH")) << "\\\\doxysearch.exe\";" << endl;
-//      t << "const char *DOXYPATH = \"" << 
-//           fixSlashes(Config_getString("DOC_ABSPATH")) << "\";" << endl;
-//      t << endl;
-//      t << "int main(void)" << endl;
-//      t << "{" << endl;
-//      t << "  char buf[1024];" << endl;
-//      t << "  sprintf(buf,\"%s %s\",DOXYSEARCH,DOXYPATH);" << endl; 
-//      t << "  if (system(buf))" << endl;
-//      t << "  {" << endl;
-//      t << "    printf(\"Content-Type: text/html\\n\\n\");" << endl;
-//      t << "    printf(\"<h2>error: failed to execute %s</h2>\\n\",DOXYSEARCH);" << endl;
-//      t << "    exit(1);" << endl;
-//      t << "  }" << endl;
-//      t << "  return 0;" << endl;
-//      t << "}" << endl;
-//      f.close();
-//    }
-//    else
-//    {
-//      err("error: Cannot open file %s for writing\n",fileName.data());
-//    }
-//#endif /* !defined(_WIN32) */
-//    
-//    // create config file
-//    fileName = Config_getString("HTML_OUTPUT")+"/search.cfg";
-//    f.setName(fileName);
-//    if (f.open(IO_WriteOnly))
-//    {
-//      QTextStream t(&f);
-//      t << Config_getString("DOC_URL") << "/" << endl 
-//        << Config_getString("CGI_URL") << "/" << Config_getString("CGI_NAME") << endl;
-//      f.close();
-//    }
-//    else
-//    {
-//      err("error: Cannot open file %s for writing\n",fileName.data());
-//    }
-//    //g_outputList->generateExternalIndex();
-//    g_outputList->pushGeneratorState();
-//    g_outputList->disableAllBut(OutputGenerator::Html);
-//    startFile(*g_outputList,"header"+Doxygen::htmlFileExtension,0,"Search Engine",TRUE);
-//    g_outputList->endPlainFile();
-//    g_outputList->startPlainFile("footer"+Doxygen::htmlFileExtension);
-//    endFile(*g_outputList,TRUE);
-//    g_outputList->popGeneratorState();
-//  }
-//}
-
-//----------------------------------------------------------------------------
 
 static bool openOutputFile(const char *outFile,QFile &f)
 {
@@ -10490,7 +10387,7 @@ void parseInput()
   computeTemplateClassRelations(); 
   flushUnresolvedRelations();
   computeClassRelations();        
-  VhdlDocGen::computeVhdlComponentRelations();
+  //VhdlDocGen::computeVhdlComponentRelations(); // @MARTIN: removed because it breaks non-vhdl code
   g_classEntries.clear();          
 
   msg("Add enum values to enums...\n");
diff --git a/src/doxygen.css b/src/doxygen.css
index 8a2ebf4..783bc27 100644
--- a/src/doxygen.css
+++ b/src/doxygen.css
@@ -2,7 +2,8 @@
 
 body, table, div, p, dl {
 	font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif;
-	font-size: 12px;
+	font-size: 13px;
+	line-height: 1.5;
 }
 
 /* @group Heading Levels */
@@ -126,7 +127,7 @@ a.code {
 }
 
 a.codeRef {
-	color: ##60;
+	color: #4665A2; 
 }
 
 /* @end */
diff --git a/src/doxygen_css.h b/src/doxygen_css.h
index a7b659e..7f5c8b8 100644
--- a/src/doxygen_css.h
+++ b/src/doxygen_css.h
@@ -2,7 +2,8 @@
 "\n"
 "body, table, div, p, dl {\n"
 "	font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif;\n"
-"	font-size: 12px;\n"
+"	font-size: 13px;\n"
+"	line-height: 1.5;\n"
 "}\n"
 "\n"
 "/* @group Heading Levels */\n"
@@ -126,7 +127,7 @@
 "}\n"
 "\n"
 "a.codeRef {\n"
-"	color: ##60;\n"
+"	color: #4665A2; \n"
 "}\n"
 "\n"
 "/* @end */\n"
diff --git a/src/entry.h b/src/entry.h
index 36d23c6..b9a91df 100644
--- a/src/entry.h
+++ b/src/entry.h
@@ -278,7 +278,8 @@ class Entry
       Protocol       = 0x0100,
       Category       = 0x0200,
       SealedClass    = 0x0400,
-      AbstractClass  = 0x0800
+      AbstractClass  = 0x0800,
+      Enum           = 0x1000  // for Java-style enums
     };
     enum GroupDocType
     {
diff --git a/src/filedef.cpp b/src/filedef.cpp
index dcc2c15..57c8451 100644
--- a/src/filedef.cpp
+++ b/src/filedef.cpp
@@ -697,12 +697,7 @@ void FileDef::writeDocumentation(OutputList &ol)
 
   ol.endContents();
 
-  if (generateTreeView)
-  {
-    writeNavigationPath(ol);
-  }
-
-  endFile(ol,TRUE);
+  endFileWithNavPath(this,ol);
 
   if (Config_getBool("SEPARATE_MEMBER_PAGES"))
   {
@@ -831,15 +826,7 @@ void FileDef::writeSource(OutputList &ol)
            );
   ol.endCodeFragment();
   ol.endContents();
-  if (generateTreeView)
-  {
-    writeNavigationPath(ol);
-    endFile(ol,TRUE);
-  }
-  else
-  {
-    endFile(ol);
-  }
+  endFileWithNavPath(this,ol);
   ol.enableAll();
 }
 
@@ -1628,7 +1615,8 @@ void FileDef::writeMemberDeclarations(OutputList &ol,MemberList::ListType lt,con
   {
     if (optVhdl) // use specific declarations function
     {
-      VhdlDocGen::writeVhdlDeclarations(ml,ol,0,0,this);
+
+      VhdlDocGen::writeVhdlDeclarations(ml,ol,0,0,this,0);
     }
     else
     {
diff --git a/src/fortrancode.l b/src/fortrancode.l
index aaacffb..a9bfd8b 100644
--- a/src/fortrancode.l
+++ b/src/fortrancode.l
@@ -654,7 +654,7 @@ ARGS      {BS}({ARGS_L0}|{ARGS_L1}|{ARGS_L2})
 NUM_TYPE  (complex|integer|logical|real)
 KIND      {ARGS}
 CHAR      (CHARACTER{ARGS}?|CHARACTER{BS}"*"({BS}[0-9]+|{ARGS}))
-TYPE_SPEC (({NUM_TYPE}({BS}"*"{BS}[0-9]+)?)|({NUM_TYPE}{KIND})|DOUBLE{BS_}PRECISION|{CHAR}|TYPE{ARGS})
+TYPE_SPEC (({NUM_TYPE}({BS}"*"{BS}[0-9]+)?)|({NUM_TYPE}{KIND})|DOUBLE{BS_}COMPLEX|DOUBLE{BS_}PRECISION|{CHAR}|TYPE{ARGS})
 
 INTENT_SPEC intent{BS}"("{BS}(in|out|in{BS}out){BS}")"
 ATTR_SPEC (ALLOCATABLE|DIMENSION{ARGS}|EXTERNAL|{INTENT_SPEC}|INTRINSIC|OPTIONAL|PARAMETER|POINTER|PRIVATE|PUBLIC|SAVE|TARGET|RECURSIVE|PURE|ELEMENTAL)
diff --git a/src/fortranscanner.l b/src/fortranscanner.l
index ba0d6db..16d17f8 100644
--- a/src/fortranscanner.l
+++ b/src/fortranscanner.l
@@ -178,6 +178,7 @@ static Protection        defaultProtection;
 static Protection        typeProtection;
 static int               typeMode = false;
 static InterfaceType     ifType = IF_NONE;
+static bool              functionLine = FALSE;
 
 static char              stringStartSymbol; // single or double quote
 
@@ -246,7 +247,7 @@ NOARGS    {BS}"\n"
 NUM_TYPE  (complex|integer|logical|real)
 KIND      {ARGS}
 CHAR      (CHARACTER{ARGS}?|CHARACTER{BS}"*"({BS}[0-9]+|{ARGS}))
-TYPE_SPEC (({NUM_TYPE}({BS}"*"{BS}[0-9]+)?)|({NUM_TYPE}{KIND})|DOUBLE{BS_}PRECISION|{CHAR}|TYPE{ARGS}|CLASS{ARGS}|PROCEDURE{ARGS}?)
+TYPE_SPEC (({NUM_TYPE}({BS}"*"{BS}[0-9]+)?)|({NUM_TYPE}{KIND})|DOUBLE{BS_}COMPLEX|DOUBLE{BS_}PRECISION|{CHAR}|TYPE{ARGS}|CLASS{ARGS}|PROCEDURE{ARGS}?)
 
 INTENT_SPEC intent{BS}"("{BS}(in|out|in{BS}out){BS}")"
 ATTR_SPEC (ALLOCATABLE|DIMENSION{ARGS}|EXTERNAL|{INTENT_SPEC}|INTRINSIC|OPTIONAL|PARAMETER|POINTER|PRIVATE|PUBLIC|SAVE|TARGET|NOPASS|PASS{ARGS}?|DEFERRED|NON_OVERRIDABLE)
@@ -303,6 +304,7 @@ PREFIX    (RECURSIVE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,2}(RECURSIVE|PURE|ELEMENTA
  /*-----------------------------------------------------------------------------------*/
 
 <*>^.*\n                                { // prepass: look for line continuations
+  					  functionLine = FALSE;
 
                                           //fprintf(stderr, "---%s", yytext);
 
@@ -982,10 +984,13 @@ private                                 {
 					   BEGIN(SubprogBody);				           
 }
 <SubprogBody>result{BS}\({BS}{ID}      {  
-                                           result= yytext;
-                                           result= result.right(result.length()-result.find("(")-1);
-                                           result= result.stripWhiteSpace();
- 					   modifiers[current_root->parent()][current_root->name.lower()].returnName = result;
+  					   if (functionLine)
+					   {
+                                             result= yytext;
+                                             result= result.right(result.length()-result.find("(")-1);
+                                             result= result.stripWhiteSpace();
+ 					     modifiers[current_root->parent()][current_root->name.lower()].returnName = result;
+					   }
                                            //cout << "=====> got result " <<  result << endl;
  				       } 
 
@@ -1907,6 +1912,7 @@ static void addSubprogram(const char *text)
   subrCurrent.prepend(current);
   current->section = Entry::FUNCTION_SEC ;
   QCString subtype = text; subtype=subtype.lower().stripWhiteSpace();
+  functionLine = subtype=="function";
   current->type += " " + subtype;
   current->type = current->type.stripWhiteSpace();
   current->fileName  = yyFileName;
diff --git a/src/groupdef.cpp b/src/groupdef.cpp
index 1c4567e..a12fc42 100644
--- a/src/groupdef.cpp
+++ b/src/groupdef.cpp
@@ -1422,7 +1422,7 @@ void GroupDef::writeMemberDeclarations(OutputList &ol,MemberList::ListType lt,co
   MemberList * ml = getMemberList(lt);
   if (optimizeVhdl && ml) 
   {
-    VhdlDocGen::writeVhdlDeclarations(ml,ol,this,0,0);
+    VhdlDocGen::writeVhdlDeclarations(ml,ol,this,0,0,0);
     return;
   }
   if (ml) 
diff --git a/src/header.html b/src/header.html
index 40574bd..76e9553 100644
--- a/src/header.html
+++ b/src/header.html
@@ -2,6 +2,7 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
 <!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
 <!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->
 <link href="$relpath$tabs.css" rel="stylesheet" type="text/css"/>
diff --git a/src/header_html.h b/src/header_html.h
index 424d1fb..4ed2e02 100644
--- a/src/header_html.h
+++ b/src/header_html.h
@@ -2,6 +2,7 @@
 "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"
 "<head>\n"
 "<meta http-equiv=\"Content-Type\" content=\"text/xhtml;charset=UTF-8\"/>\n"
+"<meta http-equiv=\"X-UA-Compatible\" content=\"IE=9\"/>\n"
 "<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->\n"
 "<!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->\n"
 "<link href=\"$relpath$tabs.css\" rel=\"stylesheet\" type=\"text/css\"/>\n"
diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp
index 0e3a158..c9318fa 100644
--- a/src/htmlgen.cpp
+++ b/src/htmlgen.cpp
@@ -33,7 +33,7 @@
 #include "htmlhelp.h"
 #include "docparser.h"
 #include "htmldocvisitor.h"
-#include "index.h"
+#include "searchindex.h"
 #include "pagedef.h"
 #include "debug.h"
 #include "dirdef.h"
@@ -992,7 +992,7 @@ static QCString substituteHtmlKeywords(const QCString &s,const char *title,
     {  
       path.prepend(relPath);   
     }  
-    mathJaxJs = "<script src=\"" + path + "MathJax.js\">\n"
+    mathJaxJs = "<script type=\"text/x-mathjax-config\">\n"
                 "  MathJax.Hub.Config({\n"
                 "    extensions: [\"tex2jax.js\"";
     QStrList &mathJaxExtensions = Config_getList("MATHJAX_EXTENSIONS");
@@ -1006,6 +1006,7 @@ static QCString substituteHtmlKeywords(const QCString &s,const char *title,
                  "    jax: [\"input/TeX\",\"output/HTML-CSS\"],\n"
                  "});\n"
                  "</script>";
+    mathJaxJs += "<script src=\"" + path + "MathJax.js\"></script>\n";
   }
 
   // first substitute generic keywords
diff --git a/src/index.cpp b/src/index.cpp
index fc400a1..3310357 100644
--- a/src/index.cpp
+++ b/src/index.cpp
@@ -47,10 +47,6 @@
 #define MAX_ITEMS_BEFORE_MULTIPAGE_INDEX 200
 #define MAX_ITEMS_BEFORE_QUICK_INDEX 30
 
-static const char search_script[]=
-#include "search_js.h"
-;
-
 
 int annotatedClasses;
 int annotatedClassesPrinted;
@@ -328,6 +324,16 @@ void endFile(OutputList &ol,bool skipNavIndex)
   ol.endFile();
 }
 
+void endFileWithNavPath(Definition *d,OutputList &ol)
+{
+  static bool generateTreeView = Config_getBool("GENERATE_TREEVIEW");
+  if (generateTreeView)
+  {
+    d->writeNavigationPath(ol);
+  }
+  endFile(ol,generateTreeView);
+}
+
 //----------------------------------------------------------------------
 template<class T> void addMembersToIndex(T *def,LayoutDocManager::LayoutPart part,const QCString &name,const QCString &anchor)
 {
@@ -549,8 +555,7 @@ static void writeClassTreeForList(OutputList &ol,ClassSDict *cl,bool &started,FT
     bool b;
     if (cd->getLanguage()==SrcLangExt_VHDL)
     {
-      if ((VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::PACKAGECLASS || 
-          (VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::PACKBODYCLASS)
+      if (!(VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::ENTITYCLASS)      
       {
         continue;
       }
@@ -996,7 +1001,15 @@ static void writeNamespaceIndex(OutputList &ol)
       }
       //ol.writeStartAnnoItem("namespace",nd->getOutputFileBase(),0,nd->name());
       ol.startIndexKey();
-      ol.writeObjectLink(0,nd->getOutputFileBase(),0,nd->displayName());
+      if (nd->getLanguage()==SrcLangExt_VHDL)
+      {
+        ClassDef* ccd=getClass(nd->displayName());
+        if (ccd) ol.writeObjectLink(0,ccd->getOutputFileBase(),0,nd->displayName());
+      }
+      else
+      {
+        ol.writeObjectLink(0,nd->getOutputFileBase(),0,nd->displayName());
+      }
       ol.endIndexKey();
       bool hasBrief = !nd->briefDescription().isEmpty();
       ol.startIndexValue(hasBrief);
@@ -1016,8 +1029,6 @@ static void writeNamespaceIndex(OutputList &ol)
         //ol.docify(")");
       }
       ol.endIndexValue(nd->getOutputFileBase(),hasBrief);
-      //ol.writeEndAnnoItem(nd->getOutputFileBase());
-      //Doxygen::indexList.addContentsItem(FALSE,nd->displayName(),nd->getReference(),nd->getOutputFileBase(),0);
       addMembersToIndex(nd,LayoutDocManager::Namespace,nd->displayName(),QCString());
     }
   }
@@ -1107,6 +1118,10 @@ static void writeAnnotatedClassList(OutputList &ol)
   
   for (cli.toFirst();(cd=cli.current());++cli)
   {
+     
+    if (cd->getLanguage()==SrcLangExt_VHDL &&(!(VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::ENTITYCLASS ))
+      continue;
+ 
     ol.pushGeneratorState();
     if (cd->isEmbeddedInOuterScope())
     {
@@ -1122,7 +1137,6 @@ static void writeAnnotatedClassList(OutputList &ol)
         QCString prot= VhdlDocGen::getProtectionName((VhdlDocGen::VhdlClasses)cd->protection());
         ol.docify(prot.data());
         ol.writeString(" ");
-        ol.insertMemberAlign();
       }
       ol.writeObjectLink(0,cd->getOutputFileBase(),cd->anchor(),cd->displayName());
       ol.endIndexKey();
@@ -1241,8 +1255,11 @@ static void writeAlphabeticalClassList(OutputList &ol)
   {
     if (cd->isLinkableInProject() && cd->templateMaster()==0)
     {
+      if (cd->getLanguage()==SrcLangExt_VHDL && !((VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::ENTITYCLASS ))// no architecture
+        continue;
+	     
       int index = getPrefixIndex(cd->className());
-      //printf("name=%s index=%d\n",cd->className().data(),index);
+      //printf("name=%s index=%d %d\n",cd->className().data(),index,cd->protection());
       startLetter=toupper(cd->className().at(index))&0xFF;
       indexLetterUsed[startLetter] = true;
     }
@@ -1287,12 +1304,21 @@ static void writeAlphabeticalClassList(OutputList &ol)
   startLetter=0;
   for (cli.toFirst();(cd=cli.current());++cli)
   {
+    if (cd->getLanguage()==SrcLangExt_VHDL && !((VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::ENTITYCLASS ))// no architecture
+      continue;
+    
     if (cd->isLinkableInProject() && cd->templateMaster()==0)
     {
       int index = getPrefixIndex(cd->className());
       startLetter=toupper(cd->className().at(index))&0xFF;
       // Do some sorting again, since the classes are sorted by name with 
       // prefix, which should be ignored really.
+      if (cd->getLanguage()==SrcLangExt_VHDL)
+      {
+        if ((VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::ENTITYCLASS )// no architecture
+          classesByLetter[startLetter].inSort(cd);
+      }
+      else
       classesByLetter[startLetter].inSort(cd);
     }
   }
@@ -1673,8 +1699,7 @@ void addClassMemberNameToIndex(MemberDef *md)
   static bool hideFriendCompounds = Config_getBool("HIDE_FRIEND_COMPOUNDS");
   ClassDef *cd=0;
 
-  if (md->getLanguage()==SrcLangExt_VHDL && 
-      (VhdlDocGen::isRecord(md) || VhdlDocGen::isUnit(md)))
+  if (md->getLanguage()==SrcLangExt_VHDL)
   {
     VhdlDocGen::adjustRecordMember(md);
   }
@@ -2412,657 +2437,6 @@ static void writeNamespaceMemberIndex(OutputList &ol)
 
 //----------------------------------------------------------------------------
 
-#define NUM_SEARCH_INDICES      13
-#define SEARCH_INDEX_ALL         0
-#define SEARCH_INDEX_CLASSES     1
-#define SEARCH_INDEX_NAMESPACES  2
-#define SEARCH_INDEX_FILES       3
-#define SEARCH_INDEX_FUNCTIONS   4
-#define SEARCH_INDEX_VARIABLES   5
-#define SEARCH_INDEX_TYPEDEFS    6
-#define SEARCH_INDEX_ENUMS       7
-#define SEARCH_INDEX_ENUMVALUES  8
-#define SEARCH_INDEX_PROPERTIES  9
-#define SEARCH_INDEX_EVENTS     10
-#define SEARCH_INDEX_RELATED    11
-#define SEARCH_INDEX_DEFINES    12
-
-class SearchIndexList : public SDict< QList<Definition> >
-{
-  public:
-    SearchIndexList(int size=17) : SDict< QList<Definition> >(size,FALSE) 
-    {
-      setAutoDelete(TRUE);
-    }
-   ~SearchIndexList() {}
-    void append(Definition *d)
-    {
-      QList<Definition> *l = find(d->name());
-      if (l==0)
-      {
-        l=new QList<Definition>;
-        SDict< QList<Definition> >::append(d->name(),l);
-      }
-      l->append(d);
-    }
-    int compareItems(GCI item1, GCI item2)
-    {
-      QList<Definition> *md1=(QList<Definition> *)item1;
-      QList<Definition> *md2=(QList<Definition> *)item2;
-      QCString n1 = md1->first()->localName();
-      QCString n2 = md2->first()->localName();
-      return stricmp(n1.data(),n2.data());
-    }
-};
-
-static void addMemberToSearchIndex(
-         SearchIndexList symbols[NUM_SEARCH_INDICES][MEMBER_INDEX_ENTRIES],
-         int symbolCount[NUM_SEARCH_INDICES],
-         MemberDef *md)
-{
-  static bool hideFriendCompounds = Config_getBool("HIDE_FRIEND_COMPOUNDS");
-  bool isLinkable = md->isLinkable();
-  ClassDef *cd=0;
-  NamespaceDef *nd=0;
-  FileDef *fd=0;
-  if (isLinkable             && 
-      (cd=md->getClassDef()) && 
-      cd->isLinkable()       &&
-      cd->templateMaster()==0)
-  {
-    QCString n = md->name();
-    uchar charCode = (uchar)n.at(0);
-    uint letter = charCode<128 ? tolower(charCode) : charCode;
-    if (!n.isEmpty()) 
-    {
-      bool isFriendToHide = hideFriendCompounds &&
-        (QCString(md->typeString())=="friend class" || 
-         QCString(md->typeString())=="friend struct" ||
-         QCString(md->typeString())=="friend union");
-      if (!(md->isFriend() && isFriendToHide))
-      {
-        symbols[SEARCH_INDEX_ALL][letter].append(md);
-        symbolCount[SEARCH_INDEX_ALL]++;
-      }
-      if (md->isFunction() || md->isSlot() || md->isSignal())
-      {
-        symbols[SEARCH_INDEX_FUNCTIONS][letter].append(md);
-        symbolCount[SEARCH_INDEX_FUNCTIONS]++;
-      } 
-      else if (md->isVariable())
-      {
-        symbols[SEARCH_INDEX_VARIABLES][letter].append(md);
-        symbolCount[SEARCH_INDEX_VARIABLES]++;
-      }
-      else if (md->isTypedef())
-      {
-        symbols[SEARCH_INDEX_TYPEDEFS][letter].append(md);
-        symbolCount[SEARCH_INDEX_TYPEDEFS]++;
-      }
-      else if (md->isEnumerate())
-      {
-        symbols[SEARCH_INDEX_ENUMS][letter].append(md);
-        symbolCount[SEARCH_INDEX_ENUMS]++;
-      }
-      else if (md->isEnumValue())
-      {
-        symbols[SEARCH_INDEX_ENUMVALUES][letter].append(md);
-        symbolCount[SEARCH_INDEX_ENUMVALUES]++;
-      }
-      else if (md->isProperty())
-      {
-        symbols[SEARCH_INDEX_PROPERTIES][letter].append(md);
-        symbolCount[SEARCH_INDEX_PROPERTIES]++;
-      }
-      else if (md->isEvent())
-      {
-        symbols[SEARCH_INDEX_EVENTS][letter].append(md);
-        symbolCount[SEARCH_INDEX_EVENTS]++;
-      }
-      else if (md->isRelated() || md->isForeign() ||
-               (md->isFriend() && !isFriendToHide))
-      {
-        symbols[SEARCH_INDEX_RELATED][letter].append(md);
-        symbolCount[SEARCH_INDEX_RELATED]++;
-      }
-    }
-  }
-  else if (isLinkable && 
-      (((nd=md->getNamespaceDef()) && nd->isLinkable()) || 
-       ((fd=md->getFileDef())      && fd->isLinkable())
-      )
-     )
-  {
-    QCString n = md->name();
-    uchar charCode = (uchar)n.at(0);
-    uint letter = charCode<128 ? tolower(charCode) : charCode;
-    if (!n.isEmpty()) 
-    {
-      symbols[SEARCH_INDEX_ALL][letter].append(md);
-      symbolCount[SEARCH_INDEX_ALL]++;
-
-      if (md->isFunction()) 
-      {
-        symbols[SEARCH_INDEX_FUNCTIONS][letter].append(md);
-        symbolCount[SEARCH_INDEX_FUNCTIONS]++;
-      }
-      else if (md->isVariable()) 
-      {
-        symbols[SEARCH_INDEX_VARIABLES][letter].append(md);
-        symbolCount[SEARCH_INDEX_VARIABLES]++;
-      }
-      else if (md->isTypedef())
-      {
-        symbols[SEARCH_INDEX_TYPEDEFS][letter].append(md);
-        symbolCount[SEARCH_INDEX_TYPEDEFS]++;
-      }
-      else if (md->isEnumerate())
-      {
-        symbols[SEARCH_INDEX_ENUMS][letter].append(md);
-        symbolCount[SEARCH_INDEX_ENUMS]++;
-      }
-      else if (md->isEnumValue())
-      {
-        symbols[SEARCH_INDEX_ENUMVALUES][letter].append(md);
-        symbolCount[SEARCH_INDEX_ENUMVALUES]++;
-      }
-      else if (md->isDefine())
-      {
-        symbols[SEARCH_INDEX_DEFINES][letter].append(md);
-        symbolCount[SEARCH_INDEX_DEFINES]++;
-      }
-    }
-  }
-}
-
-static QCString searchId(const QCString &s)
-{
-  int c;
-  uint i;
-  QCString result;
-  for (i=0;i<s.length();i++)
-  {
-    c=s.at(i);
-    if ((c>='0' && c<='9') || (c>='A' && c<='Z') || (c>='a' && c<='z'))
-    {
-      result+=(char)tolower(c);
-    }
-    else
-    {
-      char val[4];
-      sprintf(val,"_%02x",(uchar)c);
-      result+=val;
-    }
-  }
-  return result;
-}
-
-static  int g_searchIndexCount[NUM_SEARCH_INDICES];
-static  SearchIndexList g_searchIndexSymbols[NUM_SEARCH_INDICES][MEMBER_INDEX_ENTRIES];
-static const char *g_searchIndexName[NUM_SEARCH_INDICES] = 
-{ 
-    "all",
-    "classes",
-    "namespaces",
-    "files",
-    "functions",
-    "variables",
-    "typedefs", 
-    "enums", 
-    "enumvalues",
-    "properties", 
-    "events", 
-    "related",
-    "defines"
-};
-
-
-class SearchIndexCategoryMapping
-{
-  public:
-    SearchIndexCategoryMapping()
-    {
-      categoryLabel[SEARCH_INDEX_ALL]        = theTranslator->trAll();
-      categoryLabel[SEARCH_INDEX_CLASSES]    = theTranslator->trClasses();
-      categoryLabel[SEARCH_INDEX_NAMESPACES] = theTranslator->trNamespace(TRUE,FALSE);
-      categoryLabel[SEARCH_INDEX_FILES]      = theTranslator->trFile(TRUE,FALSE);
-      categoryLabel[SEARCH_INDEX_FUNCTIONS]  = theTranslator->trFunctions();
-      categoryLabel[SEARCH_INDEX_VARIABLES]  = theTranslator->trVariables();
-      categoryLabel[SEARCH_INDEX_TYPEDEFS]   = theTranslator->trTypedefs();
-      categoryLabel[SEARCH_INDEX_ENUMS]      = theTranslator->trEnumerations();
-      categoryLabel[SEARCH_INDEX_ENUMVALUES] = theTranslator->trEnumerationValues();
-      categoryLabel[SEARCH_INDEX_PROPERTIES] = theTranslator->trProperties();
-      categoryLabel[SEARCH_INDEX_EVENTS]     = theTranslator->trEvents();
-      categoryLabel[SEARCH_INDEX_RELATED]    = theTranslator->trFriends();
-      categoryLabel[SEARCH_INDEX_DEFINES]    = theTranslator->trDefines();
-    }
-    QCString categoryLabel[NUM_SEARCH_INDICES];
-};
-
-void writeJavascriptSearchIndex()
-{
-  if (!Config_getBool("GENERATE_HTML")) return;
-  //static bool treeView = Config_getBool("GENERATE_TREEVIEW");
-
-  ClassSDict::Iterator cli(*Doxygen::classSDict);
-  ClassDef *cd;
-  for (;(cd=cli.current());++cli)
-  {
-    uchar charCode = (uchar)cd->localName().at(0);
-    uint letter = charCode<128 ? tolower(charCode) : charCode;
-    if (cd->isLinkable() && isId(letter))
-    {
-      g_searchIndexSymbols[SEARCH_INDEX_ALL][letter].append(cd);
-      g_searchIndexSymbols[SEARCH_INDEX_CLASSES][letter].append(cd);
-      g_searchIndexCount[SEARCH_INDEX_ALL]++;
-      g_searchIndexCount[SEARCH_INDEX_CLASSES]++;
-    }
-  }
-  NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict);
-  NamespaceDef *nd;
-  for (;(nd=nli.current());++nli)
-  {
-    uchar charCode = (uchar)nd->name().at(0);
-    uint letter = charCode<128 ? tolower(charCode) : charCode;
-    if (nd->isLinkable() && isId(letter))
-    {
-      g_searchIndexSymbols[SEARCH_INDEX_ALL][letter].append(nd);
-      g_searchIndexSymbols[SEARCH_INDEX_NAMESPACES][letter].append(nd);
-      g_searchIndexCount[SEARCH_INDEX_ALL]++;
-      g_searchIndexCount[SEARCH_INDEX_NAMESPACES]++;
-    }
-  }
-  FileNameListIterator fnli(*Doxygen::inputNameList);
-  FileName *fn;
-  for (;(fn=fnli.current());++fnli)
-  {
-    FileNameIterator fni(*fn);
-    FileDef *fd;
-    for (;(fd=fni.current());++fni)
-    {
-      uchar charCode = (uchar)fd->name().at(0);
-      uint letter = charCode<128 ? tolower(charCode) : charCode;
-      if (fd->isLinkable() && isId(letter))
-      {
-        g_searchIndexSymbols[SEARCH_INDEX_ALL][letter].append(fd);
-        g_searchIndexSymbols[SEARCH_INDEX_FILES][letter].append(fd);
-        g_searchIndexCount[SEARCH_INDEX_ALL]++;
-        g_searchIndexCount[SEARCH_INDEX_FILES]++;
-      }
-    }
-  }
-  {
-    MemberNameSDict::Iterator mnli(*Doxygen::memberNameSDict);
-    MemberName *mn;
-    // for each member name
-    for (mnli.toFirst();(mn=mnli.current());++mnli)
-    {
-      MemberDef *md;
-      MemberNameIterator mni(*mn);
-      // for each member definition
-      for (mni.toFirst();(md=mni.current());++mni)
-      {
-        addMemberToSearchIndex(g_searchIndexSymbols,g_searchIndexCount,md);
-      }
-    }
-  }
-  {
-    MemberNameSDict::Iterator fnli(*Doxygen::functionNameSDict);
-    MemberName *mn;
-    // for each member name
-    for (fnli.toFirst();(mn=fnli.current());++fnli)
-    {
-      MemberDef *md;
-      MemberNameIterator mni(*mn);
-      // for each member definition
-      for (mni.toFirst();(md=mni.current());++mni)
-      {
-        addMemberToSearchIndex(g_searchIndexSymbols,g_searchIndexCount,md);
-      }
-    }
-  }
-  
-  int i,p;
-  for (i=0;i<NUM_SEARCH_INDICES;i++)
-  {
-    for (p=0;p<MEMBER_INDEX_ENTRIES;p++)
-    {
-      if (g_searchIndexSymbols[i][p].count()>0)
-      {
-        g_searchIndexSymbols[i][p].sort();
-      }
-    }
-  }
-
-  QCString searchDirName = Config_getString("HTML_OUTPUT")+"/search";
-
-  for (i=0;i<NUM_SEARCH_INDICES;i++)
-  {
-    for (p=0;p<MEMBER_INDEX_ENTRIES;p++)
-    {
-      if (g_searchIndexSymbols[i][p].count()>0)
-      {
-        QCString fileName;
-        fileName.sprintf("/%s_%02x.html",g_searchIndexName[i],p);
-        fileName.prepend(searchDirName);
-        QFile outFile(fileName);
-        if (outFile.open(IO_WriteOnly))
-        {
-          FTextStream t(&outFile);
-          t << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\""
-               " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" << endl;
-          t << "<html><head><title></title>" << endl;
-          t << "<meta http-equiv=\"Content-Type\" content=\"text/xhtml;charset=UTF-8\"/>" << endl;
-          t << "<link rel=\"stylesheet\" type=\"text/css\" href=\"search.css\"/>" << endl;
-          t << "<script type=\"text/javascript\" src=\"search.js\"></script>" << endl;
-          t << "</head>" << endl;
-          t << "<body class=\"SRPage\">" << endl;
-          t << "<div id=\"SRIndex\">" << endl;
-          t << "<div class=\"SRStatus\" id=\"Loading\">" << theTranslator->trLoading() << "</div>" << endl;
-
-          SDict<QList<Definition> >::Iterator li(g_searchIndexSymbols[i][p]);
-          QList<Definition> *dl;
-          int itemCount=0;
-          for (li.toFirst();(dl=li.current());++li)
-          {
-            Definition *d = dl->first();
-            QCString id = d->localName();
-            t << "<div class=\"SRResult\" id=\"SR_"
-              << searchId(d->localName()) << "\">" << endl;
-            t << " <div class=\"SREntry\">\n";
-            if (dl->count()==1) // item with a unique name
-            {
-              MemberDef  *md   = 0;
-              bool isMemberDef = d->definitionType()==Definition::TypeMember;
-              if (isMemberDef) md = (MemberDef*)d;
-              t << "  <a id=\"Item" << itemCount << "\" "
-                << "onkeydown=\""
-                << "return searchResults.Nav(event," << itemCount << ")\" "
-                << "onkeypress=\""
-                << "return searchResults.Nav(event," << itemCount << ")\" "
-                << "onkeyup=\""
-                << "return searchResults.Nav(event," << itemCount << ")\" "
-                << "class=\"SRSymbol\" ";
-              t << externalLinkTarget() << "href=\"" << externalRef("../",d->getReference(),TRUE);
-              t << d->getOutputFileBase() << Doxygen::htmlFileExtension;
-              QCString anchor = d->anchor();
-              if (!anchor.isEmpty())
-              {
-                t << "#" << anchor;
-              }
-              t << "\"";
-              static bool extLinksInWindow = Config_getBool("EXT_LINKS_IN_WINDOW");
-              if (!extLinksInWindow || d->getReference().isEmpty())
-              {
-                t << " target=\"_parent\"";
-              }
-              t << ">";
-              t << convertToXML(d->localName());
-              t << "</a>" << endl;
-              if (d->getOuterScope()!=Doxygen::globalScope)
-              {
-                t << "  <span class=\"SRScope\">" 
-                  << convertToXML(d->getOuterScope()->name()) 
-                  << "</span>" << endl;
-              }
-              else if (md)
-              {
-                FileDef *fd = md->getBodyDef();
-                if (fd==0) fd = md->getFileDef();
-                if (fd)
-                {
-                  t << "  <span class=\"SRScope\">" 
-                    << convertToXML(fd->localName())
-                    << "</span>" << endl;
-                }
-              }
-            }
-            else // multiple items with the same name
-            {
-              t << "  <a id=\"Item" << itemCount << "\" "
-                << "onkeydown=\""
-                << "return searchResults.Nav(event," << itemCount << ")\" "
-                << "onkeypress=\""
-                << "return searchResults.Nav(event," << itemCount << ")\" "
-                << "onkeyup=\""
-                << "return searchResults.Nav(event," << itemCount << ")\" "
-                << "class=\"SRSymbol\" "
-                << "href=\"javascript:searchResults.Toggle('SR_"
-                << searchId(d->localName()) << "')\">" 
-                << convertToXML(d->localName()) << "</a>" << endl;
-              t << "  <div class=\"SRChildren\">" << endl;
-
-              QListIterator<Definition> di(*dl);
-              bool overloadedFunction = FALSE;
-              Definition *prevScope = 0;
-              int childCount=0;
-              for (di.toFirst();(d=di.current());)
-              {
-                ++di;
-                Definition *scope     = d->getOuterScope();
-                Definition *next      = di.current();
-                Definition *nextScope = 0;
-                MemberDef  *md        = 0;
-                bool isMemberDef = d->definitionType()==Definition::TypeMember;
-                if (isMemberDef) md = (MemberDef*)d;
-                if (next) nextScope = next->getOuterScope();
-
-                t << "    <a id=\"Item" << itemCount << "_c" 
-                  << childCount << "\" "
-                  << "onkeydown=\""
-                  << "return searchResults.NavChild(event," 
-                  << itemCount << "," << childCount << ")\" "
-                  << "onkeypress=\""
-                  << "return searchResults.NavChild(event," 
-                  << itemCount << "," << childCount << ")\" "
-                  << "onkeyup=\""
-                  << "return searchResults.NavChild(event," 
-                  << itemCount << "," << childCount << ")\" "
-                  << "class=\"SRScope\" ";
-                if (!d->getReference().isEmpty())
-                {
-                  t << externalLinkTarget() << externalRef("../",d->getReference(),FALSE);
-                }
-                t << "href=\"" << externalRef("../",d->getReference(),TRUE);
-                t << d->getOutputFileBase() << Doxygen::htmlFileExtension;
-                QCString anchor = d->anchor();
-                if (!anchor.isEmpty())
-                {
-                  t << "#" << anchor;
-                }
-                t << "\"";
-                static bool extLinksInWindow = Config_getBool("EXT_LINKS_IN_WINDOW");
-                if (!extLinksInWindow || d->getReference().isEmpty())
-                {
-                  t << " target=\"_parent\"";
-                }
-                t << ">";
-                bool found=FALSE;
-                overloadedFunction = ((prevScope!=0 && scope==prevScope) ||
-                                      (scope && scope==nextScope)
-                                     ) && md && 
-                                     (md->isFunction() || md->isSlot());
-                QCString prefix;
-                if (md) prefix=convertToXML(md->localName());
-                if (overloadedFunction) // overloaded member function
-                {
-                  prefix+=convertToXML(md->argsString()); 
-                          // show argument list to disambiguate overloaded functions
-                }
-                else if (md) // unique member function
-                {
-                  prefix+="()"; // only to show it is a function
-                }
-                if (d->definitionType()==Definition::TypeClass)
-                {
-                  t << convertToXML(((ClassDef*)d)->displayName());
-                  found = TRUE;
-                }
-                else if (d->definitionType()==Definition::TypeNamespace)
-                {
-                  t << convertToXML(((NamespaceDef*)d)->displayName());
-                  found = TRUE;
-                }
-                else if (scope==0 || scope==Doxygen::globalScope) // in global scope
-                {
-                  if (md)
-                  {
-                    FileDef *fd = md->getBodyDef();
-                    if (fd==0) fd = md->getFileDef();
-                    if (fd)
-                    {
-                      if (!prefix.isEmpty()) prefix+=":&#160;";
-                      t << prefix << convertToXML(fd->localName());
-                      found = TRUE;
-                    }
-                  }
-                }
-                else if (md && (md->getClassDef() || md->getNamespaceDef())) 
-                  // member in class or namespace scope
-                {
-                  SrcLangExt lang = md->getLanguage();
-                  t << convertToXML(d->getOuterScope()->qualifiedName()) 
-                    << getLanguageSpecificSeparator(lang) << prefix;
-                  found = TRUE;
-                }
-                else if (scope) // some thing else? -> show scope
-                {
-                  t << prefix << convertToXML(scope->name());
-                  found = TRUE;
-                }
-                if (!found) // fallback
-                {
-                  t << prefix << "("+theTranslator->trGlobalNamespace()+")";
-                }
-                t << "</a>" << endl;
-                prevScope = scope;
-                childCount++;
-              }
-              t << "  </div>" << endl; // SRChildren
-            }
-            t << " </div>" << endl; // SREntry
-            t << "</div>" << endl; // SRResult
-            itemCount++;
-          }
-          t << "<div class=\"SRStatus\" id=\"Searching\">" 
-            << theTranslator->trSearching() << "</div>" << endl;
-          t << "<div class=\"SRStatus\" id=\"NoMatches\">"
-            << theTranslator->trNoMatches() << "</div>" << endl;
-
-          t << "<script type=\"text/javascript\"><!--" << endl;
-          t << "document.getElementById(\"Loading\").style.display=\"none\";" << endl;
-          t << "document.getElementById(\"NoMatches\").style.display=\"none\";" << endl;
-          t << "var searchResults = new SearchResults(\"searchResults\");" << endl;
-          t << "searchResults.Search();" << endl;
-          t << "--></script>" << endl;
-
-          t << "</div>" << endl; // SRIndex
-
-          t << "</body>" << endl;
-          t << "</html>" << endl;
-
-        }
-        else
-        {
-          err("Failed to open file '%s' for writing...\n",fileName.data());
-        }
-      }
-    }
-  }
-  //ol.popGeneratorState();
-
-  {
-    QFile f(searchDirName+"/search.js");
-    if (f.open(IO_WriteOnly))
-    {
-      FTextStream t(&f);
-      t << "// Search script generated by doxygen" << endl;
-      t << "// Copyright (C) 2009 by Dimitri van Heesch." << endl << endl;
-      t << "// The code in this file is loosly based on main.js, part of Natural Docs," << endl;
-      t << "// which is Copyright (C) 2003-2008 Greg Valure" << endl;
-      t << "// Natural Docs is licensed under the GPL." << endl << endl;
-      t << "var indexSectionsWithContent =" << endl;
-      t << "{" << endl;
-      bool first=TRUE;
-      int j=0;
-      for (i=0;i<NUM_SEARCH_INDICES;i++)
-      {
-        if (g_searchIndexCount[i]>0)
-        {
-          if (!first) t << "," << endl;
-          t << "  " << j << ": \"";
-          for (p=0;p<MEMBER_INDEX_ENTRIES;p++)
-          {
-            t << (g_searchIndexSymbols[i][p].count()>0 ? "1" : "0");
-          }
-          t << "\"";
-          first=FALSE;
-          j++;
-        }
-      }
-      if (!first) t << "\n";
-      t << "};" << endl << endl;
-      t << "var indexSectionNames =" << endl;
-      t << "{" << endl;
-      first=TRUE;
-      j=0;
-      for (i=0;i<NUM_SEARCH_INDICES;i++)
-      {
-        if (g_searchIndexCount[i]>0)
-        {
-          if (!first) t << "," << endl;
-          t << "  " << j << ": \"" << g_searchIndexName[i] << "\"";
-          first=FALSE;
-          j++;
-        }
-      }
-      if (!first) t << "\n";
-      t << "};" << endl << endl;
-      t << search_script;
-    }
-  }
-  {
-    QFile f(searchDirName+"/nomatches.html");
-    if (f.open(IO_WriteOnly))
-    {
-      FTextStream t(&f);
-      t << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" "
-           "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" << endl;
-      t << "<html><head><title></title>" << endl;
-      t << "<meta http-equiv=\"Content-Type\" content=\"text/xhtml;charset=UTF-8\"/>" << endl;
-      t << "<link rel=\"stylesheet\" type=\"text/css\" href=\"search.css\"/>" << endl;
-      t << "<script type=\"text/javascript\" src=\"search.js\"></script>" << endl;
-      t << "</head>" << endl;
-      t << "<body class=\"SRPage\">" << endl;
-      t << "<div id=\"SRIndex\">" << endl;
-      t << "<div class=\"SRStatus\" id=\"NoMatches\">"
-        << theTranslator->trNoMatches() << "</div>" << endl;
-      t << "</div>" << endl;
-      t << "</body>" << endl;
-      t << "</html>" << endl;
-    }
-  }
-  Doxygen::indexList.addStyleSheetFile("search/search.js");
-}
-
-void writeSearchCategories(FTextStream &t)
-{
-  static SearchIndexCategoryMapping map;
-  int i,j=0;
-  for (i=0;i<NUM_SEARCH_INDICES;i++)
-  {
-    if (g_searchIndexCount[i]>0)
-    {
-      t << "<a class=\"SelectItem\" href=\"javascript:void(0)\" "
-        << "onclick=\"searchBox.OnSelectItem(" << j << ")\">"
-        << "<span class=\"SelectionMark\">&#160;</span>"
-        << convertToXML(map.categoryLabel[i])
-        << "</a>";
-      j++;
-    }
-  }
-}
-
 //----------------------------------------------------------------------------
 
 static void writeExampleIndex(OutputList &ol)
diff --git a/src/index.h b/src/index.h
index b307dca..b49bb1b 100644
--- a/src/index.h
+++ b/src/index.h
@@ -258,6 +258,7 @@ void startFile(OutputList &ol,const char *name,const char *manName,
                const char *title,HighlightedItem hli=HLI_None,
                bool additionalIndices=FALSE,const char *altSidebarName=0);
 void endFile(OutputList &ol,bool skipNavIndex=FALSE);
+void endFileWithNavPath(Definition *d,OutputList &ol);
 
 void initClassMemberIndices();
 void initFileMemberIndices();
@@ -266,8 +267,4 @@ void addClassMemberNameToIndex(MemberDef *md);
 void addFileMemberNameToIndex(MemberDef *md);
 void addNamespaceMemberNameToIndex(MemberDef *md);
 
-// search engine
-void writeJavascriptSearchIndex();
-void writeSearchCategories(FTextStream &t);
-
 #endif
diff --git a/src/layout.cpp b/src/layout.cpp
index e108046..79b4533 100644
--- a/src/layout.cpp
+++ b/src/layout.cpp
@@ -255,7 +255,7 @@ class LayoutParser : public QXmlDefaultHandler
           new StartElementHandlerKind(this,LayoutDocEntry::MemberGroups,&LayoutParser::startSimpleEntry));
       m_sHandler.insert("class/memberdecl/nestedclasses", 
           new StartElementHandlerSection(this,LayoutDocEntry::ClassNestedClasses,&LayoutParser::startSectionEntry,
-                                         vhdlOpt ? VhdlDocGen::trVhdlType(VhdlDocGen::ARCHITECTURE,FALSE) :
+                                         vhdlOpt ? VhdlDocGen::trVhdlType(VhdlDocGen::ENTITY,FALSE) :
                                          fortranOpt ? theTranslator->trDataTypes() :
                                          theTranslator->trCompounds() 
                                          ));
@@ -400,13 +400,13 @@ class LayoutParser : public QXmlDefaultHandler
           new StartElementHandler(this,&LayoutParser::startMemberDecl));
       m_sHandler.insert("namespace/memberdecl/nestednamespaces", 
           new StartElementHandlerSection(this,LayoutDocEntry::NamespaceNestedNamespaces,&LayoutParser::startSectionEntry,
-                                         javaOpt ? theTranslator->trPackages() :
+                                         javaOpt || vhdlOpt ? theTranslator->trPackages() :
                                          fortranOpt ? theTranslator->trModules() :
                                          theTranslator->trNamespaces()
                                          ));
       m_sHandler.insert("namespace/memberdecl/classes", 
           new StartElementHandlerSection(this,LayoutDocEntry::NamespaceClasses,&LayoutParser::startSectionEntry,
-                                         vhdlOpt ? VhdlDocGen::trVhdlType(VhdlDocGen::ARCHITECTURE,FALSE) :
+                                         vhdlOpt ? VhdlDocGen::trVhdlType(VhdlDocGen::ENTITY,FALSE) :
                                          fortranOpt ? theTranslator->trDataTypes() :
                                          theTranslator->trCompounds() 
                                          ));
@@ -480,7 +480,7 @@ class LayoutParser : public QXmlDefaultHandler
           new StartElementHandler(this,&LayoutParser::startMemberDecl));
       m_sHandler.insert("file/memberdecl/classes", 
           new StartElementHandlerSection(this,LayoutDocEntry::FileClasses,&LayoutParser::startSectionEntry,
-                                         vhdlOpt ? VhdlDocGen::trVhdlType(VhdlDocGen::ARCHITECTURE,FALSE) :
+                                         vhdlOpt ? VhdlDocGen::trVhdlType(VhdlDocGen::ENTITY,FALSE) :
                                          fortranOpt ? theTranslator->trDataTypes() :
                                          theTranslator->trCompounds() 
                                          ));
@@ -558,7 +558,7 @@ class LayoutParser : public QXmlDefaultHandler
           new StartElementHandler(this,&LayoutParser::startMemberDecl));
       m_sHandler.insert("group/memberdecl/classes", 
           new StartElementHandlerSection(this,LayoutDocEntry::GroupClasses,&LayoutParser::startSectionEntry,
-                                         vhdlOpt ? VhdlDocGen::trVhdlType(VhdlDocGen::ARCHITECTURE,FALSE) :
+                                         vhdlOpt ? VhdlDocGen::trVhdlType(VhdlDocGen::ENTITY,FALSE) :
                                          fortranOpt ? theTranslator->trDataTypes() :
                                          theTranslator->trCompounds() 
                                          ));
@@ -827,21 +827,21 @@ class LayoutParser : public QXmlDefaultHandler
         },
         { "namespaces",
           LayoutNavEntry::Namespaces,
-          javaOpt    ? theTranslator->trPackages() : fortranOpt ? theTranslator->trModules() : theTranslator->trNamespaces(),
-          javaOpt    ? theTranslator->trPackages() : fortranOpt ? theTranslator->trModulesList() : theTranslator->trNamespaceList(),
-          javaOpt    ? theTranslator->trPackageListDescription() : fortranOpt ? theTranslator->trModulesListDescription(extractAll) : theTranslator->trNamespaceListDescription(extractAll),
+          javaOpt || vhdlOpt   ? theTranslator->trPackages() : fortranOpt ? theTranslator->trModules() : theTranslator->trNamespaces(),
+          javaOpt || vhdlOpt   ? theTranslator->trPackages() : fortranOpt ? theTranslator->trModulesList() : theTranslator->trNamespaceList(),
+          javaOpt || vhdlOpt   ? theTranslator->trPackageListDescription() : fortranOpt ? theTranslator->trModulesListDescription(extractAll) : theTranslator->trNamespaceListDescription(extractAll),
           "namespaces"
         },
         { "namespacelist",
           LayoutNavEntry::NamespaceList,
-          javaOpt    ? theTranslator->trPackages() : fortranOpt ? theTranslator->trModulesList() : theTranslator->trNamespaceList(),
+          javaOpt || vhdlOpt   ? theTranslator->trPackages() : fortranOpt ? theTranslator->trModulesList() : theTranslator->trNamespaceList(),
           QCString(),
-          javaOpt    ? theTranslator->trPackageListDescription() : fortranOpt ? theTranslator->trModulesListDescription(extractAll) : theTranslator->trNamespaceListDescription(extractAll),
+          javaOpt || vhdlOpt   ? theTranslator->trPackageListDescription() : fortranOpt ? theTranslator->trModulesListDescription(extractAll) : theTranslator->trNamespaceListDescription(extractAll),
           "namespaces"
         },
         { "namespacemembers",
           LayoutNavEntry::NamespaceMembers,
-          javaOpt    ? theTranslator->trPackageMembers() : fortranOpt ? theTranslator->trModulesMembers() : theTranslator->trNamespaceMembers(),
+          javaOpt || vhdlOpt   ? theTranslator->trPackageMembers() : fortranOpt ? theTranslator->trModulesMembers() : theTranslator->trNamespaceMembers(),
           QCString(),
           fortranOpt ? theTranslator->trModulesMemberDescription(extractAll) : theTranslator->trNamespaceMemberDescription(extractAll),
           "namespacemembers"
@@ -862,7 +862,7 @@ class LayoutParser : public QXmlDefaultHandler
         },
         { "classlist",
           LayoutNavEntry::ClassList,
-          theTranslator->trCompoundList(),
+          fortranOpt ? theTranslator->trCompoundListFortran() : vhdlOpt ? VhdlDocGen::trDesignUnitList() : theTranslator->trCompoundList(),
           QCString(),
           fortranOpt ? theTranslator->trCompoundListDescriptionFortran() : vhdlOpt ? VhdlDocGen::trDesignUnitListDescription() : theTranslator->trCompoundListDescription(),
           "annotated"
diff --git a/src/libdoxygen.pro.in b/src/libdoxygen.pro.in
index 6c91435..626b7d9 100644
--- a/src/libdoxygen.pro.in
+++ b/src/libdoxygen.pro.in
@@ -250,6 +250,7 @@ SOURCES      =	ce_lex.cpp \
 		version.cpp \
 		vhdlcode.cpp \
 		vhdldocgen.cpp \
+		vhdlparser.cpp \
 		vhdlscanner.cpp \
 		xmldocvisitor.cpp \
                 xmlgen.cpp
diff --git a/src/libdoxygen.t b/src/libdoxygen.t
index e5a9e56..200d39b 100644
--- a/src/libdoxygen.t
+++ b/src/libdoxygen.t
@@ -63,9 +63,6 @@ sub GenerateDep {
 #$ GenerateDep("fortrancode.cpp","fortrancode.l");
 	$(LEX) -i -PfcodeYY -t fortrancode.l | $(INCBUFSIZE) >fortrancode.cpp
 
-#$ GenerateDep("vhdlscanner.cpp","vhdlscanner.l");
-	$(LEX) -i -PvhdlscanYY -t vhdlscanner.l | $(INCBUFSIZE) >vhdlscanner.cpp
-
 #$ GenerateDep("vhdlcode.cpp","vhdlcode.l");
 	$(LEX) -i -PvhdlcodeYY -t vhdlcode.l | $(INCBUFSIZE) >vhdlcode.cpp
 
@@ -98,8 +95,18 @@ sub GenerateDep {
 
 #$ GenerateDep("ce_parse.h","constexp.y");
 	$(YACC) -l -d -p cppExpYY constexp.y -o ce_parse.c 
-	-rm ce_parse.c	
+	-rm ce_parse.c
+
+#$ GenerateDep("vhdlscanner.cpp","vhdlscanner.l","vhdlparser.h");
+	$(LEX) -i -PvhdlScanYY -t vhdlscanner.l | $(INCBUFSIZE) >vhdlscanner.cpp
+
+#$ GenerateDep("vhdlparser.cpp","vhdlparser.y");
+	$(YACC) -l -p vhdlScanYY vhdlparser.y -o vhdlparser.cpp 	
 
+#$ GenerateDep("vhdlparser.h","vhdlparser.y");
+	$(YACC) -l -d -p vhdlScanYY vhdlparser.y -o vhdlparser.c 
+	-rm vhdlparser.c	
+	
 #$ GenerateDep("layout.cpp","layout_default.h");
 
 TO_C_CMD=sed -e "s/\\\\/\\\\\\\\/g" -e "s/\"/\\\\\"/g" -e "s/^/\"/g" -e "s/$$/\\\\n\"/g"
diff --git a/src/memberlist.cpp b/src/memberlist.cpp
index 1ef623c..b98d86f 100644
--- a/src/memberlist.cpp
+++ b/src/memberlist.cpp
@@ -464,7 +464,7 @@ void MemberList::writeDeclarations(OutputList &ol,
   // 2. This might need to be repeated below for memberGroupLists
   if (optimizeVhdl) // use specific declarations function
   {
-    VhdlDocGen::writeVhdlDeclarations(this,ol,0,cd,0);
+    VhdlDocGen::writeVhdlDeclarations(this,ol,0,cd,0,0);
   }
   else
   {
@@ -585,8 +585,7 @@ void MemberList::writeDocumentationPage(OutputList &ol,
     {
       md->writeDocumentation(this,ol,scopeName,container,m_inGroup);
       ol.endContents();
-      container->writeNavigationPath(ol);
-      endFile(ol,TRUE);
+      endFileWithNavPath(container,ol);
     }
     else
     {
diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp
index 39904f0..7a51f14 100644
--- a/src/namespacedef.cpp
+++ b/src/namespacedef.cpp
@@ -564,12 +564,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol)
 
   ol.endContents();
 
-  if (generateTreeView)
-  {
-    writeNavigationPath(ol);
-  }
-
-  endFile(ol,TRUE);
+  endFileWithNavPath(this,ol);
 
   if (generateTagFile)
   {
@@ -813,8 +808,13 @@ bool NamespaceSDict::declVisible() const
 
 void NamespaceSDict::writeDeclaration(OutputList &ol,const char *title,bool localName)
 {
+ 
+
   if (count()==0) return; // no namespaces in the list
 
+  if (Config_getBool("OPTIMIZE_OUTPUT_VHDL")) return;
+ 
+
   SDict<NamespaceDef>::Iterator ni(*this);
   NamespaceDef *nd;
   bool found=FALSE;
diff --git a/src/navtree.js b/src/navtree.js
index ed37aa7..f3c0380 100644
--- a/src/navtree.js
+++ b/src/navtree.js
@@ -149,14 +149,12 @@ function newNode(o, po, text, link, childrenData, lastNode)
         $(a).parent().parent().addClass('selected');
         $(a).parent().parent().attr('id','selected');
         var anchor = $(aname);
-        var targetDiv = anchor.next();
-        $(targetDiv).children('.memproto,.memdoc').effect("highlight",{},3000);
         $("#doc-content").animate({
           scrollTop: anchor.position().top +
           $('#doc-content').scrollTop() -
           $('#doc-content').offset().top
         },500,function(){
-          $(location).attr('href',aname);
+          window.location.replace(aname);
         });
       };
     }
@@ -308,7 +306,7 @@ function showNode(o, node, index)
             var anchor = $($(location).attr('hash'));
             var targetDiv = anchor.next();
             $(targetDiv).children('.memproto,.memdoc').
-                     effect("highlight", {}, 3000);
+                     effect("highlight", {}, 1500);
           }
           else
           {
@@ -363,6 +361,36 @@ function initNavTree(toroot,relpath)
     }
   },true);
 
+  $(window).bind('hashchange', function(){
+     if (window.location.hash && window.location.hash.length>1){
+       var anchor = $(window.location.hash);
+       var targetDiv = anchor.next();
+       $(targetDiv).children('.memproto,.memdoc').effect("highlight",{},1500);
+       var docContent = $('#doc-content');
+       if (docContent && anchor && anchor[0] && anchor[0].ownerDocument){
+         docContent.scrollTop(anchor.position().top+docContent.scrollTop()-docContent.offset().top);
+       }
+       var a;
+       if ($(location).attr('hash')){
+         var link=stripPath($(location).attr('pathname'))+':'+
+                  $(location).attr('hash').substring(1);
+         a=$('.item a[class*=\""'+link+'"\"]');
+       }
+       if (a && a.length){
+         $('.item').removeClass('selected');
+         $('.item').removeAttr('id');
+         a.parent().parent().addClass('selected');
+         a.parent().parent().attr('id','selected');
+         var anchor = $($(location).attr('hash'));
+         var targetDiv = anchor.next();
+         showRoot();
+       }
+     } else {
+       var docContent = $('#doc-content');
+       if (docContent){ docContent.scrollTop(0); }
+     }
+  })
+
   $(window).load(showRoot);
 }
 
diff --git a/src/navtree_js.h b/src/navtree_js.h
index 6456eb6..2ad1fc1 100644
--- a/src/navtree_js.h
+++ b/src/navtree_js.h
@@ -149,14 +149,12 @@
 "        $(a).parent().parent().addClass('selected');\n"
 "        $(a).parent().parent().attr('id','selected');\n"
 "        var anchor = $(aname);\n"
-"        var targetDiv = anchor.next();\n"
-"        $(targetDiv).children('.memproto,.memdoc').effect(\"highlight\",{},3000);\n"
 "        $(\"#doc-content\").animate({\n"
 "          scrollTop: anchor.position().top +\n"
 "          $('#doc-content').scrollTop() -\n"
 "          $('#doc-content').offset().top\n"
 "        },500,function(){\n"
-"          $(location).attr('href',aname);\n"
+"          window.location.replace(aname);\n"
 "        });\n"
 "      };\n"
 "    }\n"
@@ -308,7 +306,7 @@
 "            var anchor = $($(location).attr('hash'));\n"
 "            var targetDiv = anchor.next();\n"
 "            $(targetDiv).children('.memproto,.memdoc').\n"
-"                     effect(\"highlight\", {}, 3000);\n"
+"                     effect(\"highlight\", {}, 1500);\n"
 "          }\n"
 "          else\n"
 "          {\n"
@@ -363,6 +361,36 @@
 "    }\n"
 "  },true);\n"
 "\n"
+"  $(window).bind('hashchange', function(){\n"
+"     if (window.location.hash && window.location.hash.length>1){\n"
+"       var anchor = $(window.location.hash);\n"
+"       var targetDiv = anchor.next();\n"
+"       $(targetDiv).children('.memproto,.memdoc').effect(\"highlight\",{},1500);\n"
+"       var docContent = $('#doc-content');\n"
+"       if (docContent && anchor && anchor[0] && anchor[0].ownerDocument){\n"
+"         docContent.scrollTop(anchor.position().top+docContent.scrollTop()-docContent.offset().top);\n"
+"       }\n"
+"       var a;\n"
+"       if ($(location).attr('hash')){\n"
+"         var link=stripPath($(location).attr('pathname'))+':'+\n"
+"                  $(location).attr('hash').substring(1);\n"
+"         a=$('.item a[class*=\\\"\"'+link+'\"\\\"]');\n"
+"       }\n"
+"       if (a && a.length){\n"
+"         $('.item').removeClass('selected');\n"
+"         $('.item').removeAttr('id');\n"
+"         a.parent().parent().addClass('selected');\n"
+"         a.parent().parent().attr('id','selected');\n"
+"         var anchor = $($(location).attr('hash'));\n"
+"         var targetDiv = anchor.next();\n"
+"         showRoot();\n"
+"       }\n"
+"     } else {\n"
+"       var docContent = $('#doc-content');\n"
+"       if (docContent){ docContent.scrollTop(0); }\n"
+"     }\n"
+"  })\n"
+"\n"
 "  $(window).load(showRoot);\n"
 "}\n"
 "\n"
diff --git a/src/pagedef.cpp b/src/pagedef.cpp
index 5786bc1..4bf42cb 100644
--- a/src/pagedef.cpp
+++ b/src/pagedef.cpp
@@ -147,8 +147,7 @@ void PageDef::writeDocumentation(OutputList &ol)
   if (generateTreeView && getOuterScope()!=Doxygen::globalScope && !Config_getBool("DISABLE_INDEX"))
   {
     ol.endContents();
-    getOuterScope()->writeNavigationPath(ol);
-    endFile(ol,TRUE);
+    endFileWithNavPath(getOuterScope(),ol);
   }
   else
   {
diff --git a/src/scanner.l b/src/scanner.l
index cf6d538..9cb8031 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -212,7 +212,7 @@ static void initEntry()
 {
   if (insideJava) 
   {
-    protection = (current_root->spec & Entry::Interface) ?  Public : Package;
+    protection = (current_root->spec & (Entry::Interface|Entry::Enum)) ?  Public : Package;
   }
   current->protection = protection ;
   current->mtype      = mtype;
@@ -1592,7 +1592,15 @@ TYPEDEFPREFIX (("typedef"{BN}+)?)((("volatile"|"const"){BN}+)?)
 <FindMembers>{B}*{TYPEDEFPREFIX}{IDLATTR}?"enum"({BN}+("class"|"struct"))?"{" |
 <FindMembers>{B}*{TYPEDEFPREFIX}{IDLATTR}?"enum"({BN}+("class"|"struct"))?{BN}+ { // for IDL: typedef [something] enum
 					  isTypedef=((QCString)yytext).find("typedef")!=-1;
-  					  current->section = Entry::ENUM_SEC ;
+					  if (insideJava)
+					  {
+					    current->section = Entry::CLASS_SEC;
+					    current->spec    = Entry::Enum;
+					  }
+					  else
+					  {
+  					    current->section = Entry::ENUM_SEC ;
+					  }
 					  addType( current ) ;
 					  current->type += " enum" ;
 					  current->fileName  = yyFileName;
@@ -2440,7 +2448,19 @@ TYPEDEFPREFIX (("typedef"{BN}+)?)((("volatile"|"const"){BN}+)?)
   					}
 <ReadInitializer>[;,]			{
   					  //printf(">> initializer `%s' <<\n",current->initializer.data());
-  					  if (*yytext==';' || lastInitializerContext==FindFields)
+                                          if (*yytext==';' && (current_root->spec&Entry::Enum))
+					  {
+					    current->fileName   = yyFileName;
+					    current->startLine  = yyLineNr;
+  					    current->args       = current->args.simplifyWhiteSpace();
+  					    current->name       = current->name.stripWhiteSpace();
+					    current->section    = Entry::VARIABLE_SEC;
+					    current_root->addSubEntry(current);
+					    current = new Entry;
+					    initEntry();
+					    BEGIN(FindMembers);
+					  }
+					  else if (*yytext==';' || lastInitializerContext==FindFields)
 					  {
   					    unput(*yytext);
   					    BEGIN(lastInitializerContext);
@@ -2878,7 +2898,6 @@ TYPEDEFPREFIX (("typedef"{BN}+)?)((("volatile"|"const"){BN}+)?)
 					    }
 					    initEntry();
 					  }
-					  BEGIN( FindMembers ) ;
 					}
 
 <FindMembers>"["			{ 
@@ -3058,8 +3077,7 @@ TYPEDEFPREFIX (("typedef"{BN}+)?)((("volatile"|"const"){BN}+)?)
 					      initEntry();
 					    }
 
-					    // TODO: skip until the end of the scope
-					    BEGIN( SkipRemainder );
+					    BEGIN( FindMembers );
 					  }
 					  else
 					  {
@@ -3078,7 +3096,10 @@ TYPEDEFPREFIX (("typedef"{BN}+)?)((("volatile"|"const"){BN}+)?)
 					  {
 					    current->fileName   = yyFileName;
 					    current->startLine  = yyLineNr;
-					    current->type       = "@"; // enum marker
+					    if (!(current_root->spec&Entry::Enum))
+					    {
+					      current->type       = "@"; // enum marker
+					    }
   					    current->args       = current->args.simplifyWhiteSpace();
   					    current->name       = current->name.stripWhiteSpace();
 					    current->section    = Entry::VARIABLE_SEC;
@@ -5772,7 +5793,7 @@ static void parseCompounds(Entry *rt)
       inputString = ce->program;
       inputPosition = 0;
       scanYYrestart( scanYYin ) ;
-      if (ce->section==Entry::ENUM_SEC)
+      if (ce->section==Entry::ENUM_SEC || (ce->spec&Entry::Enum))
 	BEGIN( FindFields ) ;
       else
 	BEGIN( FindMembers ) ;
@@ -5798,7 +5819,7 @@ static void parseCompounds(Entry *rt)
 	}
 	else if (insideJava)
 	{
-          current->protection = protection = Package ; 
+          current->protection = protection = (ce->spec & (Entry::Interface|Entry::Enum)) ?  Public : Package;
 	}
 	else if (ce->spec&(Entry::Interface | Entry::Ref | Entry::Value | Entry::Struct | Entry::Union))
 	{
diff --git a/src/search.css b/src/search.css
index cc71eb9..5e6b12f 100644
--- a/src/search.css
+++ b/src/search.css
@@ -13,6 +13,7 @@
     right: 0px;
     width: 170px;
     z-index: 102;
+    background-color: white;
 }
 
 #MSearchBox .left
@@ -217,6 +218,10 @@ a.SRScope:focus, a.SRScope:active {
     text-decoration: underline;
 }
 
+span.SRScope {
+    padding-left: 4px;
+}
+
 .SRPage .SRStatus {
     padding: 2px 5px;
     font-size: 8pt;
diff --git a/src/search.js b/src/search.js
index 8c429a2..3ed3f90 100644
--- a/src/search.js
+++ b/src/search.js
@@ -707,3 +707,72 @@ function SearchResults(name)
       return false;
     }
 }
+
+function setKeyActions(elem,action)
+{
+  elem.setAttribute('onkeydown',action);
+  elem.setAttribute('onkeypress',action);
+  elem.setAttribute('onkeyup',action);
+}
+
+function setClassAttr(elem,attr)
+{
+  elem.setAttribute('class',attr);
+  elem.setAttribute('className',attr);
+}
+
+function createResults()
+{
+  var results = document.getElementById("SRResults");
+  for (var e=0; e<searchData.length; e++)
+  {
+    var id = searchData[e][0];
+    var srResult = document.createElement('div');
+    srResult.setAttribute('id','SR_'+id);
+    setClassAttr(srResult,'SRResult');
+    var srEntry = document.createElement('div');
+    setClassAttr(srEntry,'SREntry');
+    var srLink = document.createElement('a');
+    srLink.setAttribute('id','Item'+e);
+    setKeyActions(srLink,'return searchResults.Nav(event,'+e+')');
+    setClassAttr(srLink,'SRSymbol');
+    srLink.innerHTML = searchData[e][1][0];
+    srEntry.appendChild(srLink);
+    if (searchData[e][1].length==2) // single result
+    {
+      srLink.setAttribute('href',searchData[e][1][1][0]);
+      if (searchData[e][1][1][1])
+      {
+       srLink.setAttribute('target','_parent');
+      }
+      var srScope = document.createElement('span');
+      setClassAttr(srScope,'SRScope');
+      srScope.innerHTML = searchData[e][1][1][2];
+      srEntry.appendChild(srScope);
+    }
+    else // multiple results
+    {
+      srLink.setAttribute('href','javascript:searchResults.Toggle("SR_'+id+'")');
+      var srChildren = document.createElement('div');
+      setClassAttr(srChildren,'SRChildren');
+      for (var c=0; c<searchData[e][1].length-1; c++)
+      {
+        var srChild = document.createElement('a');
+        srChild.setAttribute('id','Item'+e+'_c'+c);
+        setKeyActions(srChild,'return searchResults.NavChild(event,'+e+','+c+')');
+        setClassAttr(srChild,'SRScope');
+        srChild.setAttribute('href',searchData[e][1][c+1][0]);
+        if (searchData[e][1][c+1][1])
+        {
+         srChild.setAttribute('target','_parent');
+        }
+        srChild.innerHTML = searchData[e][1][c+1][2];
+        srChildren.appendChild(srChild);
+      }
+      srEntry.appendChild(srChildren);
+    }
+    srResult.appendChild(srEntry);
+    results.appendChild(srResult);
+  }
+}
+
diff --git a/src/search_css.h b/src/search_css.h
index 74e1598..9b6656b 100644
--- a/src/search_css.h
+++ b/src/search_css.h
@@ -13,6 +13,7 @@
 "    right: 0px;\n"
 "    width: 170px;\n"
 "    z-index: 102;\n"
+"    background-color: white;\n"
 "}\n"
 "\n"
 "#MSearchBox .left\n"
@@ -217,6 +218,10 @@
 "    text-decoration: underline;\n"
 "}\n"
 "\n"
+"span.SRScope {\n"
+"    padding-left: 4px;\n"
+"}\n"
+"\n"
 ".SRPage .SRStatus {\n"
 "    padding: 2px 5px;\n"
 "    font-size: 8pt;\n"
diff --git a/src/search_js.h b/src/search_js.h
index 934f338..985d03c 100644
--- a/src/search_js.h
+++ b/src/search_js.h
@@ -707,3 +707,72 @@
 "      return false;\n"
 "    }\n"
 "}\n"
+"\n"
+"function setKeyActions(elem,action)\n"
+"{\n"
+"  elem.setAttribute('onkeydown',action);\n"
+"  elem.setAttribute('onkeypress',action);\n"
+"  elem.setAttribute('onkeyup',action);\n"
+"}\n"
+"\n"
+"function setClassAttr(elem,attr)\n"
+"{\n"
+"  elem.setAttribute('class',attr);\n"
+"  elem.setAttribute('className',attr);\n"
+"}\n"
+"\n"
+"function createResults()\n"
+"{\n"
+"  var results = document.getElementById(\"SRResults\");\n"
+"  for (var e=0; e<searchData.length; e++)\n"
+"  {\n"
+"    var id = searchData[e][0];\n"
+"    var srResult = document.createElement('div');\n"
+"    srResult.setAttribute('id','SR_'+id);\n"
+"    setClassAttr(srResult,'SRResult');\n"
+"    var srEntry = document.createElement('div');\n"
+"    setClassAttr(srEntry,'SREntry');\n"
+"    var srLink = document.createElement('a');\n"
+"    srLink.setAttribute('id','Item'+e);\n"
+"    setKeyActions(srLink,'return searchResults.Nav(event,'+e+')');\n"
+"    setClassAttr(srLink,'SRSymbol');\n"
+"    srLink.innerHTML = searchData[e][1][0];\n"
+"    srEntry.appendChild(srLink);\n"
+"    if (searchData[e][1].length==2) // single result\n"
+"    {\n"
+"      srLink.setAttribute('href',searchData[e][1][1][0]);\n"
+"      if (searchData[e][1][1][1])\n"
+"      {\n"
+"       srLink.setAttribute('target','_parent');\n"
+"      }\n"
+"      var srScope = document.createElement('span');\n"
+"      setClassAttr(srScope,'SRScope');\n"
+"      srScope.innerHTML = searchData[e][1][1][2];\n"
+"      srEntry.appendChild(srScope);\n"
+"    }\n"
+"    else // multiple results\n"
+"    {\n"
+"      srLink.setAttribute('href','javascript:searchResults.Toggle(\"SR_'+id+'\")');\n"
+"      var srChildren = document.createElement('div');\n"
+"      setClassAttr(srChildren,'SRChildren');\n"
+"      for (var c=0; c<searchData[e][1].length-1; c++)\n"
+"      {\n"
+"        var srChild = document.createElement('a');\n"
+"        srChild.setAttribute('id','Item'+e+'_c'+c);\n"
+"        setKeyActions(srChild,'return searchResults.NavChild(event,'+e+','+c+')');\n"
+"        setClassAttr(srChild,'SRScope');\n"
+"        srChild.setAttribute('href',searchData[e][1][c+1][0]);\n"
+"        if (searchData[e][1][c+1][1])\n"
+"        {\n"
+"         srChild.setAttribute('target','_parent');\n"
+"        }\n"
+"        srChild.innerHTML = searchData[e][1][c+1][2];\n"
+"        srChildren.appendChild(srChild);\n"
+"      }\n"
+"      srEntry.appendChild(srChildren);\n"
+"    }\n"
+"    srResult.appendChild(srEntry);\n"
+"    results.appendChild(srResult);\n"
+"  }\n"
+"}\n"
+"\n"
diff --git a/src/searchindex.cpp b/src/searchindex.cpp
index f3a8b1f..bc560c6 100644
--- a/src/searchindex.cpp
+++ b/src/searchindex.cpp
@@ -305,3 +305,774 @@ void SearchIndex::write(const char *fileName)
   delete[] wordStatOffsets;
 }
 
+//---------------------------------------------------------------------------
+// the following part is for the javascript based search engine
+
+#include "memberdef.h"
+#include "namespacedef.h"
+#include "classdef.h"
+#include "filedef.h"
+#include "language.h"
+#include "doxygen.h"
+#include "message.h"
+
+static const char search_script[]=
+#include "search_js.h"
+;
+
+#define MEMBER_INDEX_ENTRIES   256
+#define NUM_SEARCH_INDICES      13
+#define SEARCH_INDEX_ALL         0
+#define SEARCH_INDEX_CLASSES     1
+#define SEARCH_INDEX_NAMESPACES  2
+#define SEARCH_INDEX_FILES       3
+#define SEARCH_INDEX_FUNCTIONS   4
+#define SEARCH_INDEX_VARIABLES   5
+#define SEARCH_INDEX_TYPEDEFS    6
+#define SEARCH_INDEX_ENUMS       7
+#define SEARCH_INDEX_ENUMVALUES  8
+#define SEARCH_INDEX_PROPERTIES  9
+#define SEARCH_INDEX_EVENTS     10
+#define SEARCH_INDEX_RELATED    11
+#define SEARCH_INDEX_DEFINES    12
+
+class SearchIndexList : public SDict< QList<Definition> >
+{
+  public:
+    SearchIndexList(int size=17) : SDict< QList<Definition> >(size,FALSE) 
+    {
+      setAutoDelete(TRUE);
+    }
+   ~SearchIndexList() {}
+    void append(Definition *d)
+    {
+      QList<Definition> *l = find(d->name());
+      if (l==0)
+      {
+        l=new QList<Definition>;
+        SDict< QList<Definition> >::append(d->name(),l);
+      }
+      l->append(d);
+    }
+    int compareItems(GCI item1, GCI item2)
+    {
+      QList<Definition> *md1=(QList<Definition> *)item1;
+      QList<Definition> *md2=(QList<Definition> *)item2;
+      QCString n1 = md1->first()->localName();
+      QCString n2 = md2->first()->localName();
+      return stricmp(n1.data(),n2.data());
+    }
+};
+
+static void addMemberToSearchIndex(
+         SearchIndexList symbols[NUM_SEARCH_INDICES][MEMBER_INDEX_ENTRIES],
+         int symbolCount[NUM_SEARCH_INDICES],
+         MemberDef *md)
+{
+  static bool hideFriendCompounds = Config_getBool("HIDE_FRIEND_COMPOUNDS");
+  bool isLinkable = md->isLinkable();
+  ClassDef *cd=0;
+  NamespaceDef *nd=0;
+  FileDef *fd=0;
+  if (isLinkable             && 
+      (cd=md->getClassDef()) && 
+      cd->isLinkable()       &&
+      cd->templateMaster()==0)
+  {
+    QCString n = md->name();
+    uchar charCode = (uchar)n.at(0);
+    uint letter = charCode<128 ? tolower(charCode) : charCode;
+    if (!n.isEmpty()) 
+    {
+      bool isFriendToHide = hideFriendCompounds &&
+        (QCString(md->typeString())=="friend class" || 
+         QCString(md->typeString())=="friend struct" ||
+         QCString(md->typeString())=="friend union");
+      if (!(md->isFriend() && isFriendToHide))
+      {
+        symbols[SEARCH_INDEX_ALL][letter].append(md);
+        symbolCount[SEARCH_INDEX_ALL]++;
+      }
+      if (md->isFunction() || md->isSlot() || md->isSignal())
+      {
+        symbols[SEARCH_INDEX_FUNCTIONS][letter].append(md);
+        symbolCount[SEARCH_INDEX_FUNCTIONS]++;
+      } 
+      else if (md->isVariable())
+      {
+        symbols[SEARCH_INDEX_VARIABLES][letter].append(md);
+        symbolCount[SEARCH_INDEX_VARIABLES]++;
+      }
+      else if (md->isTypedef())
+      {
+        symbols[SEARCH_INDEX_TYPEDEFS][letter].append(md);
+        symbolCount[SEARCH_INDEX_TYPEDEFS]++;
+      }
+      else if (md->isEnumerate())
+      {
+        symbols[SEARCH_INDEX_ENUMS][letter].append(md);
+        symbolCount[SEARCH_INDEX_ENUMS]++;
+      }
+      else if (md->isEnumValue())
+      {
+        symbols[SEARCH_INDEX_ENUMVALUES][letter].append(md);
+        symbolCount[SEARCH_INDEX_ENUMVALUES]++;
+      }
+      else if (md->isProperty())
+      {
+        symbols[SEARCH_INDEX_PROPERTIES][letter].append(md);
+        symbolCount[SEARCH_INDEX_PROPERTIES]++;
+      }
+      else if (md->isEvent())
+      {
+        symbols[SEARCH_INDEX_EVENTS][letter].append(md);
+        symbolCount[SEARCH_INDEX_EVENTS]++;
+      }
+      else if (md->isRelated() || md->isForeign() ||
+               (md->isFriend() && !isFriendToHide))
+      {
+        symbols[SEARCH_INDEX_RELATED][letter].append(md);
+        symbolCount[SEARCH_INDEX_RELATED]++;
+      }
+    }
+  }
+  else if (isLinkable && 
+      (((nd=md->getNamespaceDef()) && nd->isLinkable()) || 
+       ((fd=md->getFileDef())      && fd->isLinkable())
+      )
+     )
+  {
+    QCString n = md->name();
+    uchar charCode = (uchar)n.at(0);
+    uint letter = charCode<128 ? tolower(charCode) : charCode;
+    if (!n.isEmpty()) 
+    {
+      symbols[SEARCH_INDEX_ALL][letter].append(md);
+      symbolCount[SEARCH_INDEX_ALL]++;
+
+      if (md->isFunction()) 
+      {
+        symbols[SEARCH_INDEX_FUNCTIONS][letter].append(md);
+        symbolCount[SEARCH_INDEX_FUNCTIONS]++;
+      }
+      else if (md->isVariable()) 
+      {
+        symbols[SEARCH_INDEX_VARIABLES][letter].append(md);
+        symbolCount[SEARCH_INDEX_VARIABLES]++;
+      }
+      else if (md->isTypedef())
+      {
+        symbols[SEARCH_INDEX_TYPEDEFS][letter].append(md);
+        symbolCount[SEARCH_INDEX_TYPEDEFS]++;
+      }
+      else if (md->isEnumerate())
+      {
+        symbols[SEARCH_INDEX_ENUMS][letter].append(md);
+        symbolCount[SEARCH_INDEX_ENUMS]++;
+      }
+      else if (md->isEnumValue())
+      {
+        symbols[SEARCH_INDEX_ENUMVALUES][letter].append(md);
+        symbolCount[SEARCH_INDEX_ENUMVALUES]++;
+      }
+      else if (md->isDefine())
+      {
+        symbols[SEARCH_INDEX_DEFINES][letter].append(md);
+        symbolCount[SEARCH_INDEX_DEFINES]++;
+      }
+    }
+  }
+}
+
+static QCString searchId(const QCString &s)
+{
+  int c;
+  uint i;
+  QCString result;
+  for (i=0;i<s.length();i++)
+  {
+    c=s.at(i);
+    if ((c>='0' && c<='9') || (c>='A' && c<='Z') || (c>='a' && c<='z'))
+    {
+      result+=(char)tolower(c);
+    }
+    else
+    {
+      char val[4];
+      sprintf(val,"_%02x",(uchar)c);
+      result+=val;
+    }
+  }
+  return result;
+}
+
+static int g_searchIndexCount[NUM_SEARCH_INDICES];
+static SearchIndexList g_searchIndexSymbols[NUM_SEARCH_INDICES][MEMBER_INDEX_ENTRIES];
+static const char *g_searchIndexName[NUM_SEARCH_INDICES] = 
+{ 
+    "all",
+    "classes",
+    "namespaces",
+    "files",
+    "functions",
+    "variables",
+    "typedefs", 
+    "enums", 
+    "enumvalues",
+    "properties", 
+    "events", 
+    "related",
+    "defines"
+};
+
+
+class SearchIndexCategoryMapping
+{
+  public:
+    SearchIndexCategoryMapping()
+    {
+      categoryLabel[SEARCH_INDEX_ALL]        = theTranslator->trAll();
+      categoryLabel[SEARCH_INDEX_CLASSES]    = theTranslator->trClasses();
+      categoryLabel[SEARCH_INDEX_NAMESPACES] = theTranslator->trNamespace(TRUE,FALSE);
+      categoryLabel[SEARCH_INDEX_FILES]      = theTranslator->trFile(TRUE,FALSE);
+      categoryLabel[SEARCH_INDEX_FUNCTIONS]  = theTranslator->trFunctions();
+      categoryLabel[SEARCH_INDEX_VARIABLES]  = theTranslator->trVariables();
+      categoryLabel[SEARCH_INDEX_TYPEDEFS]   = theTranslator->trTypedefs();
+      categoryLabel[SEARCH_INDEX_ENUMS]      = theTranslator->trEnumerations();
+      categoryLabel[SEARCH_INDEX_ENUMVALUES] = theTranslator->trEnumerationValues();
+      categoryLabel[SEARCH_INDEX_PROPERTIES] = theTranslator->trProperties();
+      categoryLabel[SEARCH_INDEX_EVENTS]     = theTranslator->trEvents();
+      categoryLabel[SEARCH_INDEX_RELATED]    = theTranslator->trFriends();
+      categoryLabel[SEARCH_INDEX_DEFINES]    = theTranslator->trDefines();
+    }
+    QCString categoryLabel[NUM_SEARCH_INDICES];
+};
+
+void writeJavascriptSearchIndex()
+{
+  if (!Config_getBool("GENERATE_HTML")) return;
+
+  // index classes
+  ClassSDict::Iterator cli(*Doxygen::classSDict);
+  ClassDef *cd;
+  for (;(cd=cli.current());++cli)
+  {
+    uchar charCode = (uchar)cd->localName().at(0);
+    uint letter = charCode<128 ? tolower(charCode) : charCode;
+    if (cd->isLinkable() && isId(letter))
+    {
+      g_searchIndexSymbols[SEARCH_INDEX_ALL][letter].append(cd);
+      g_searchIndexSymbols[SEARCH_INDEX_CLASSES][letter].append(cd);
+      g_searchIndexCount[SEARCH_INDEX_ALL]++;
+      g_searchIndexCount[SEARCH_INDEX_CLASSES]++;
+    }
+  }
+
+  // index namespaces
+  NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict);
+  NamespaceDef *nd;
+  for (;(nd=nli.current());++nli)
+  {
+    uchar charCode = (uchar)nd->name().at(0);
+    uint letter = charCode<128 ? tolower(charCode) : charCode;
+    if (nd->isLinkable() && isId(letter))
+    {
+      g_searchIndexSymbols[SEARCH_INDEX_ALL][letter].append(nd);
+      g_searchIndexSymbols[SEARCH_INDEX_NAMESPACES][letter].append(nd);
+      g_searchIndexCount[SEARCH_INDEX_ALL]++;
+      g_searchIndexCount[SEARCH_INDEX_NAMESPACES]++;
+    }
+  }
+
+  // index files
+  FileNameListIterator fnli(*Doxygen::inputNameList);
+  FileName *fn;
+  for (;(fn=fnli.current());++fnli)
+  {
+    FileNameIterator fni(*fn);
+    FileDef *fd;
+    for (;(fd=fni.current());++fni)
+    {
+      uchar charCode = (uchar)fd->name().at(0);
+      uint letter = charCode<128 ? tolower(charCode) : charCode;
+      if (fd->isLinkable() && isId(letter))
+      {
+        g_searchIndexSymbols[SEARCH_INDEX_ALL][letter].append(fd);
+        g_searchIndexSymbols[SEARCH_INDEX_FILES][letter].append(fd);
+        g_searchIndexCount[SEARCH_INDEX_ALL]++;
+        g_searchIndexCount[SEARCH_INDEX_FILES]++;
+      }
+    }
+  }
+
+  // index class members
+  {
+    MemberNameSDict::Iterator mnli(*Doxygen::memberNameSDict);
+    MemberName *mn;
+    // for each member name
+    for (mnli.toFirst();(mn=mnli.current());++mnli)
+    {
+      MemberDef *md;
+      MemberNameIterator mni(*mn);
+      // for each member definition
+      for (mni.toFirst();(md=mni.current());++mni)
+      {
+        addMemberToSearchIndex(g_searchIndexSymbols,g_searchIndexCount,md);
+      }
+    }
+  }
+
+  // index file/namespace members
+  {
+    MemberNameSDict::Iterator fnli(*Doxygen::functionNameSDict);
+    MemberName *mn;
+    // for each member name
+    for (fnli.toFirst();(mn=fnli.current());++fnli)
+    {
+      MemberDef *md;
+      MemberNameIterator mni(*mn);
+      // for each member definition
+      for (mni.toFirst();(md=mni.current());++mni)
+      {
+        addMemberToSearchIndex(g_searchIndexSymbols,g_searchIndexCount,md);
+      }
+    }
+  }
+  
+  // sort all lists
+  int i,p;
+  for (i=0;i<NUM_SEARCH_INDICES;i++)
+  {
+    for (p=0;p<MEMBER_INDEX_ENTRIES;p++)
+    {
+      if (g_searchIndexSymbols[i][p].count()>0)
+      {
+        g_searchIndexSymbols[i][p].sort();
+      }
+    }
+  }
+
+  // write index files
+  QCString searchDirName = Config_getString("HTML_OUTPUT")+"/search";
+
+  for (i=0;i<NUM_SEARCH_INDICES;i++)
+  {
+    for (p=0;p<MEMBER_INDEX_ENTRIES;p++)
+    {
+      if (g_searchIndexSymbols[i][p].count()>0)
+      {
+        QCString baseName;
+        baseName.sprintf("%s_%02x",g_searchIndexName[i],p);
+
+        QCString fileName = searchDirName + "/"+baseName+".html";
+        QCString dataFileName = searchDirName + "/"+baseName+".js";
+
+        QFile outFile(fileName);
+        QFile dataOutFile(dataFileName);
+        if (outFile.open(IO_WriteOnly) && dataOutFile.open(IO_WriteOnly))
+        {
+          {
+            FTextStream t(&outFile);
+
+            t << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\""
+              " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" << endl;
+            t << "<html><head><title></title>" << endl;
+            t << "<meta http-equiv=\"Content-Type\" content=\"text/xhtml;charset=UTF-8\"/>" << endl;
+            t << "<link rel=\"stylesheet\" type=\"text/css\" href=\"search.css\"/>" << endl;
+            t << "<script type=\"text/javascript\" src=\"" << baseName << ".js\"></script>" << endl;
+            t << "<script type=\"text/javascript\" src=\"search.js\"></script>" << endl;
+            t << "</head>" << endl;
+            t << "<body class=\"SRPage\">" << endl;
+            t << "<div id=\"SRIndex\">" << endl;
+            t << "<div class=\"SRStatus\" id=\"Loading\">" << theTranslator->trLoading() << "</div>" << endl;
+            t << "<div id=\"SRResults\"></div>" << endl; // here the results will be inserted
+            t << "<script type=\"text/javascript\"><!--" << endl;
+            t << "createResults();" << endl; // this function will insert the results
+            t << "--></script>" << endl;
+            t << "<div class=\"SRStatus\" id=\"Searching\">" 
+              << theTranslator->trSearching() << "</div>" << endl;
+            t << "<div class=\"SRStatus\" id=\"NoMatches\">"
+              << theTranslator->trNoMatches() << "</div>" << endl;
+
+            t << "<script type=\"text/javascript\"><!--" << endl;
+            t << "document.getElementById(\"Loading\").style.display=\"none\";" << endl;
+            t << "document.getElementById(\"NoMatches\").style.display=\"none\";" << endl;
+            t << "var searchResults = new SearchResults(\"searchResults\");" << endl;
+            t << "searchResults.Search();" << endl;
+            t << "--></script>" << endl;
+            t << "</div>" << endl; // SRIndex
+            t << "</body>" << endl;
+            t << "</html>" << endl;
+          }
+          FTextStream ti(&dataOutFile);
+
+          ti << "var searchData=" << endl;
+          // format
+          // searchData[] = array of items
+          // searchData[x][0] = id
+          // searchData[x][1] = [ name + child1 + child2 + .. ]
+          // searchData[x][1][0] = name as shown
+          // searchData[x][1][y+1] = info for child y
+          // searchData[x][1][y+1][0] = url
+          // searchData[x][1][y+1][1] = 1 => target="_parent"
+          // searchData[x][1][y+1][2] = scope
+
+          ti << "[" << endl;
+          bool firstEntry=TRUE;
+
+          SDict<QList<Definition> >::Iterator li(g_searchIndexSymbols[i][p]);
+          QList<Definition> *dl;
+          int itemCount=0;
+          for (li.toFirst();(dl=li.current());++li)
+          {
+            Definition *d = dl->first();
+            QCString id = d->localName();
+//            t << "<div class=\"SRResult\" id=\"SR_"
+//              << searchId(d->localName()) << "\">" << endl;
+//            t << " <div class=\"SREntry\">\n";
+
+            if (!firstEntry)
+            {
+              ti << "," << endl;
+            }
+            firstEntry=FALSE;
+
+            ti << "  ['" << searchId(d->localName()) << "',['" 
+               << d->localName() << "',[";
+
+            if (dl->count()==1) // item with a unique name
+            {
+              MemberDef  *md   = 0;
+              bool isMemberDef = d->definitionType()==Definition::TypeMember;
+              if (isMemberDef) md = (MemberDef*)d;
+//              t << "  <a id=\"Item" << itemCount << "\" "
+//                << "onkeydown=\""
+//                << "return searchResults.Nav(event," << itemCount << ")\" "
+//                << "onkeypress=\""
+//                << "return searchResults.Nav(event," << itemCount << ")\" "
+//                << "onkeyup=\""
+//                << "return searchResults.Nav(event," << itemCount << ")\" "
+//                << "class=\"SRSymbol\" ";
+//              t << externalLinkTarget() << "href=\"" << externalRef("../",d->getReference(),TRUE);
+//              t << d->getOutputFileBase() << Doxygen::htmlFileExtension;
+              QCString anchor = d->anchor();
+//              if (!anchor.isEmpty())
+//              {
+//                t << "#" << anchor;
+//              }
+//              t << "\"";
+
+              ti << "'" << externalRef("../",d->getReference(),TRUE)
+                 << d->getOutputFileBase() << Doxygen::htmlFileExtension;
+              if (!anchor.isEmpty())
+              {
+                ti << "#" << anchor;
+              }
+              ti << "',";
+
+              static bool extLinksInWindow = Config_getBool("EXT_LINKS_IN_WINDOW");
+              if (!extLinksInWindow || d->getReference().isEmpty())
+              {
+//                t << " target=\"_parent\"";
+                ti << "1,";
+              }
+              else
+              {
+                ti << "0,";
+              }
+//              t << ">";
+//              t << convertToXML(d->localName());
+//              t << "</a>" << endl;
+
+
+              if (d->getOuterScope()!=Doxygen::globalScope)
+              {
+//                t << "  <span class=\"SRScope\">" 
+//                  << convertToXML(d->getOuterScope()->name()) 
+//                  << "</span>" << endl;
+
+                ti << "'" << convertToXML(d->getOuterScope()->name()) << "'";
+              }
+              else if (md)
+              {
+                FileDef *fd = md->getBodyDef();
+                if (fd==0) fd = md->getFileDef();
+                if (fd)
+                {
+//                  t << "  <span class=\"SRScope\">" 
+//                    << convertToXML(fd->localName())
+//                    << "</span>" << endl;
+                 
+                  ti << "'" << convertToXML(fd->localName()) << "'";
+                }
+              }
+              else
+              {
+                ti << "''";
+              }
+              ti << "]]";
+            }
+            else // multiple items with the same name
+            {
+//              t << "  <a id=\"Item" << itemCount << "\" "
+//                << "onkeydown=\""
+//                << "return searchResults.Nav(event," << itemCount << ")\" "
+//                << "onkeypress=\""
+//                << "return searchResults.Nav(event," << itemCount << ")\" "
+//                << "onkeyup=\""
+//                << "return searchResults.Nav(event," << itemCount << ")\" "
+//                << "class=\"SRSymbol\" "
+//                << "href=\"javascript:searchResults.Toggle('SR_"
+//                << searchId(d->localName()) << "')\">" 
+//                << convertToXML(d->localName()) << "</a>" << endl;
+//              t << "  <div class=\"SRChildren\">" << endl;
+
+              QListIterator<Definition> di(*dl);
+              bool overloadedFunction = FALSE;
+              Definition *prevScope = 0;
+              int childCount=0;
+              for (di.toFirst();(d=di.current());)
+              {
+                ++di;
+                Definition *scope     = d->getOuterScope();
+                Definition *next      = di.current();
+                Definition *nextScope = 0;
+                MemberDef  *md        = 0;
+                bool isMemberDef = d->definitionType()==Definition::TypeMember;
+                if (isMemberDef) md = (MemberDef*)d;
+                if (next) nextScope = next->getOuterScope();
+
+//                t << "    <a id=\"Item" << itemCount << "_c" 
+//                  << childCount << "\" "
+//                  << "onkeydown=\""
+//                  << "return searchResults.NavChild(event," 
+//                  << itemCount << "," << childCount << ")\" "
+//                  << "onkeypress=\""
+//                  << "return searchResults.NavChild(event," 
+//                  << itemCount << "," << childCount << ")\" "
+//                  << "onkeyup=\""
+//                  << "return searchResults.NavChild(event," 
+//                  << itemCount << "," << childCount << ")\" "
+//                  << "class=\"SRScope\" ";
+//                if (!d->getReference().isEmpty())
+//                {
+//                  t << externalLinkTarget() << externalRef("../",d->getReference(),FALSE);
+//                }
+//                t << "href=\"" << externalRef("../",d->getReference(),TRUE);
+//                t << d->getOutputFileBase() << Doxygen::htmlFileExtension;
+                QCString anchor = d->anchor();
+//                if (!anchor.isEmpty())
+//                {
+//                  t << "#" << anchor;
+//                }
+//                t << "\"";
+
+                if (childCount>0)
+                {
+                  ti << "],[";
+                }
+                ti << "'" << externalRef("../",d->getReference(),TRUE)
+                   << d->getOutputFileBase() << Doxygen::htmlFileExtension;
+                if (!anchor.isEmpty())
+                {
+                  ti << "#" << anchor;
+                }
+                ti << "',";
+
+                static bool extLinksInWindow = Config_getBool("EXT_LINKS_IN_WINDOW");
+                if (!extLinksInWindow || d->getReference().isEmpty())
+                {
+//                  t << " target=\"_parent\"";
+                  ti << "1,";
+                }
+                else
+                {
+                  ti << "0,";
+                }
+//                t << ">";
+                bool found=FALSE;
+                overloadedFunction = ((prevScope!=0 && scope==prevScope) ||
+                                      (scope && scope==nextScope)
+                                     ) && md && 
+                                     (md->isFunction() || md->isSlot());
+                QCString prefix;
+                if (md) prefix=convertToXML(md->localName());
+                if (overloadedFunction) // overloaded member function
+                {
+                  prefix+=convertToXML(md->argsString()); 
+                          // show argument list to disambiguate overloaded functions
+                }
+                else if (md) // unique member function
+                {
+                  prefix+="()"; // only to show it is a function
+                }
+                QCString name;
+                if (d->definitionType()==Definition::TypeClass)
+                {
+                  name = convertToXML(((ClassDef*)d)->displayName());
+                  found = TRUE;
+                }
+                else if (d->definitionType()==Definition::TypeNamespace)
+                {
+                  name = convertToXML(((NamespaceDef*)d)->displayName());
+                  found = TRUE;
+                }
+                else if (scope==0 || scope==Doxygen::globalScope) // in global scope
+                {
+                  if (md)
+                  {
+                    FileDef *fd = md->getBodyDef();
+                    if (fd==0) fd = md->getFileDef();
+                    if (fd)
+                    {
+                      if (!prefix.isEmpty()) prefix+=":&#160;";
+                      name = prefix + convertToXML(fd->localName());
+                      found = TRUE;
+                    }
+                  }
+                }
+                else if (md && (md->getClassDef() || md->getNamespaceDef())) 
+                  // member in class or namespace scope
+                {
+                  SrcLangExt lang = md->getLanguage();
+                  name = convertToXML(d->getOuterScope()->qualifiedName()) 
+                       + getLanguageSpecificSeparator(lang) + prefix;
+                  found = TRUE;
+                }
+                else if (scope) // some thing else? -> show scope
+                {
+                  name = prefix + convertToXML(scope->name());
+                  found = TRUE;
+                }
+                if (!found) // fallback
+                {
+                  name = prefix + "("+theTranslator->trGlobalNamespace()+")";
+                }
+//                t << name;
+//                t << "</a>" << endl;
+
+                ti << "'" << name << "'";
+
+                prevScope = scope;
+                childCount++;
+              }
+//              t << "  </div>" << endl; // SRChildren
+
+              ti << "]]";
+            }
+            ti << "]";
+//            t << " </div>" << endl; // SREntry
+//            t << "</div>" << endl; // SRResult
+            itemCount++;
+          }
+          if (!firstEntry)
+          {
+            ti << endl;
+          }
+
+          ti << "];" << endl;
+
+        }
+        else
+        {
+          err("Failed to open file '%s' for writing...\n",fileName.data());
+        }
+      }
+    }
+  }
+  //ol.popGeneratorState();
+
+  {
+    QFile f(searchDirName+"/search.js");
+    if (f.open(IO_WriteOnly))
+    {
+      FTextStream t(&f);
+      t << "// Search script generated by doxygen" << endl;
+      t << "// Copyright (C) 2009 by Dimitri van Heesch." << endl << endl;
+      t << "// The code in this file is loosly based on main.js, part of Natural Docs," << endl;
+      t << "// which is Copyright (C) 2003-2008 Greg Valure" << endl;
+      t << "// Natural Docs is licensed under the GPL." << endl << endl;
+      t << "var indexSectionsWithContent =" << endl;
+      t << "{" << endl;
+      bool first=TRUE;
+      int j=0;
+      for (i=0;i<NUM_SEARCH_INDICES;i++)
+      {
+        if (g_searchIndexCount[i]>0)
+        {
+          if (!first) t << "," << endl;
+          t << "  " << j << ": \"";
+          for (p=0;p<MEMBER_INDEX_ENTRIES;p++)
+          {
+            t << (g_searchIndexSymbols[i][p].count()>0 ? "1" : "0");
+          }
+          t << "\"";
+          first=FALSE;
+          j++;
+        }
+      }
+      if (!first) t << "\n";
+      t << "};" << endl << endl;
+      t << "var indexSectionNames =" << endl;
+      t << "{" << endl;
+      first=TRUE;
+      j=0;
+      for (i=0;i<NUM_SEARCH_INDICES;i++)
+      {
+        if (g_searchIndexCount[i]>0)
+        {
+          if (!first) t << "," << endl;
+          t << "  " << j << ": \"" << g_searchIndexName[i] << "\"";
+          first=FALSE;
+          j++;
+        }
+      }
+      if (!first) t << "\n";
+      t << "};" << endl << endl;
+      t << search_script;
+    }
+  }
+  {
+    QFile f(searchDirName+"/nomatches.html");
+    if (f.open(IO_WriteOnly))
+    {
+      FTextStream t(&f);
+      t << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" "
+           "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" << endl;
+      t << "<html><head><title></title>" << endl;
+      t << "<meta http-equiv=\"Content-Type\" content=\"text/xhtml;charset=UTF-8\"/>" << endl;
+      t << "<link rel=\"stylesheet\" type=\"text/css\" href=\"search.css\"/>" << endl;
+      t << "<script type=\"text/javascript\" src=\"search.js\"></script>" << endl;
+      t << "</head>" << endl;
+      t << "<body class=\"SRPage\">" << endl;
+      t << "<div id=\"SRIndex\">" << endl;
+      t << "<div class=\"SRStatus\" id=\"NoMatches\">"
+        << theTranslator->trNoMatches() << "</div>" << endl;
+      t << "</div>" << endl;
+      t << "</body>" << endl;
+      t << "</html>" << endl;
+    }
+  }
+  Doxygen::indexList.addStyleSheetFile("search/search.js");
+}
+
+void writeSearchCategories(FTextStream &t)
+{
+  static SearchIndexCategoryMapping map;
+  int i,j=0;
+  for (i=0;i<NUM_SEARCH_INDICES;i++)
+  {
+    if (g_searchIndexCount[i]>0)
+    {
+      t << "<a class=\"SelectItem\" href=\"javascript:void(0)\" "
+        << "onclick=\"searchBox.OnSelectItem(" << j << ")\">"
+        << "<span class=\"SelectionMark\">&#160;</span>"
+        << convertToXML(map.categoryLabel[i])
+        << "</a>";
+      j++;
+    }
+  }
+}
+
+
+
diff --git a/src/searchindex.h b/src/searchindex.h
index 8022337..2b94261 100644
--- a/src/searchindex.h
+++ b/src/searchindex.h
@@ -25,6 +25,10 @@
 #include <qintdict.h>
 #include <qvector.h>
 
+class FTextStream;
+
+//------- server side search index ----------------------
+
 struct URL
 {
   URL(const char *n,const char *u) : name(n), url(u) {} 
@@ -67,5 +71,9 @@ class SearchIndex
     int m_urlIndex;
 };
 
+//------- client side search index ----------------------
+
+void writeJavascriptSearchIndex();
+void writeSearchCategories(FTextStream &t);
 
 #endif
diff --git a/src/sizzle.js b/src/sizzle.js
index 250fd84..b37b0d4 100644
--- a/src/sizzle.js
+++ b/src/sizzle.js
@@ -7,3 +7,13 @@
 (function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0)
 {I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML='   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function()
 {G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})();
+
+/*
+ * jQuery hashchange event - v1.3 - 7/21/2010
+ * http://benalman.com/projects/jquery-hashchange-plugin/
+ * 
+ * Copyright (c) 2010 "Cowboy" Ben Alman
+ * Dual licensed under the MIT and GPL licenses.
+ * http://benalman.com/about/license/
+ */
+(function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){r||l(a());n()}).attr("src",r||"javascript:0").insertAfter("body")[0].contentWindow;h.onpropertychange=function(){try{if(event.propertyName==="title"){q.document.title=h.title}}catch(s){}}}};j.stop=k;o=function(){return a(q.location.href)};l=function(v,s){var u=q.document,t=$.fn[c].domain;if(v!==s){u.title=h.title;u.open();t&&u.write('<script>document.domain="'+t+'"<\/script>');u.close();q.location.hash=v}}})();return j})()})(jQuery,this);
diff --git a/src/sizzle_js.h b/src/sizzle_js.h
index 626ce22..c4f753b 100644
--- a/src/sizzle_js.h
+++ b/src/sizzle_js.h
@@ -7,3 +7,13 @@
 "(function(){var R=/((?:\\((?:\\([^()]+\\)|[^()]+)+\\)|\\[(?:\\[[^[\\]]*\\]|['\"][^'\"]*['\"]|[^[\\]'\"]+)+\\]|\\\\.|[^ >+~,(\\[\\\\]+)+|[>+~])(\\s*,\\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!==\"string\"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=\"\"}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw\"Syntax error, unrecognized expression: \"+(ah||Y)}if(H.call(ai)===\"[object Array]\"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!==\"\\\\\"){X[1]=(X[1]||\"\").replace(/\\\\/g,\"\");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],\"\");break}}}}if(!Z){Z=T.getElementsByTagName(\"*\")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],\"\");if(!T){return[]}break}}}if(ad==V){if(T==null){throw\"Syntax error, unrecognized expression: \"+ad}else{break}}V=ad}return aa};var I=F.selectors={order:[\"ID\",\"NAME\",\"TAG\"],match:{ID:/#((?:[\\w\\u00c0-\\uFFFF_-]|\\\\.)+)/,CLASS:/\\.((?:[\\w\\u00c0-\\uFFFF_-]|\\\\.)+)/,NAME:/\\[name=['\"]*((?:[\\w\\u00c0-\\uFFFF_-]|\\\\.)+)['\"]*\\]/,ATTR:/\\[\\s*((?:[\\w\\u00c0-\\uFFFF_-]|\\\\.)+)\\s*(?:(\\S?=)\\s*(['\"]*)(.*?)\\3|)\\s*\\]/,TAG:/^((?:[\\w\\u00c0-\\uFFFF\\*_-]|\\\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\\((even|odd|[\\dn+-]*)\\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\\((\\d*)\\))?(?=[^-]|$)/,PSEUDO:/:((?:[\\w\\u00c0-\\uFFFF_-]|\\\\.)+)(?:\\((['\"]*)((?:\\([^\\)]+\\)|[^\\2\\(\\)]*)+)\\2\\))?/},attrMap:{\"class\":\"className\",\"for\":\"htmlFor\"},attrHandle:{href:function(T){return T.getAttribute(\"href\")}},relative:{\"+\":function(aa,T,Z){var X=typeof T===\"string\",ab=X&&!/\\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},\">\":function(Z,U,aa){var X=typeof U===\"string\";if(X&&!/\\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},\"\":function(W,U,Y){var V=L++,T=S;if(!U.match(/\\W/)){var X=U=Y?U:U.toUpperCase();T=P}T(\"parentNode\",U,V,W,X,Y)},\"~\":function(W,U,Y){var V=L++,T=S;if(typeof U===\"string\"&&!U.match(/\\W/)){var X=U=Y?U:U.toUpperCase();T=P}T(\"previousSibling\",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!==\"undefined\"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!==\"undefined\"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute(\"name\")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=\" \"+W[1].replace(/\\\\/g,\"\")+\" \";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(\" \"+Y.className+\" \").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\\\/g,\"\")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]==\"nth\"){var U=/(-?)(\\d*)n((?:\\+|-)?\\d*)/.exec(T[2]==\"even\"&&\"2n\"||T[2]==\"odd\"&&\"2n+1\"||!/\\D/.test(T[2])&&\"0n+\"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\\\/g,\"\");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]===\"~=\"){X[4]=\" \"+X[4]+\" \"}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]===\"not\"){if(X[3].match(R).length>1||/^\\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!==\"hidden\"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\\d/i.test(T.nodeName)},text:function(T){return\"text\"===T.type},radio:function(T){return\"radio\"===T.type},checkbox:function(T){return\"checkbox\"===T.type},file:function(T){return\"file\"===T.type},password:function(T){return\"password\"===T.type},submit:function(T){return\"submit\"===T.type},image:function(T){return\"image\"===T.type},reset:function(T){return\"reset\"===T.type},button:function(T){return\"button\"===T.type||T.nodeName.toUpperCase()===\"BUTTON\"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U===\"contains\"){return(Z.textContent||Z.innerText||\"\").indexOf(V[3])>=0}else{if(U===\"not\"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case\"only\":case\"first\":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z==\"first\"){return true}U=T;case\"last\":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case\"nth\":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute(\"id\")===T},TAG:function(U,T){return(T===\"*\"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(\" \"+(U.className||U.getAttribute(\"class\"))+\" \").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+\"\",X=W[2],U=W[4];return T==null?X===\"!=\":X===\"=\"?Z===U:X===\"*=\"?Z.indexOf(U)>=0:X===\"~=\"?(\" \"+Z+\" \").indexOf(U)>=0:!U?Z&&T!==false:X===\"!=\"?Z!=U:X===\"^=\"?Z.indexOf(U)===0:X===\"$=\"?Z.substr(Z.length-U.length)===U:X===\"|=\"?Z===U||Z.substr(0,U.length+1)===U+\"-\":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\\[]*\\])(?![^\\(]*\\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)===\"[object Array]\"){Array.prototype.push.apply(U,X)}else{if(typeof X.length===\"number\"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if(\"sourceIndex\" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement(\"form\"),V=\"script\"+(new Date).getTime();U.innerHTML=\"<input name='\"+V+\"'/>\";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!==\"undefined\"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!==\"undefined\"&&W.getAttributeNode(\"id\").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!==\"undefined\"&&Y.getAttributeNode(\"id\");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement(\"div\");T.appendChild(document.createComment(\"\"));if(T.getElementsByTagName(\"*\").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]===\"*\"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML=\"<a href='#'></a>\";if(T.firstChild&&typeof T.firstChild.getAttribute!==\"undefined\"&&T.firstChild.getAttribute(\"href\")!==\"#\"){I.attrHandle.href=function(U){return U.getAttribute(\"href\",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement(\"div\");U.innerHTML=\"<p class='TEST'></p>\";if(U.querySelectorAll&&U.querySelectorAll(\".TEST\").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement(\"div\");T.innerHTML=\"<div class='test e'></div><div class='test'></div>\";if(T.getElementsByClassName(\"e\").length===0){return}T.lastChild.className=\"e\";if(T.getElementsByClassName(\"e\").length===1){return}I.order.splice(1,0,\"CLASS\");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!==\"undefined\"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U==\"previousSibling\"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U==\"previousSibling\"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!==\"string\"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!==\"HTML\"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X=\"\",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,\"\")}T=I.relative[T]?T+\"*\":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[\":\"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=\":not(\"+V+\")\"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,\"events\")||o.data(I,\"events\",{}),J=o.data(I,\"handle\")||o.data(I,\"handle\",function(){return typeof o!==\"undefined\"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\\s+/),function(M,N){var O=N.split(\".\");N=O.shift();H.type=O.slice().sort().join(\".\");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent(\"on\"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,\"events\"),F,E;if(G){if(H===g||(typeof H===\"string\"&&H.charAt(0)==\".\")){for(var I in G){this.remove(K,I+(H||\"\"))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\\s+/),function(M,O){var Q=O.split(\".\");O=Q.shift();var N=RegExp(\"(^|\\\\.)\"+Q.slice().sort().join(\".*\\\\.\")+\"(\\\\.|$)\");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,\"handle\"),false)}else{if(K.detachEvent){K.detachEvent(\"on\"+O,o.data(K,\"handle\"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,\"handle\");if(L){L.elem=null}o.removeData(K,\"events\");o.removeData(K,\"handle\")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I===\"object\"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf(\"!\")>=0)\n"
 "{I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,\"handle\");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,\"a\")&&G==\"click\"))&&H[\"on\"+G]&&H[\"on\"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,\"a\")&&G==\"click\")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(\".\");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp(\"(^|\\\\.)\"+L.slice().sort().join(\".*\\\\.\")+\"(\\\\.|$)\");E=(o.data(this,\"events\")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:\"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which\".split(\" \"),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp(\"(^|\\\\.)\"+G[0]+\"(\\\\.|$)\");o.each((o.data(this,\"events\").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:\"mouseenter\",mouseout:\"mouseleave\"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F==\"unload\"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp(\"(^|\\\\.)\"+H.type+\"(\\\\.|$)\"),G=true,F=[];o.each(o.data(this,\"events\").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,\"closest\")-o.data(I.elem,\"closest\")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return[\"live\",F,E.replace(/\\./g,\"`\").replace(/ /g,\"|\")].join(\".\")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler(\"ready\")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener(\"DOMContentLoaded\",function(){document.removeEventListener(\"DOMContentLoaded\",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent(\"onreadystatechange\",function(){if(document.readyState===\"complete\"){document.detachEvent(\"onreadystatechange\",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll(\"left\")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,\"load\",o.ready)}o.each((\"blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error\").split(\",\"),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind(\"unload\",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement(\"script\"),K=document.createElement(\"div\"),J=\"script\"+(new Date).getTime();K.style.display=\"none\";K.innerHTML='   <link/><table></table><a href=\"/a\" style=\"color:red;float:left;opacity:.5;\">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName(\"*\"),E=K.getElementsByTagName(\"a\")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName(\"tbody\").length,objectAll:!!K.getElementsByTagName(\"object\")[0].getElementsByTagName(\"*\").length,htmlSerialize:!!K.getElementsByTagName(\"link\").length,style:/red/.test(E.getAttribute(\"style\")),hrefNormalized:E.getAttribute(\"href\")===\"/a\",opacity:E.style.opacity===\"0.5\",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type=\"text/javascript\";try{G.appendChild(document.createTextNode(\"window.\"+J+\"=1;\"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent(\"onclick\",function(){o.support.noCloneEvent=false;K.detachEvent(\"onclick\",arguments.callee)});K.cloneNode(true).fireEvent(\"onclick\")}o(function(){var L=document.createElement(\"div\");L.style.width=L.style.paddingLeft=\"1px\";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display=\"none\"})})();var w=o.support.cssFloat?\"cssFloat\":\"styleFloat\";o.props={\"for\":\"htmlFor\",\"class\":\"className\",\"float\":w,cssFloat:w,styleFloat:w,readonly:\"readOnly\",maxlength:\"maxLength\",cellspacing:\"cellSpacing\",rowspan:\"rowSpan\",tabindex:\"tabIndex\"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!==\"string\"){return this._load(G)}var I=G.indexOf(\" \");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H=\"GET\";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J===\"object\"){J=o.param(J);H=\"POST\"}}}var F=this;o.ajax({url:G,type:H,dataType:\"html\",data:J,complete:function(M,L){if(L==\"success\"||L==\"notmodified\"){F.html(E?o(\"<div/>\").append(M.responseText.replace(/<script(.|\\s)*?\\/script>/g,\"\")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each(\"ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend\".split(\",\"),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:\"GET\",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,\"script\")},getJSON:function(E,F,G){return o.get(E,F,G,\"json\")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:\"POST\",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:\"GET\",contentType:\"application/x-www-form-urlencoded\",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject(\"Microsoft.XMLHTTP\"):new XMLHttpRequest()},accepts:{xml:\"application/xml, text/xml\",html:\"text/html\",script:\"text/javascript, application/javascript\",json:\"application/json, text/javascript\",text:\"text/plain\",_default:\"*/*\"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!==\"string\"){M.data=o.param(M.data)}if(M.dataType==\"jsonp\"){if(G==\"GET\"){if(!M.url.match(F)){M.url+=(M.url.match(/\\?/)?\"&\":\"?\")+(M.jsonp||\"callback\")+\"=?\"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+\"&\":\"\")+(M.jsonp||\"callback\")+\"=?\"}}M.dataType=\"json\"}if(M.dataType==\"json\"&&(M.data&&M.data.match(F)||M.url.match(F))){W=\"jsonp\"+r++;if(M.data){M.data=(M.data+\"\").replace(F,\"=\"+W+\"$1\")}M.url=M.url.replace(F,\"=\"+W+\"$1\");M.dataType=\"script\";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType==\"script\"&&M.cache==null){M.cache=false}if(M.cache===false&&G==\"GET\"){var E=e();var U=M.url.replace(/(\\?|&)_=.*?(&|$)/,\"$1_=\"+E+\"$2\");M.url=U+((U==M.url)?(M.url.match(/\\?/)?\"&\":\"?\")+\"_=\"+E:\"\")}if(M.data&&G==\"GET\"){M.url+=(M.url.match(/\\?/)?\"&\":\"?\")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger(\"ajaxStart\")}var Q=/^(\\w+:)?\\/\\/([^\\/?#]+)/.exec(M.url);if(M.dataType==\"script\"&&G==\"GET\"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName(\"head\")[0];var T=document.createElement(\"script\");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState==\"loaded\"||this.readyState==\"complete\")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader(\"Content-Type\",M.contentType)}if(M.ifModified){J.setRequestHeader(\"If-Modified-Since\",o.lastModified[M.url]||\"Thu, 01 Jan 1970 00:00:00 GMT\")}J.setRequestHeader(\"X-Requested-With\",\"XMLHttpRequest\");J.setRequestHeader(\"Accept\",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+\", */*\":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger(\"ajaxStop\")}J.abort();return false}if(M.global){o.event.trigger(\"ajaxSend\",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger(\"ajaxStop\")}}}else{if(!K&&J&&(J.readyState==4||X==\"timeout\")){K=true;if(P){clearInterval(P);P=null}R=X==\"timeout\"?\"timeout\":!o.httpSuccess(J)?\"error\":M.ifModified&&o.httpNotModified(J,M.url)?\"notmodified\":\"success\";if(R==\"success\"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R=\"parsererror\"}}if(R==\"success\"){var Y;try{Y=J.getResponseHeader(\"Last-Modified\")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N(\"timeout\")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger(\"ajaxSuccess\",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger(\"ajaxComplete\",[J,M])}if(M.global&&!--o.active){o.event.trigger(\"ajaxStop\")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger(\"ajaxError\",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol==\"file:\"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader(\"Last-Modified\");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader(\"content-type\"),E=H==\"xml\"||!H&&F&&F.indexOf(\"xml\")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName==\"parsererror\"){throw\"parsererror\"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I===\"string\"){if(H==\"script\"){o.globalEval(I)}if(H==\"json\"){I=l[\"eval\"](\"(\"+I+\")\")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+\"=\"+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join(\"&\").replace(/%20/g,\"+\")}});var m={},n,d=[[\"height\",\"marginTop\",\"marginBottom\",\"paddingTop\",\"paddingBottom\"],[\"width\",\"marginLeft\",\"marginRight\",\"paddingLeft\",\"paddingRight\"],[\"opacity\"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function()\n"
 "{G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t(\"show\",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],\"olddisplay\");this[H].style.display=E||\"\";if(o.css(this[H],\"display\")===\"none\"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o(\"<\"+G+\" />\").appendTo(\"body\");K=I.css(\"display\");if(K===\"none\"){K=\"block\"}I.remove();m[G]=K}o.data(this[H],\"olddisplay\",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],\"olddisplay\")||\"\"}return this}},hide:function(H,I){if(H){return this.animate(t(\"hide\",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],\"olddisplay\");if(!E&&E!==\"none\"){o.data(this[G],\"olddisplay\",o.css(this[G],\"display\"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display=\"none\"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G===\"boolean\";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(\":hidden\");o(this)[H?\"show\":\"hide\"]()}):this.animate(t(\"toggle\",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?\"each\":\"queue\"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(\":hidden\"),J=this;for(M in I){if(I[M]==\"hide\"&&L||I[M]==\"show\"&&!L){return K.complete.call(this)}if((M==\"height\"||M==\"width\")&&this.style){K.display=o.css(this,\"display\");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow=\"hidden\"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S==\"toggle\"?L?\"show\":\"hide\":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||\"px\";if(P!=\"px\"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]==\"-=\"?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,\"\")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t(\"show\",1),slideUp:t(\"hide\",1),slideToggle:t(\"toggle\",1),fadeIn:{opacity:\"show\"},fadeOut:{opacity:\"hide\"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G===\"object\"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration===\"number\"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop==\"height\"||this.prop==\"width\")&&this.elem.style){this.elem.style.display=\"block\"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||\"px\";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop==\"width\"||this.prop==\"height\"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,\"display\")==\"none\"){this.elem.style.display=\"block\"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?\"swing\":\"linear\")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,\"opacity\",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!==\"visible\"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position===\"relative\"||E.position===\"static\"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position===\"fixed\"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement(\"div\"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style=\"position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;\"><div></div></div><table style=\"position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;\" cellpadding=\"0\" cellspacing=\"0\"><tr><td></td></tr></table>';M={position:\"absolute\",top:0,left:0,margin:0,border:0,width:\"1px\",height:\"1px\",visibility:\"hidden\"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow=\"hidden\",H.style.position=\"relative\";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop=\"1px\";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,\"marginTop\",true),10)||0,F+=parseInt(o.curCSS(E,\"marginLeft\",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,\"marginTop\");J.left-=j(this,\"marginLeft\");E.top+=j(G,\"borderTopWidth\");E.left+=j(G,\"borderLeftWidth\");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,\"position\")==\"static\")){E=E.offsetParent}return o(E)}});o.each([\"Left\",\"Top\"],function(F,E){var G=\"scroll\"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?\"pageYOffset\":\"pageXOffset\"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each([\"Height\",\"Width\"],function(I,G){var E=I?\"Left\":\"Top\",H=I?\"Right\":\"Bottom\",F=G.toLowerCase();o.fn[\"inner\"+G]=function(){return this[0]?o.css(this[0],F,false,\"padding\"):null};o.fn[\"outer\"+G]=function(K){return this[0]?o.css(this[0],F,false,K?\"margin\":\"border\"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode==\"CSS1Compat\"&&document.documentElement[\"client\"+G]||document.body[\"client\"+G]:this[0]==document?Math.max(document.documentElement[\"client\"+G],document.body[\"scroll\"+G],document.documentElement[\"scroll\"+G],document.body[\"offset\"+G],document.documentElement[\"offset\"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K===\"string\"?K:K+\"px\")}})})();\n"
+"\n"
+"/*\n"
+" * jQuery hashchange event - v1.3 - 7/21/2010\n"
+" * http://benalman.com/projects/jquery-hashchange-plugin/\n"
+" * \n"
+" * Copyright (c) 2010 \"Cowboy\" Ben Alman\n"
+" * Dual licensed under the MIT and GPL licenses.\n"
+" * http://benalman.com/about/license/\n"
+" */\n"
+"(function($,e,b){var c=\"hashchange\",h=document,f,g=$.event.special,i=h.documentMode,d=\"on\"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return\"#\"+j.replace(/^[^#]*#?(.*)$/,\"$1\")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,\"\")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('<iframe tabindex=\"-1\" title=\"empty\"/>').hide().one(\"load\",function(){r||l(a());n()}).attr(\"src\",r||\"javascript:0\").insertAfter(\"body\")[0].contentWindow;h.onpropertychange=function(){try{if(event.propertyName===\"title\"){q.document.title=h.title}}catch(s){}}}};j.stop=k;o=function(){return a(q.location.href)};l=function(v,s){var u=q.document,t=$.fn[c].domain;if(v!==s){u.title=h.title;u.open();t&&u.write('<script>document.domain=\"'+t+'\"<\\/script>');u.close();q.location.hash=v}}})();return j})()})(jQuery,this);\n"
diff --git a/src/svgpan.js b/src/svgpan.js
index 7c0c916..663be79 100644
--- a/src/svgpan.js
+++ b/src/svgpan.js
@@ -66,7 +66,7 @@ function show()
     windowWidth = 800;
     windowHeight = 600;
   }
-  minZoom = Math.min(windowHeight/viewHeight,windowWidth/viewWidth);
+  minZoom = Math.min(Math.min(viewHeight,windowHeight)/viewHeight,Math.min(viewWidth,windowWidth)/viewWidth);
   maxZoom = minZoom+1.5;
   zoomInFactor = Math.pow(maxZoom/minZoom,1.0/zoomSteps);
   zoomOutFactor = 1.0/zoomInFactor;
@@ -168,6 +168,7 @@ function doZoom(g,point,zoomFactor)
 function handleMouseWheel(evt) 
 {
   if (!evt) evt = window.evt;
+  if (!evt.shiftKey) return; // only zoom when shift is pressed
   if (evt.preventDefault) evt.preventDefault();
   evt.returnValue = false;
 
diff --git a/src/svgpan_js.h b/src/svgpan_js.h
index 7cbbdfc..260d4f7 100644
--- a/src/svgpan_js.h
+++ b/src/svgpan_js.h
@@ -66,7 +66,7 @@
 "    windowWidth = 800;\n"
 "    windowHeight = 600;\n"
 "  }\n"
-"  minZoom = Math.min(windowHeight/viewHeight,windowWidth/viewWidth);\n"
+"  minZoom = Math.min(Math.min(viewHeight,windowHeight)/viewHeight,Math.min(viewWidth,windowWidth)/viewWidth);\n"
 "  maxZoom = minZoom+1.5;\n"
 "  zoomInFactor = Math.pow(maxZoom/minZoom,1.0/zoomSteps);\n"
 "  zoomOutFactor = 1.0/zoomInFactor;\n"
@@ -168,6 +168,7 @@
 "function handleMouseWheel(evt) \n"
 "{\n"
 "  if (!evt) evt = window.evt;\n"
+"  if (!evt.shiftKey) return; // only zoom when shift is pressed\n"
 "  if (evt.preventDefault) evt.preventDefault();\n"
 "  evt.returnValue = false;\n"
 "\n"
diff --git a/src/tclscanner.l b/src/tclscanner.l
index 65e2793..e8db560 100644
--- a/src/tclscanner.l
+++ b/src/tclscanner.l
@@ -19,7 +19,6 @@
 #include <stdlib.h>
 #include <assert.h>
 #include <ctype.h>
-
 #include "qtbc.h"
 #include <qarray.h>
 #include <qstack.h>
@@ -27,7 +26,6 @@
 #include <unistd.h> 
 #include <qfile.h>
 #include <qdict.h>
-  
 #include "entry.h"
 #include "message.h"
 #include "config.h"
@@ -44,37 +42,34 @@
 #include "commentcnv.h"
 #include "bufstr.h"
 #include "portable.h"
-
-#include <stdarg.h>
 #include <qstring.h>
 #include <qstringlist.h>
 #include <qlist.h>
-//#include <qmap.h>
-
-#define HAS_TCL_SUBST 0
+#include <qmap.h>
 
 #define YY_NEVER_INTERACTIVE 1
 
 #define MAX_INCLUDE_DEPTH 10
 
-#define tcl_abort \
-	fprintf(stderr,"%s#%d %s()",__FILE__,__LINE__,__FUNCTION__); \
-        yy_push_state(ERROR); \
-        yyless(0); \
-	tcl_Abort
-//#define TCL_DEBUG_FD NULL
-#define TCL_WARN_FD stdout
-#define tcl_warn \
-	tcl_Warn("%.6d--(%s) %d# ",__LINE__,__FUNCTION__,yylineno); \
-	tcl_Warn
-#define TCL_DEBUG_FD NULL
-//#define TCL_DEBUG_FD stdout
-#define tcl_debug \
-	tcl_Debug("%.6d--(%s) %d#%d ",__LINE__,__FUNCTION__,yylineno,yy_start_stack_ptr); \
-	tcl_Debug
-
-//#define D printf("%.6d---(%s)%s\n",__LINE__,__FUNCTION__,yytext);
-#define D
+//! Application error.
+#define tcl_err \
+  printf("Error %d %s() in %s line %d! ",__LINE__,__FUNCTION__,tcl.file_name.data(),yylineno); \
+  yy_push_state(ERROR); \
+  yyless(0); \
+  printf
+
+//! Application warning.
+#define tcl_war \
+  printf("Warning %d %s() in %s line %d: ",__LINE__,__FUNCTION__,tcl.file_name.data(),yylineno); \
+  printf
+
+//! Application message.
+#define tcl_inf \
+  if (0) printf("--- %.4d %s() %d@%d: ",__LINE__,__FUNCTION__,yylineno,yy_start_stack_ptr) && printf
+
+//! Debug message.
+#define D\
+  if (0) printf("--- %.4d %s() %d@%d: %s\n",__LINE__,__FUNCTION__,yylineno,yy_start_stack_ptr,yytext);
 
 // BEGIN of copy from tclUtil.c
 // - Tcl_Interp removed
@@ -212,7 +207,8 @@ int TclFindElement(
       case '\r':
       case '\t':
       case '\v':
-	if ((openBraces == 0) && !inQuotes) {
+	if ((openBraces == 0) && !inQuotes) 
+	{
 	  size = (p - elemStart);
 	  goto done;
 	}
@@ -400,9 +396,8 @@ typedef struct
   QCString string_after;
   int line0; // start line of scan context
   int line1; // end line of scan context
-  int start_stack_ptr; // value of scan context
   YY_BUFFER_STATE buffer_state; // value of scan context
-  Entry *entry_ns; // current namespace
+  QString ns; // current namespace
   Entry *entry_fn; // if set contains the current proc/method/constructor/destructor
   Entry *entry_cl; // if set contain the current class
   Entry *entry_scan; // current scan entry
@@ -417,12 +412,10 @@ static struct
   int code_linenumbers; // if true create line numbers in code
   const char *code_font; // used font to codify
   bool config_autobrief; // value of configuration option
-#if HAS_TCL_SUBST 
   QMap<QString,QString> config_subst; // map of configuration option values
-#endif
-  const char *   input_string; // file contents
-  int		input_position; // position in file
-  QCString	file_name; // name of used file
+  QCString input_string; // file contents
+  int input_position; // position in file
+  QCString file_name; // name of used file
   ParserInterface *this_parser; // myself
   int command; // true if command was found
   int comment; // set true if comment was scaned
@@ -445,18 +438,19 @@ static struct
   Entry*		entry_file; // entry of current file
   Entry*		entry_current; // currently used entry
   Entry*		entry_inside; // contain entry of current scan context
-  QStringList list_command; // list of command words
+  QStringList list_commandwords; // list of command words
   QList<tcl_scan> scan; // stack of scan contexts
   QDict<Entry> ns; // all read namespace entries
   QDict<Entry> cl; // all read class entries
   QDict<Entry> fn; // all read function entries
   QList<Entry> entry; // list of all created entries, will be deleted after codifying
   Protection protection; // current protections state
+  MemberDef *memberdef; // contain current MemberDef when codifying
 } tcl;
 
 // scanner functions
 static int yyread(char *buf,int max_size);
-tcl_scan *tcl_scan_start(int type, QString content);
+static void tcl_scan_start(int type, QString content, const char *after, QString ns, Entry *entry_cls, Entry *entry_fn);
 static void tcl_scan_end();
 static void tcl_comment(int what,const char *text);
 static void tcl_word(int what,const char *text);
@@ -490,7 +484,8 @@ Entry* tcl_entry_new()
 }
 
 //! Set protection level.
-void tcl_protection(Entry *entry) {
+void tcl_protection(Entry *entry) 
+{
   if (entry->protection!=Public&&entry->protection!=Protected&&entry->protection!=Private)
   {
     entry->protection = tcl.protection;
@@ -581,10 +576,39 @@ static int tcl_keyword(QString str)
   static int myInit=1;
   if (myInit)
   {
-// tcl keywords
-    myList <<"append"<<"apply"<<"array"<<"auto_execok"<<"auto_import"<<"auto_load"<<"auto_mkindex"<<"auto_qualify"<<"auto_reset"<<"catch"<<"cd"<<"close"<<"concat"<<"eof"<<"exec"<<"exit"<<"fblocked"<<"fconfigure"<<"file"<<"flush"<<"foreach"<<"format"<<"gets"<<"global"<<"http"<<"if"<<"incr"<<"info"<<"join"<<"lappend"<<"lassign"<<"lindex"<<"linsert"<<"llength"<<"load"<<"lrange"<<"lrepeat"<<"lreplace"<<"lreverse"<<"lset"<<"namespace"<<"parray"<<"pid"<<"pkg_mkIndex"<<"proc"<<"puts"<<"pwd"<<"registry"<<"rename"<<"return"<<"scan"<<"set"<<"split"<<"tclLog"<<"tcl_endOfWord"<<"tcl_findLibrary"<<"tcl_startOfNextWord"<<"tcl_startOfPreviousWord"<<"tcl_wordBreakAfter"<<"tcl_wordBreakBefore"<<"tell"<<"time"<<"unknown"<<"upvar"<<"variable"<<"vwait";
+    // tcl keywords TODO default, else, provide, require
+    myList <<"append"<<"apply"<<"array"<<"auto_execok"<<"auto_import"<<"auto_load"<<"auto_mkindex"<<"auto_qualify"<<"auto_reset";
+    myList <<"binary";
+    myList <<"catch"<<"cd"<<"close"<<"clock"<<"concat";
+    myList <<"eof"<<"eval"<<"exec"<<"exit"<<"expr";
+    myList <<"fblocked"<<"fconfigure"<<"file"<<"fileevent"<<"flush"<<"for"<<"foreach"<<"format";
+    myList <<"gets"<<"global";
+    myList <<"http";
+    myList <<"if"<<"incr"<<"info"<<"interp";
+    myList <<"join";
+    myList <<"lappend"<<"lassign"<<"lindex"<<"linsert"<<"llength"<<"load"<<"lrange"<<"lrepeat"<<"lreplace"<<"lreverse"<<"lset";
+    myList <<"namespace";
+    myList <<"package"<<"parray"<<"pid"<<"pkg_mkIndex"<<"proc"<<"puts"<<"pwd";
+    myList <<"registry"<<"rename"<<"return";
+    myList <<"scan"<<"set"<<"split"<<"string"<<"switch";
+    myList <<"tclLog"<<"tcl_endOfWord"<<"tcl_findLibrary"<<"tcl_startOfNextWord"<<"tcl_startOfPreviousWord"<<"tcl_wordBreakAfter"<<"tcl_wordBreakBefore"<<"tell"<<"time";
+    myList <<"unknown"<<"upvar";
+    myList <<"variable"<<"vwait";
 // tk keywords
-    myList <<"bell"<<"bind"<<"clipboard"<<"console"<<"consoleinterp"<<"event"<<"focus"<<"grid"<<"pack"<<"place"<<"tkwait"<<"winfo"<<"wm"<<"bindtags"<<"destroy"<<"lower"<<"option"<<"raise"<<"send"<<"tkerror"<<"tkwait"<<"tk_bisque"<<"tk_focusNext"<<"tk_focusPrev"<<"tk_focusFollowsMouse"<<"tk_popup"<<"tk_setPalette"<<"tk_textCut"<<"tk_TextCopy"<<"tk_textPaste"<<"chooseColor"<<"tk_chooseColor"<<"tk_chooseDirectory"<<"tk_dialog"<<"tk_getOpenFile"<<"tkDialog"<<"tk_getSaveFile"<<"tk_messageBox"<<"button"<<"canvas"<<"checkbutton"<<"entry"<<"frame"<<"image"<<"label"<<"labelframe"<<"listbox"<<"menu"<<"menubutton"<<"message"<<"panedwindow"<<"radiobutton"<<"scale"<<"scrollbar"<<"spinbox"<<"toplevel";
+    myList <<"bell"<<"bind"<<"bindtags";
+    myList <<"clipboard"<<"console"<<"consoleinterp";
+    myList <<"destroy";
+    myList <<"event";
+    myList <<"focus";
+    myList <<"grid";
+    myList <<"lower";
+    myList <<"option";
+    myList <<"pack"<<"place";
+    myList <<"raise";
+    myList <<"send";
+    myList <<"tkerror"<<"tkwait"<<"tk_bisque"<<"tk_focusNext"<<"tk_focusPrev"<<"tk_focusFollowsMouse"<<"tk_popup"<<"tk_setPalette"<<"tk_textCut"<<"tk_TextCopy"<<"tk_textPaste"<<"chooseColor"<<"tk_chooseColor"<<"tk_chooseDirectory"<<"tk_dialog"<<"tk_getOpenFile"<<"tkDialog"<<"tk_getSaveFile"<<"tk_messageBox";
+    myList <<"winfo"<<"wm";
+    myList <<"button"<<"canvas"<<"checkbutton"<<"entry"<<"frame"<<"image"<<"label"<<"labelframe"<<"listbox"<<"menu"<<"menubutton"<<"message"<<"panedwindow"<<"radiobutton"<<"scale"<<"scrollbar"<<"spinbox"<<"toplevel";
     myList.sort();
     myInit=0;
   }
@@ -629,9 +653,18 @@ static void tcl_codify(const char *s,char *str)
       tcl.code->codify(sp);
       //tcl_font_end();
       tcl.code->endCodeLine();
-      if (tcl.code_linenumbers) 
+      if (tcl.code_linenumbers)
       {
-        tcl.code->writeLineNumber(0,0,0,tcl.code_line);
+        if (tcl.code_font!=NULL)
+	{
+          tcl.code->endFontClass();
+          tcl.code->writeLineNumber(0,0,0,tcl.code_line);
+	  tcl.code->startFontClass(tcl.code_font);
+	}
+	else
+	{
+          tcl.code->writeLineNumber(0,0,0,tcl.code_line);
+	}
       }
     }
     else
@@ -673,83 +706,6 @@ static void tcl_codify(const char *s,QCString str)
   free(tmp);
 }
 
-//! Print abort message.
-static void tcl_Abort(const char *format, ...)
-{
-  va_list myList;
-
-  fprintf(stderr,"=== Error in file %s line: %d, state: %d ===\n",tcl.file_name.data(),yylineno,YY_START);
-  va_start(myList, format);
-  vfprintf(stderr,format, myList);
-  va_end(myList);
-  fprintf(stderr,"\n===\n");
-   
-  EntryListIterator eli(*tcl.entry_main->children());
-  Entry *ce;
-  bool start=FALSE;
-
-  for (;(ce=eli.current());++eli)
-  {
-     if (ce == tcl.entry_file) start=TRUE;
-     if (start) ce->reset(); 
-  }
-}
-
-//! Print warning message.
-static void tcl_Warn(const char *format, ...)
-{
-  va_list myList;
-  FILE *fd=TCL_WARN_FD;
-
-  if (fd==NULL) return;
-  va_start(myList, format);
-  vfprintf(fd, format, myList);
-  fputc('\n',fd);
-  va_end(myList);
-}
-
-//! Print debug message.
-static void tcl_Debug(const char *format, ...)
-{
-  va_list myList;
-  FILE *fd=TCL_DEBUG_FD;
-
-  if (fd==NULL) return;
-  va_start(myList, format);
-  vfprintf(fd, format, myList);
-  fputc('\n',fd);
-  va_end(myList);
-}
-/*
-//! Print debug message.
-static void tcl_Debug(const tcl_scan *s,const char *format, ...)
-{
-  va_list myList;
-  FILE *fd=TCL_DEBUG_FD;
-
-  if (fd==NULL) return;
-  va_start(myList, format);
-  vfprintf(fd, format, myList);
-  va_end(myList);
-  fprintf(fd, ": tcl_scan[%d,%d] stack=%d type=%d name='%s'\n",
-	s->line0,s->line1,s->start_stack_ptr,s->type,s->entry_ns->name.data());
-}
-
-//! Print debug message.
-static void tcl_Debug(const Entry *e,const char *format, ...)
-{
-  va_list myList;
-  FILE *fd=TCL_DEBUG_FD;
-
-  if (fd==NULL) return;
-  va_start(myList, format);
-  vfprintf(fd, format, myList);
-  va_end(myList);
-  fprintf(fd,": Entry '%s' type=%s, section=0x%x file=%s (%d children)\n",
-    (const char*)e->name, (const char*)e->type, e->section,
-    (const char*)e->fileName, e->children()->count());
-}
-*/
 //-----------------------------------------------------------------------------
 #undef	YY_INPUT
 #define	YY_INPUT(buf,result,max_size) result=yyread(buf,max_size);
@@ -785,7 +741,7 @@ D
   if (tcl.scan.count()<1)
   {// error
 D
-    tcl_abort("stack empty");
+    tcl_err("Tcl parser stack empty! Parser error in file '%s'.\n",tcl.file_name.data());
     yyterminate();
   }
   else if (tcl.scan.count()==1)
@@ -843,6 +799,48 @@ D
   yyless(7);
   yy_push_state(COMMENT_CODE);
 }
+<COMMENT>"#"[@\\]"verbatim"\n[ \t]*[^#] {
+D
+  QString t=yytext;
+  tcl_codify("comment",t.left(11));
+  tcl_comment(2,"\n@verbatim\n");
+  yyless(11);
+  yy_push_state(COMMENT_VERB);
+}
+<COMMENT>"#".*\\\n {
+D
+  tcl_codify("comment",yytext);
+  QString t=yytext;
+  t = t.mid(1,t.length()-3);
+  t.append('\n');
+  tcl_comment(2,t.ascii());
+  yy_push_state(COMMENT_NL);
+}
+<COMMENT>"#".*\n {
+D
+  tcl_codify("comment",yytext);
+  tcl_comment(2,yytext+1);
+}
+<COMMENT>"#".*\x1A {
+D
+  QString t=yytext;
+  t = t.mid(0,t.length()-1);
+  tcl_codify("comment",t.ascii());
+  t = t.mid(1,t.length());
+  tcl_comment(-2,t.ascii());
+  unput(0x1A);
+}
+<COMMENT>\x1A {
+D
+  tcl_comment(-2,"");
+  unput(0x1A);
+}
+<COMMENT>.|\n {
+D
+  tcl_comment(-2,yytext);
+  yyless(0);
+}
+
 <COMMENT_CODE>"#"[@\\]"endcode"\n {
 D
   QString t=yytext;
@@ -856,14 +854,12 @@ D
 D
   yymore();
 }
-<COMMENT>"#"[@\\]"verbatim"\n[ \t]*[^#] {
+<COMMENT_CODE>.*\x1A {
 D
-  QString t=yytext;
-  tcl_codify("comment",t.left(11));
-  tcl_comment(2,"\n@verbatim\n");
-  yyless(11);
-  yy_push_state(COMMENT_VERB);
+  yy_pop_state();
+  yyless(0);
 }
+
 <COMMENT_VERB>"#"[@\\]"endverbatim"\n {
 D
   QString t=yytext;
@@ -877,15 +873,12 @@ D
 D
   yymore();
 }
-<COMMENT>"#".*\\\n {
+<COMMENT_VERB>.*\x1A {
 D
-  tcl_codify("comment",yytext);
-  QString t=yytext;
-  t = t.mid(1,t.length()-3);
-  t.append('\n');
-  tcl_comment(2,t.ascii());
-  yy_push_state(COMMENT_NL);
+  yy_pop_state();
+  yyless(0);
 }
+
 <COMMENT_NL>.*\\\n {
 D
   tcl_codify("comment",yytext);
@@ -897,30 +890,17 @@ D
   tcl_comment(2,yytext);
   yy_pop_state();
 }
-<COMMENT>"#".*\x1A {
+<COMMENT_NL>.*\x1A {
 D
-  QString t=yytext;
-  t = t.mid(0,t.length()-1);
-  tcl_codify("comment",t.ascii());
-  t = t.mid(1,t.length());
-  tcl_comment(-2,t.ascii());
-  unput(0x1A);
-}
-<COMMENT>"#".*\n {
-D
-  tcl_codify("comment",yytext);
-  tcl_comment(2,yytext+1);
-}
-<COMMENT>\x1A {
-D
-  tcl_comment(-2,yytext);
+  yy_pop_state();
+  yyless(0);
 }
-<COMMENT>.|\n {
+
+<COMMENTLINE>.*\x1A {
 D
+  yy_pop_state();
   yyless(0);
-  tcl_comment(-2,yytext);
 }
-
 <COMMENTLINE>[ \t]* {
 D
   tcl.string_commentcodify += yytext;
@@ -939,6 +919,21 @@ D
   tcl.string_commentcodify += yytext;
   tcl.string_commentline += (yytext+2);
 }
+<COMMENTLINE>.|\n {
+D
+  yy_pop_state();
+  if (tcl.string_commentline.length())
+  {
+    tcl.entry_current->brief = tcl.string_commentline;
+    tcl.entry_current->briefLine = tcl.line_commentline;
+    tcl.entry_current->briefFile = tcl.file_name;
+  }
+  yyless(0);
+  tcl_command(-1,tcl.string_commentcodify.ascii());
+  tcl.string_commentline="";
+  tcl.string_commentcodify="";
+}
+
 <COMMENTLINE_NL>.*\\\n {
 D
   tcl.string_commentcodify += yytext;
@@ -962,20 +957,6 @@ D
   yy_pop_state();
   unput(0x1A);
 }
-<COMMENTLINE>.|\n {
-D
-  yy_pop_state();
-  if (tcl.string_commentline.length())
-  {
-    tcl.entry_current->brief = tcl.string_commentline;
-    tcl.entry_current->briefLine = tcl.line_commentline;
-    tcl.entry_current->briefFile = tcl.file_name;
-  }
-  yyless(0);
-  tcl_command(-1,tcl.string_commentcodify.ascii());
-  tcl.string_commentline="";
-  tcl.string_commentcodify="";
-}
 
 <COMMAND>{ws}*[\;]{ws}*"#<" {
 D
@@ -1069,15 +1050,14 @@ D
 
 //! Start new scan context for given 'content'.
 // @return created new scan context.
-tcl_scan *tcl_scan_start(int type, QString content, const char *after)
+static void tcl_scan_start(int type, QString content, const char *after, QString ns, Entry *entry_cl, Entry *entry_fn)
 {
-  tcl_scan *myScan;
+  tcl_scan *myScan=tcl.scan.at(0);
   QString myName;
   char c[2]=" ";
+tcl_inf("line=%d type=%d '%s'\n",tcl.line_body0,type,content.ascii());
 
-  myScan=tcl.scan.at(0);
   myScan->line1=yylineno;
-  myScan->start_stack_ptr=yy_start_stack_ptr;
   yy_push_state(TOP);
 
   myScan=new tcl_scan;
@@ -1087,50 +1067,43 @@ tcl_scan *tcl_scan_start(int type, QString content, const char *after)
   switch (myScan->type)
   {
     case QUOTE: c[0]='"';
-tcl_debug("+++\" %d\n?%s?",tcl.line_body0,content.ascii());
       break;
     case BRACE: c[0]='{';
-tcl_debug("+++{ %d\n?%s?",tcl.line_body0,content.ascii());
       break;
     case BRACKET: c[0]='[';
-tcl_debug("+++[ %d\n?%s?",tcl.line_body0,content.ascii());
       break;
     default:
-tcl_debug("+++. %d\n?%s?",tcl.line_body0,content.ascii());
       break;
   }
   if (c[0]!=' ')
   {
     tcl_codify(NULL,c);
     content = content.mid(1,content.length()-2);
-    content += (char)0x1A;// for detection end of scan context
-tcl_debug("???%s?",content.ascii());
   }
-  myScan->entry_ns = tcl.scan.at(0)->entry_ns;
-  myScan->entry_cl = tcl.scan.at(0)->entry_cl;
-  myScan->entry_fn = tcl.scan.at(0)->entry_fn;
+  content += (char)0x1A;// for detection end of scan context
+  myScan->ns = ns;
+  myScan->entry_cl = entry_cl;
+  myScan->entry_fn = entry_fn;
   myScan->entry_scan = tcl.entry_current;
   myScan->buffer_state=yy_scan_string(content.ascii());
   myScan->line0=tcl.line_body0;
   myScan->line1=tcl.line_body1;
   yylineno=myScan->line0;
-  myScan->start_stack_ptr=yy_start_stack_ptr;
   myScan->protection = tcl.protection;
 
   tcl.entry_inside = myScan->entry_scan;
   tcl.entry_current = tcl_entry_new();
   tcl.scan.insert(0,myScan);
   yy_switch_to_buffer(myScan->buffer_state);
-  return (myScan);
 }
 
 //! Close current scan context.
 static void tcl_scan_end()
 {
-  tcl_scan *myScan;
+  tcl_scan *myScan=tcl.scan.at(0);
   char c[2]=" ";
+tcl_inf("line=%d\n",myScan->line1);
 
-  myScan=tcl.scan.at(0);
   switch (myScan->type)
   {
     case QUOTE: c[0]='"'; break;
@@ -1138,13 +1111,15 @@ static void tcl_scan_end()
     case BRACKET: c[0]=']'; break;
   }
   if (c[0]!=' ') {tcl_codify(NULL,c);}
-  if (myScan->string_after.length()) {tcl_codify("comment",myScan->string_after);}
+  if (myScan->string_after.length())
+  {
+    tcl_codify("comment",myScan->string_after);
+  }
   yy_delete_buffer(myScan->buffer_state);
   tcl.scan.removeFirst();
   yy_pop_state();
   myScan=tcl.scan.at(0);
   tcl.entry_inside = myScan->entry_scan;
-tcl_debug("---%d",myScan->line1);
   yy_switch_to_buffer(myScan->buffer_state);
   yylineno=myScan->line1;
   tcl.protection = myScan->protection;
@@ -1176,7 +1151,7 @@ static void tcl_word(int what,const char *text)
   case 1:// all other chars
     if (myWhite)
     {// {x}y "x"y
-      tcl_abort("expected word separator: %s",text);
+      tcl_err("expected word separator: %s\n",text);
       return;
     }
     if (myLevel==0)
@@ -1192,7 +1167,7 @@ static void tcl_word(int what,const char *text)
       myWord=' ';
       yy_pop_state();
       yyless(0);
-tcl_debug("(\\\n) ?%s?",tcl.string_last.ascii());
+tcl_inf("(\\\n) ?%s?\n",tcl.string_last.ascii());
       return;
     }
     switch (myList[myLevel-1])
@@ -1207,7 +1182,7 @@ tcl_debug("(\\\n) ?%s?",tcl.string_last.ascii());
           myWord=' ';
           yy_pop_state();
           yyless(0);
-tcl_debug("(\\\n) ?%s?",tcl.string_last.ascii());
+tcl_inf("(\\\n) ?%s?\n",tcl.string_last.ascii());
           return;
         }
       break;
@@ -1217,7 +1192,7 @@ tcl_debug("(\\\n) ?%s?",tcl.string_last.ascii());
   case 3:// {
     if (myWhite)
     {// {x}{ "x"{
-      tcl_abort("expected word separator: %s",text);
+      tcl_err("expected word separator: %s\n",text);
       return;
     }
     switch (myList[myLevel-1])
@@ -1235,14 +1210,17 @@ tcl_debug("(\\\n) ?%s?",tcl.string_last.ascii());
   case 4:// }
     if (myWhite)
     {// {x}{ "x"{
-      tcl_abort("expected word separator: %s",text);
+      tcl_err("expected word separator: %s\n",text);
       return;
     }
     switch (myList[myLevel-1])
     {
       case '{':// {{x}}
         myLevel--;
-        if (myLevel==0) {myWhite=1;}
+        if (myLevel==0 && tcl.code==NULL) 
+	{
+          myWhite=1;
+        }
       break;
       case '[':
       case '"':
@@ -1253,7 +1231,7 @@ tcl_debug("(\\\n) ?%s?",tcl.string_last.ascii());
   case 5:// [
     if (myWhite)
     {// {x}[
-      tcl_abort("expected word separator: %s",text);
+      tcl_err("expected word separator: %s\n",text);
       return;
     }
     switch (myList[myLevel-1])
@@ -1271,7 +1249,7 @@ tcl_debug("(\\\n) ?%s?",tcl.string_last.ascii());
   case 6:// ]
     if (myWhite)
     {// {x}]
-      tcl_abort("expected word separator: %s",text);
+      tcl_err("expected word separator: %s\n",text);
       return;
     }
     switch (myList[myLevel-1])
@@ -1290,7 +1268,7 @@ tcl_debug("(\\\n) ?%s?",tcl.string_last.ascii());
   case 7:// "
     if (myWhite)
     {// {x}"
-      tcl_abort("expected word separator: %s",text);
+      tcl_err("expected word separator: %s\n",text);
       return;
     }
     switch (myList[myLevel-1])
@@ -1310,13 +1288,12 @@ tcl_debug("(\\\n) ?%s?",tcl.string_last.ascii());
   case 9:// \t
   case 10:// ;
   case 11:// \n
-  case 12:// \x1A
     if (myLevel==0)
     {
       myWord=' ';
       yy_pop_state();
       yyless(0);
-tcl_debug("(%d) ?%s?",what,tcl.string_last.ascii());
+tcl_inf("(%d) ?%s?\n",what,tcl.string_last.ascii());
       return;
     }
     switch (myList[myLevel-1])
@@ -1331,7 +1308,7 @@ tcl_debug("(%d) ?%s?",what,tcl.string_last.ascii());
           myWord=' ';
           yy_pop_state();
           yyless(0);
-tcl_debug("(.%d) ?%s?",what,tcl.string_last.ascii());
+tcl_inf("(.%d) ?%s?\n",what,tcl.string_last.ascii());
           return;
 	}
         else
@@ -1342,8 +1319,28 @@ tcl_debug("(.%d) ?%s?",what,tcl.string_last.ascii());
     }
     myWhite=0;
   break;
+  case 12:// \x1A
+    if (myLevel==0)
+    {
+      myWord=' ';
+      yy_pop_state();
+      yyless(0);
+tcl_inf("(%d) ?%s?\n",what,tcl.string_last.ascii());
+      return;
+    }
+    if (myLevel!=1 || myList[0] != '.')
+    {
+      tcl_war("level=%d expected=%c\n",myLevel,myList[myLevel-1]);
+    }
+    myWord=' ';
+    yy_pop_state();
+    yyless(0);
+tcl_inf("(.%d) ?%s?\n",what,tcl.string_last.ascii());
+    return;
+    myWhite=0;
+  break;
   default:
-    tcl_abort("wrong state: %d",what);
+    tcl_err("wrong state: %d\n",what);
     return;
   }
   tcl.string_last += text;
@@ -1356,11 +1353,11 @@ static void tcl_comment(int what,const char *text)
   { // begin of comment
     if (tcl.comment)
     {
-      tcl_abort("comment in comment");
+      tcl_err("comment in comment\n");
       return;
     }
     yy_push_state(COMMENT);
-tcl_debug("+++%s",text);
+tcl_inf("<- %s\n",text);
     tcl.string_comment="";
     tcl.comment=0;
   }
@@ -1390,7 +1387,7 @@ tcl_debug("+++%s",text);
     else
     {
       tcl.string_last = "";
-tcl_debug("---%s",(const char *)tcl.string_comment);
+tcl_inf("-> %s\n",(const char *)tcl.string_comment);
     }
     yy_pop_state();
     tcl.string_comment="";
@@ -1400,7 +1397,7 @@ tcl_debug("---%s",(const char *)tcl.string_comment);
   { // 98=new 99=inbody
     if (tcl.this_parser && tcl.string_comment.length())
     {
-tcl_debug("---%s",(const char *)tcl.string_comment);
+tcl_inf("-> %s\n",(const char *)tcl.string_comment);
       int myPos=0;
       bool myNew=0;
       int myLine=tcl.line_comment;
@@ -1418,13 +1415,13 @@ tcl_debug("---%s",(const char *)tcl.string_comment);
       myO.addChar('\0');
       QCString myDoc = myO.data();
       if (what==99)
-      { // inbody comment file or namespace or class or proc/metho
+      { // inbody comment file or namespace or class or proc/method
         int myPos0;
         int myLine0;
         Entry myEntry0; // used to test parsing
         Entry *myEntry;
 
-        Entry *myEntry1=tcl.scan.at(0)->entry_ns;
+        Entry *myEntry1=NULL;
         if (tcl.scan.at(0)->entry_fn)
         {
           myEntry1=tcl.scan.at(0)->entry_fn;
@@ -1449,6 +1446,10 @@ tcl_debug("---%s",(const char *)tcl.string_comment);
           }
           else
           { // we can add to current entry in this case
+            if (myEntry1==NULL)
+            {
+              myEntry1=tcl_entry_namespace(tcl.scan.at(0)->ns);
+            }
             parseCommentBlock(tcl.this_parser, myEntry1, myDoc, tcl.file_name,
 	      myLine0, FALSE, tcl.config_autobrief, FALSE, myProt, myPos0, myNew);
           }
@@ -1465,6 +1466,10 @@ tcl_debug("---%s",(const char *)tcl.string_comment);
         }
         else
         { // we can add to current entry
+          if (myEntry1==NULL)
+          {
+            myEntry1=tcl_entry_namespace(tcl.scan.at(0)->ns);
+          }
           parseCommentBlock(tcl.this_parser, myEntry1, myDoc, tcl.file_name,
 	    myLine0, FALSE, tcl.config_autobrief, FALSE, myProt, myPos0, myNew);
         }
@@ -1506,7 +1511,7 @@ tcl_debug("---%s",(const char *)tcl.string_comment);
   }
   else
   {
-    tcl_abort("what %d",what);
+    tcl_err("what %d\n",what);
     return;
   }
 }
@@ -1514,6 +1519,7 @@ tcl_debug("---%s",(const char *)tcl.string_comment);
 //! Parse given \c arglist .
 static void tcl_command_ARGLIST(QString &arglist)
 {
+D
   Argument *myArg;
   QStringList myArgs;
   QString myArglist="";
@@ -1550,18 +1556,122 @@ static void tcl_command_ARGLIST(QString &arglist)
   tcl.entry_current->args = arglist;
 }
 
+//! Create link.
+static void tcl_codify_link(const char *name)
+{
+  if (tcl.code == NULL || name == NULL) return;
+  static int init=0;
+  static QDict<MemberDef> fn;
+  if (init==0) 
+  {
+    init=1;
+    MemberNameSDict::Iterator mni(*Doxygen::memberNameSDict);
+    MemberNameSDict::Iterator fni(*Doxygen::functionNameSDict);
+    MemberName *mn=0;
+    MemberDef *md;
+    for (mni.toFirst();(mn=mni.current());++mni) 
+    {
+      MemberNameIterator mi(*mn);
+      for (mi.toFirst();(md=mi.current());++mi) 
+      {
+	fn.insert(md->qualifiedName(),md);
+      }
+    }
+    for (fni.toFirst();(mn=fni.current());++fni) 
+    {
+      MemberNameIterator fi(*mn);
+      for (fi.toFirst();(md=fi.current());++fi) 
+      {
+	fn.insert(md->qualifiedName(),md);
+      }
+    }
+  }
+  MemberDef *myDef;
+  QString myName=name; 
+
+  if (strncmp(name,"::",2)==0) // fully qualified global command
+  {
+    myName = myName.mid(2);
+    myDef = fn.find(myName);
+  }
+  else // not qualified name
+  {
+    myDef = NULL;
+    myName = tcl.scan.at(0)->ns;
+    myName = myName + "::" + myName;
+    myDef = fn.find(myName); // search namespace command
+    if (myDef == NULL)
+    {
+      myDef = fn.find(name); // search global command
+    }
+  }
+  if (myDef != NULL) // documented command
+  {
+    tcl.code->writeCodeLink(myDef->getReference().data(),
+		myDef->getOutputFileBase().data(),
+		myDef->anchor().data(),
+		name,
+		myDef->qualifiedName().data());
+    if (tcl.memberdef)
+    {
+	myDef->addSourceReferencedBy(tcl.memberdef);
+	tcl.memberdef->addSourceReferences(myDef);
+    }
+  }
+  else if (tcl_keyword(myName)) // check keyword
+  {
+    tcl_codify("keyword",name);
+  }
+  else
+  {
+    tcl_codify(NULL,name); // something else
+  }
+  
+}
 //! Handle all other commands.
+// Create links of first command word or first command word inside [].
 static void tcl_command_OTHER(const char *text)
 {
-  for (unsigned int i=0; i< tcl.list_command.count(); i++)
+  if (tcl.code == NULL) return;
+D
+  QCString myName; 
+
+  for (unsigned int i=0; i< tcl.list_commandwords.count(); i++)
   {
-    if (i==0 && tcl_keyword(*tcl.list_command.at(i)))
+    myName = *tcl.list_commandwords.at(i);
+    if (i==0)
     {
-      tcl_codify("keyword",*tcl.list_command.at(i));
+      tcl_codify_link(myName.data());
     }
-    else
+    else //TODO check on [... inside current string
     {
-      tcl_codify(NULL,*tcl.list_command.at(i));
+      QCString myStr="";
+      int myCmd=0;
+      for (unsigned int i=0;i<myName.length();i++)
+      {
+        char c = myName[i];
+	if (myCmd) 
+	{
+	  if (c==' '||c=='\t'||c=='\n'||c==']') 
+	  {//end of command
+	    tcl_codify_link(myStr.data());
+	    myStr="";
+	    myCmd=0;
+	  }
+	  myStr+=c;
+	} 
+	else 
+	{
+	  myStr+=c;
+	  if (c=='[') 
+	  {//start of command
+            tcl_codify(NULL,myStr);
+	    myStr="";
+	    myCmd=1;
+	  }
+	}
+      }
+      tcl_codify(NULL,myStr);
     }
   }
   tcl_codify(NULL,text);
@@ -1570,25 +1680,27 @@ static void tcl_command_OTHER(const char *text)
 //! Handle \c proc statements.
 static void tcl_command_PROC(const char *text)
 {
+D
   QString myNs, myName;
   Entry *myEntryNs, *myEntry;
   tcl_scan *myScan = tcl.scan.at(0);
 
-  tcl_codify("keyword",*tcl.list_command.at(0));
-  tcl_codify(NULL,*tcl.list_command.at(1));
-  tcl_codify(NULL,*tcl.list_command.at(2));
-  tcl_codify(NULL,*tcl.list_command.at(3));
-  tcl_codify(NULL,*tcl.list_command.at(4));
-  tcl_codify(NULL,*tcl.list_command.at(5));
-  tcl_name(myScan->entry_ns->name,*tcl.list_command.at(2),myNs,myName);
+  tcl_codify("keyword",*tcl.list_commandwords.at(0));
+  tcl_codify(NULL,*tcl.list_commandwords.at(1));
+  tcl_codify(NULL,*tcl.list_commandwords.at(2));
+  tcl_codify(NULL,*tcl.list_commandwords.at(3));
+  tcl_codify(NULL,*tcl.list_commandwords.at(4));
+  tcl_codify(NULL,*tcl.list_commandwords.at(5));
+  tcl_name(myScan->ns,*tcl.list_commandwords.at(2),myNs,myName);
   if (myNs.length())
   {
     myEntryNs = tcl_entry_namespace(myNs);
   }
   else
   {
-    myEntryNs = myScan->entry_ns;
+    myEntryNs = tcl_entry_namespace(myScan->ns);
   }
+  //why not needed here? tcl.fn.remove(myName);
   tcl.entry_current->section = Entry::FUNCTION_SEC;
   tcl.entry_current->mtype = Method;
   tcl.entry_current->name = myName;
@@ -1596,116 +1708,41 @@ static void tcl_command_PROC(const char *text)
   tcl.entry_current->bodyLine = tcl.line_body0;
   tcl.entry_current->endBodyLine = tcl.line_body1;
   tcl_protection(tcl.entry_current);
-  tcl_command_ARGLIST(*tcl.list_command.at(4));
+  tcl_command_ARGLIST(*tcl.list_commandwords.at(4));
   myEntryNs->addSubEntry(tcl.entry_current);
   myEntry = tcl.entry_current;
   tcl.fn.insert(myName,myEntry);
-  myScan = tcl_scan_start(tcl.word_is,*tcl.list_command.at(6),text);
-  myScan->entry_ns = myEntryNs;
-  myScan->entry_cl = NULL;
-  myScan->entry_fn = myEntry;
+  tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(6),text,
+	myEntryNs->name,NULL,myEntry);
 }
 
-//! Handle \c itcl::body statements.
-static void tcl_command_ITCL_BODY(const char *text)
-{
-  QString myNs, myName;
-  Entry *myEntryNs, *myEntryCl, *myEntry;
-  tcl_scan *myScan = tcl.scan.at(0);
-
-  tcl_codify("keyword",*tcl.list_command.at(0));
-  tcl_codify(NULL,*tcl.list_command.at(1));
-  tcl_codify(NULL,*tcl.list_command.at(2));
-  tcl_codify(NULL,*tcl.list_command.at(3));
-  tcl_codify(NULL,*tcl.list_command.at(4));
-  tcl_codify(NULL,*tcl.list_command.at(5));
-  tcl_name(myScan->entry_ns->name,*tcl.list_command.at(2),myNs,myName);
-  if (myNs.length())
-  {
-    myEntryNs = tcl_entry_namespace(myNs);
-    myEntryCl = tcl_entry_class(myNs);
-  }
-  else
-  {
-    myEntryNs = myScan->entry_ns;
-    myEntryCl = myScan->entry_cl;
-  }
-  tcl_command_ARGLIST(*tcl.list_command.at(4));
-  myEntry = tcl.fn.find(myName);
-  if (myEntry != NULL)
-  {
-    tcl.entry_current->section = Entry::EMPTY_SEC;
-    if (myEntry->args.isEmpty())
-    {
-      myEntry->args = tcl.entry_current->args;
-      myEntry->argList = tcl.entry_current->argList;
-    }
-    if (myEntry->brief.isEmpty())
-    {
-      myEntry->brief = tcl.entry_current->brief;
-      myEntry->briefFile = tcl.entry_current->briefFile;
-      myEntry->briefLine = tcl.entry_current->briefLine;
-    }
-    else if (!tcl.entry_current->brief.isEmpty())
-    {
-      myEntry->doc.append("\n<p>\n");
-      myEntry->doc.append(tcl.entry_current->brief);
-    }
-    if (myEntry->doc.isEmpty())
-    {
-      myEntry->doc = tcl.entry_current->doc;
-      myEntry->docFile = tcl.entry_current->docFile;
-      myEntry->docLine = tcl.entry_current->docLine;
-    }
-    else if (!tcl.entry_current->doc.isEmpty())
-    {
-      myEntry->doc.append("\n<p>\n");
-      myEntry->doc.append(tcl.entry_current->doc);
-    }
-    myEntry->bodyLine = tcl.line_body0;
-    myEntry->endBodyLine = tcl.line_body1;
-  } else {// should not happen, may be ignore?
-    tcl.entry_current->section = Entry::FUNCTION_SEC;
-    tcl.entry_current->mtype = Method;
-    tcl.entry_current->name = myName;
-    tcl.entry_current->startLine = tcl.line_command;
-    tcl.entry_current->bodyLine = tcl.line_body0;
-    tcl.entry_current->endBodyLine = tcl.line_body1;
-    tcl_protection(tcl.entry_current);
-    tcl.fn.insert(myName,tcl.entry_current);
-    myEntryCl->addSubEntry(tcl.entry_current);
-    myEntry = tcl.entry_current;
-  }
-  myScan = tcl_scan_start(tcl.word_is,*tcl.list_command.at(6),text);
-  myScan->entry_ns = myEntryNs;
-  myScan->entry_cl = myEntryCl;
-  myScan->entry_fn = myEntry;
-}
-
-//! Handle \c oo::define method and method inside \c itcl::class statements.
+//! Handle \c itcl::body statements and \c oo::define method and method inside \c itcl::class statements.
 static void tcl_command_METHOD(const char *text)
 {
+D
   QString myNs, myName;
-  Entry *myEntryNs, *myEntryCl, *myEntry;
+  Entry *myEntryCl, *myEntry;
   tcl_scan *myScan = tcl.scan.at(0);
 
-  tcl_codify("keyword",*tcl.list_command.at(0));
-  tcl_codify(NULL,*tcl.list_command.at(1));
-  tcl_codify(NULL,*tcl.list_command.at(2));
-  tcl_codify(NULL,*tcl.list_command.at(3));
-  tcl_codify(NULL,*tcl.list_command.at(4));
-  tcl_codify(NULL,*tcl.list_command.at(5));
-  tcl_name(myScan->entry_ns->name,*tcl.list_command.at(2),myNs,myName);
+  tcl_codify("keyword",*tcl.list_commandwords.at(0));
+  tcl_codify(NULL,*tcl.list_commandwords.at(1));
+  tcl_codify(NULL,*tcl.list_commandwords.at(2));
+  tcl_codify(NULL,*tcl.list_commandwords.at(3));
+  tcl_codify(NULL,*tcl.list_commandwords.at(4));
+  tcl_codify(NULL,*tcl.list_commandwords.at(5));
+  tcl_name(myScan->ns,*tcl.list_commandwords.at(2),myNs,myName);
   if (myNs.length())
   {
-    myEntryNs = tcl_entry_namespace(myNs);
     myEntryCl = tcl_entry_class(myNs);
   }
   else
   {
-    myEntryNs = myScan->entry_ns;
+    myNs = myScan->ns;
     myEntryCl = myScan->entry_cl;
   }
+  // needed in case of more then one definition p.e. itcl::method and itcl::body
+  // see also bug #
+  tcl.fn.remove(myName);
   tcl.entry_current->section = Entry::FUNCTION_SEC;
   tcl.entry_current->mtype = Method;
   tcl.entry_current->name = myName;
@@ -1713,36 +1750,34 @@ static void tcl_command_METHOD(const char *text)
   tcl.entry_current->bodyLine = tcl.line_body0;
   tcl.entry_current->endBodyLine = tcl.line_body1;
   tcl_protection(tcl.entry_current);
-  tcl_command_ARGLIST(*tcl.list_command.at(4));
+  tcl_command_ARGLIST(*tcl.list_commandwords.at(4));
   myEntryCl->addSubEntry(tcl.entry_current);
   tcl.fn.insert(myName,tcl.entry_current);
   myEntry = tcl.entry_current;
-  myScan = tcl_scan_start(tcl.word_is,*tcl.list_command.at(6),text);
-  myScan->entry_ns = myEntryNs;
-  myScan->entry_cl = myEntryCl;
-  myScan->entry_fn = myEntry;
+  tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(6),text,
+	myNs, myEntryCl, myEntry);
 }
 
 //! Handle \c constructor statements inside class definitions.
 static void tcl_command_CONSTRUCTOR(const char *text)
 {
+D
   QString myNs, myName;
-  Entry *myEntryNs, *myEntryCl, *myEntry;
+  Entry *myEntryCl, *myEntry;
   tcl_scan *myScan = tcl.scan.at(0);
 
-  tcl_codify("keyword",*tcl.list_command.at(0));
-  tcl_codify(NULL,*tcl.list_command.at(1));
-  tcl_codify(NULL,*tcl.list_command.at(2));
-  tcl_codify(NULL,*tcl.list_command.at(3));
-  tcl_name(myScan->entry_ns->name,*tcl.list_command.at(0),myNs,myName);
+  tcl_codify("keyword",*tcl.list_commandwords.at(0));
+  tcl_codify(NULL,*tcl.list_commandwords.at(1));
+  tcl_codify(NULL,*tcl.list_commandwords.at(2));
+  tcl_codify(NULL,*tcl.list_commandwords.at(3));
+  tcl_name(myScan->ns,*tcl.list_commandwords.at(0),myNs,myName);
   if (myNs.length())
   {
-    myEntryNs = tcl_entry_namespace(myNs);
     myEntryCl = tcl_entry_class(myNs);
   }
   else
   {
-    myEntryNs = myScan->entry_ns;
+    myNs = myScan->ns;
     myEntryCl = myScan->entry_cl;
   }
   tcl.entry_current->section = Entry::FUNCTION_SEC;
@@ -1752,34 +1787,32 @@ static void tcl_command_CONSTRUCTOR(const char *text)
   tcl.entry_current->bodyLine = tcl.line_body0;
   tcl.entry_current->endBodyLine = tcl.line_body1;
   tcl_protection(tcl.entry_current);
-  tcl_command_ARGLIST(*tcl.list_command.at(2));
+  tcl_command_ARGLIST(*tcl.list_commandwords.at(2));
   myEntryCl->addSubEntry(tcl.entry_current);
   myEntry = tcl.entry_current;
   tcl.fn.insert(myName,myEntry);
-  myScan = tcl_scan_start(tcl.word_is,*tcl.list_command.at(4),text);
-  myScan->entry_ns = myEntryNs;
-  myScan->entry_cl = myEntryCl;
-  myScan->entry_fn = myEntry;
+  tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(4),text,
+	myNs, myEntryCl, myEntry);
 }
 
 //! Handle \c destructor statements inside class definitions.
 static void tcl_command_DESTRUCTOR(const char *text)
 {
+D
   QString myNs, myName;
-  Entry *myEntryNs, *myEntryCl, *myEntry;
+  Entry *myEntryCl, *myEntry;
   tcl_scan *myScan = tcl.scan.at(0);
 
-  tcl_codify("keyword",*tcl.list_command.at(0));
-  tcl_codify(NULL,*tcl.list_command.at(1));
-  tcl_name(myScan->entry_ns->name,*tcl.list_command.at(0),myNs,myName);
+  tcl_codify("keyword",*tcl.list_commandwords.at(0));
+  tcl_codify(NULL,*tcl.list_commandwords.at(1));
+  tcl_name(myScan->ns,*tcl.list_commandwords.at(0),myNs,myName);
   if (myNs.length())
   {
-    myEntryNs = tcl_entry_namespace(myNs);
     myEntryCl = tcl_entry_class(myNs);
   }
   else
   {
-    myEntryNs = myScan->entry_ns;
+    myNs = myScan->ns;
     myEntryCl = myScan->entry_cl;
   }
   tcl.entry_current->section = Entry::FUNCTION_SEC;
@@ -1792,26 +1825,25 @@ static void tcl_command_DESTRUCTOR(const char *text)
   myEntryCl->addSubEntry(tcl.entry_current);
   myEntry = tcl.entry_current;
   tcl.fn.insert(myName,myEntry);
-  myScan = tcl_scan_start(tcl.word_is,*tcl.list_command.at(2),text);
-  myScan->entry_ns = myEntryNs;
-  myScan->entry_cl = myEntryCl;
-  myScan->entry_fn = myEntry;
+  tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(2),text,
+	myNs, myEntryCl, myEntry);
 }
 
 //! Handle \c namespace statements.
 static void tcl_command_NAMESPACE(const char *text)
 {
+D
   QString myNs, myName, myStr;
   Entry *myEntryNs=NULL;
   tcl_scan *myScan = tcl.scan.at(0);
 
-  tcl_codify("keyword",*tcl.list_command.at(0));
-  tcl_codify(NULL,*tcl.list_command.at(1));
-  tcl_codify("keyword",*tcl.list_command.at(2));
-  tcl_codify(NULL,*tcl.list_command.at(3));
-  tcl_codify(NULL,*tcl.list_command.at(4));
-  tcl_codify(NULL,*tcl.list_command.at(5));
-  tcl_name(myScan->entry_ns->name,*tcl.list_command.at(4),myNs,myName);
+  tcl_codify("keyword",*tcl.list_commandwords.at(0));
+  tcl_codify(NULL,*tcl.list_commandwords.at(1));
+  tcl_codify("keyword",*tcl.list_commandwords.at(2));
+  tcl_codify(NULL,*tcl.list_commandwords.at(3));
+  tcl_codify(NULL,*tcl.list_commandwords.at(4));
+  tcl_codify(NULL,*tcl.list_commandwords.at(5));
+  tcl_name(myScan->ns,*tcl.list_commandwords.at(4),myNs,myName);
   if (myNs.length())
   {
     myName = myNs+"::"+myName;
@@ -1824,33 +1856,31 @@ static void tcl_command_NAMESPACE(const char *text)
   tcl.entry_main->addSubEntry(tcl.entry_current);
   tcl.ns.insert(myName,tcl.entry_current);
   myEntryNs = tcl.entry_current;
-  myStr = *tcl.list_command.at(6);
-  if (tcl.list_command.count() > 7)
+  myStr = *tcl.list_commandwords.at(6);
+  if (tcl.list_commandwords.count() > 7)
   {
-    for (uint i=7;i<tcl.list_command.count();i++)
+    for (uint i=7;i<tcl.list_commandwords.count();i++)
     {
-      myStr.append(*tcl.list_command.at(i));
+      myStr.append(*tcl.list_commandwords.at(i));
     }
     tcl.word_is=STRING;
   }
-  myScan = tcl_scan_start(tcl.word_is,myStr,text);
-  myScan->entry_ns = myEntryNs;
-  myScan->entry_cl = NULL;
-  myScan->entry_fn = NULL;
+  tcl_scan_start(tcl.word_is,myStr,text, myName, NULL, NULL);
 }
 
 //! Handle \c itcl::class statements.
 static void tcl_command_ITCL_CLASS(const char *text)
 {
+D
   QString myNs, myName, myStr;
-  Entry *myEntryNs, *myEntryCl;
+  Entry *myEntryCl;
   tcl_scan *myScan = tcl.scan.at(0);
 
-  tcl_codify("keyword",*tcl.list_command.at(0));
-  tcl_codify(NULL,*tcl.list_command.at(1));
-  tcl_codify("NULL",*tcl.list_command.at(2));
-  tcl_codify("NULL",*tcl.list_command.at(3));
-  tcl_name(myScan->entry_ns->name,*tcl.list_command.at(2),myNs,myName);
+  tcl_codify("keyword",*tcl.list_commandwords.at(0));
+  tcl_codify(NULL,*tcl.list_commandwords.at(1));
+  tcl_codify("NULL",*tcl.list_commandwords.at(2));
+  tcl_codify("NULL",*tcl.list_commandwords.at(3));
+  tcl_name(myScan->ns,*tcl.list_commandwords.at(2),myNs,myName);
   if (myNs.length())
   {
     myName = myNs+"::"+myName;
@@ -1861,29 +1891,27 @@ static void tcl_command_ITCL_CLASS(const char *text)
   tcl.entry_current->bodyLine = tcl.line_body0;
   tcl.entry_current->endBodyLine = tcl.line_body1;
   tcl.entry_main->addSubEntry(tcl.entry_current);
-  myEntryNs = tcl_entry_namespace(myName);
   tcl.cl.insert(myName,tcl.entry_current);
   myEntryCl = tcl.entry_current;
-  myScan = tcl_scan_start(tcl.word_is,*tcl.list_command.at(4),text);
-  myScan->entry_ns = myEntryNs;
-  myScan->entry_cl = myEntryCl;
-  myScan->entry_fn = NULL;
+  tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(4),text,
+	myName, myEntryCl, NULL);
 }
 
 //! Handle \c oo::class statements.
 static void tcl_command_OO_CLASS(const char *text)
 {
+D
   QString myNs, myName, myStr;
   Entry *myEntryNs, *myEntryCl;
   tcl_scan *myScan = tcl.scan.at(0);
 
-  tcl_codify("keyword",*tcl.list_command.at(0));
-  tcl_codify(NULL,*tcl.list_command.at(1));
-  tcl_codify("NULL",*tcl.list_command.at(2));
-  tcl_codify("NULL",*tcl.list_command.at(3));
-  tcl_codify("NULL",*tcl.list_command.at(4));
-  tcl_codify("NULL",*tcl.list_command.at(5));
-  tcl_name(myScan->entry_ns->name,*tcl.list_command.at(4),myNs,myName);
+  tcl_codify("keyword",*tcl.list_commandwords.at(0));
+  tcl_codify(NULL,*tcl.list_commandwords.at(1));
+  tcl_codify("NULL",*tcl.list_commandwords.at(2));
+  tcl_codify("NULL",*tcl.list_commandwords.at(3));
+  tcl_codify("NULL",*tcl.list_commandwords.at(4));
+  tcl_codify("NULL",*tcl.list_commandwords.at(5));
+  tcl_name(myScan->ns,*tcl.list_commandwords.at(4),myNs,myName);
   if (myNs.length())
   {
     myName = myNs+"::"+myName;
@@ -1897,58 +1925,54 @@ static void tcl_command_OO_CLASS(const char *text)
   myEntryNs = tcl_entry_namespace(myName);
   tcl.cl.insert(myName,tcl.entry_current);
   myEntryCl = tcl.entry_current;
-  myScan = tcl_scan_start(tcl.word_is,*tcl.list_command.at(6),text);
-  myScan->entry_ns = myEntryNs;
-  myScan->entry_cl = myEntryCl;
-  myScan->entry_fn = NULL;
+  tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(6),text,
+	myName, myEntryCl, NULL);
 }
 
 //! Handle \c oo::define statements.
 static void tcl_command_OO_DEFINE(const char *text)
 {
+D
   QString myNs, myName, myStr;
-  Entry *myEntryNs, *myEntryCl;
+  Entry *myEntryCl;
   tcl_scan *myScan = tcl.scan.at(0);
 
-  tcl_codify("keyword",*tcl.list_command.at(0));
-  tcl_codify(NULL,*tcl.list_command.at(1));
-  tcl_codify("NULL",*tcl.list_command.at(2));
-  tcl_codify("NULL",*tcl.list_command.at(3));
-  tcl_name(myScan->entry_ns->name,*tcl.list_command.at(2),myNs,myName);
+  tcl_codify("keyword",*tcl.list_commandwords.at(0));
+  tcl_codify(NULL,*tcl.list_commandwords.at(1));
+  tcl_codify("NULL",*tcl.list_commandwords.at(2));
+  tcl_codify("NULL",*tcl.list_commandwords.at(3));
+  tcl_name(myScan->ns,*tcl.list_commandwords.at(2),myNs,myName);
   if (myNs.length())
   {
     myName = myNs+"::"+myName;
   }
-  myEntryNs = tcl_entry_namespace(myName);
   myEntryCl = tcl_entry_class(myName);
-  myStr = *tcl.list_command.at(4);
-  if (tcl.list_command.count() > 5)
+  myStr = *tcl.list_commandwords.at(4);
+  if (tcl.list_commandwords.count() > 5)
   {
-    for (uint i=5;i<tcl.list_command.count();i++)
+    for (uint i=5;i<tcl.list_commandwords.count();i++)
     {
-      myStr.append(*tcl.list_command.at(i));
+      myStr.append(*tcl.list_commandwords.at(i));
     }
     tcl.word_is=STRING;
   }
-  myScan = tcl_scan_start(tcl.word_is,myStr,text);
-  myScan->entry_ns = myEntryNs;
-  myScan->entry_cl = myEntryCl;
-  myScan->entry_fn = NULL;
+  tcl_scan_start(tcl.word_is,myStr,text,myName,myEntryCl,NULL);
 }
 
 //! Handle \c variable statements.
 static void tcl_command_VARIABLE(const char *text, int inclass)
 {
+D
   QString myNs, myName;
   Entry *myEntry;
   tcl_scan *myScan = tcl.scan.at(0);
 
-  tcl_codify("keyword",*tcl.list_command.at(0));
-  for (unsigned int i=1; i< tcl.list_command.count(); i++)
+  tcl_codify("keyword",*tcl.list_commandwords.at(0));
+  for (unsigned int i=1; i< tcl.list_commandwords.count(); i++)
   {
-    tcl_codify(NULL,*tcl.list_command.at(i));
+    tcl_codify(NULL,*tcl.list_commandwords.at(i));
   }
-  tcl_name(myScan->entry_ns->name,*tcl.list_command.at(2),myNs,myName);
+  tcl_name(myScan->ns,*tcl.list_commandwords.at(2),myNs,myName);
   if (myNs.length())
   {// qualified variables go into namespace
     myEntry = tcl_entry_namespace(myNs);
@@ -1963,7 +1987,7 @@ static void tcl_command_VARIABLE(const char *text, int inclass)
     }
     else
     {
-      myEntry = myScan->entry_ns;
+      myEntry = tcl_entry_namespace(myScan->ns);
       tcl.entry_current->stat = true;
     }
   }
@@ -1981,13 +2005,14 @@ static void tcl_command_VARIABLE(const char *text, int inclass)
 //! Handling of command parsing.
 static void tcl_command(int what,const char *text)
 {
+  int myLine=0;
   if (what==0)
   {
     tcl.scan.at(0)->line1=yylineno;// current line in scan context
     tcl.line_body0=yylineno;// start line of command
-tcl_debug("+++%s",text);
+tcl_inf("<- %s\n",text);
     yy_push_state(COMMAND);
-    tcl.list_command.clear();
+    tcl.list_commandwords.clear();
     tcl.string_command="";
     tcl.string_last="";
     tcl.command=1;
@@ -1997,46 +2022,48 @@ tcl_debug("+++%s",text);
   {
     if (tcl.string_last.length())
     {
-      tcl.list_command.append(tcl.string_last);
+      tcl.list_commandwords.append(tcl.string_last);
       tcl.string_last="";
     }
-    if (text) {
-      tcl.list_command.append(text);
+    if (text) 
+    {
+      tcl.list_commandwords.append(text);
     }
     return;
   }
   if (what!=-1)
   {// should not happen
-    tcl_abort("what %d",what);
+    tcl_err("what %d\n",what);
     return;
   }
-  tcl_debug("---");
+tcl_inf("->\n");
   if (tcl.command==0)
   {
     return;//TODO check on inside comment
   }
   if (tcl.string_last != "")
   {// get last word
-    tcl.list_command.append(tcl.string_last);
+    tcl.list_commandwords.append(tcl.string_last);
     tcl.string_last="";
   }
   yy_pop_state();
 
   // check command
-  QString myStr = *tcl.list_command.at(0);
+  QString myStr = *tcl.list_commandwords.at(0);
   int myLevel = 0;
   Protection myProt = tcl.protection;
 
-  if (tcl.list_command.count() < 3)
+  if (tcl.list_commandwords.count() < 3)
   {
     tcl_command_OTHER(text);
     goto command_end;
   }
   // remove leading "::" and apply TCL_SUBST
   if (myStr.left(2)=="::") myStr = myStr.mid(2);
-#if HAS_TCL_SUBST 
-  if (tcl.config_subst.contains(myStr)) {myStr=tcl.config_subst[myStr];}
-#endif
+  if (tcl.config_subst.contains(myStr))
+  {
+    myStr=tcl.config_subst[myStr];
+  }
   if (strcmp("private",myStr)==0)
   {
     tcl.protection = Private;
@@ -2054,63 +2081,65 @@ tcl_debug("+++%s",text);
   }
   if (myLevel)
   {
-    tcl_codify("keyword",*tcl.list_command.at(0));
-    tcl_codify(NULL,*tcl.list_command.at(1));
-    tcl.list_command.remove(tcl.list_command.at(1));
-    tcl.list_command.remove(tcl.list_command.at(0));
-    if (tcl.list_command.count()==1)
+    tcl_codify("keyword",*tcl.list_commandwords.at(0));
+    tcl_codify(NULL,*tcl.list_commandwords.at(1));
+    tcl.list_commandwords.remove(tcl.list_commandwords.at(1));
+    tcl.list_commandwords.remove(tcl.list_commandwords.at(0));
+    if (tcl.list_commandwords.count()==1)
     {
       tcl_scan *myScan = tcl.scan.at(0);
-      myScan = tcl_scan_start(tcl.word_is,*tcl.list_command.at(0),text);
+      tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(0),text,
+	myScan->ns,myScan->entry_cl,myScan->entry_fn);
       myProt = tcl.protection;
       goto command_end;
     }
-    myStr	= *tcl.list_command.at(0);
+    myStr	= *tcl.list_commandwords.at(0);
     // remove leading "::" and apply TCL_SUBST
     if (myStr.left(2)=="::") myStr = myStr.mid(2);
-#if HAS_TCL_SUBST 
-    if (tcl.config_subst.contains(myStr)) {myStr=tcl.config_subst[myStr];}
-#endif
+    if (tcl.config_subst.contains(myStr))
+    {
+      myStr=tcl.config_subst[myStr];
+    }
   }
   if (strcmp("proc",myStr)==0)
   {
-    if (tcl.list_command.count() == 5)
+    if (tcl.list_commandwords.count() == 5)
     {// itcl::proc
-      tcl.list_command.append("");
-      tcl.list_command.append("");
+      tcl.list_commandwords.append("");
+      tcl.list_commandwords.append("");
     }
-    if (tcl.list_command.count() != 7) {goto command_warn;}
+    if (tcl.list_commandwords.count() != 7) {myLine=__LINE__;goto command_warn;}
     tcl_command_PROC(text);
     goto command_end;
   }
   if (strcmp("method",myStr)==0)
   {
-    if (tcl.list_command.count() == 5)
+    if (tcl.list_commandwords.count() == 5)
     {// itcl::method
-      tcl.list_command.append("");
-      tcl.list_command.append("");
+      tcl.list_commandwords.append("");
+      tcl.list_commandwords.append("");
     }
-    if (tcl.list_command.count() != 7) {goto command_warn;}
+    if (tcl.list_commandwords.count() != 7) {myLine=__LINE__;goto command_warn;}
     tcl_command_METHOD(text);
     goto command_end;
   }
   if (strcmp("constructor",myStr)==0)
   {
-    if (tcl.list_command.count() != 5) {goto command_warn;}
+    if (tcl.list_commandwords.count() != 5) {myLine=__LINE__;goto command_warn;}
     tcl_command_CONSTRUCTOR(text);
     goto command_end;
   }
   if (strcmp("destructor",myStr)==0)
   {
-    if (tcl.list_command.count() != 3) {goto command_warn;}
+    if (tcl.list_commandwords.count() != 3) {myLine=__LINE__;goto command_warn;}
     tcl_command_DESTRUCTOR(text);
     goto command_end;
   }
   if (strcmp("namespace",myStr)==0)
   {
-    if (strcmp("eval",*tcl.list_command.at(2))==0)
+    if (strcmp("eval",*tcl.list_commandwords.at(2))==0)
     {
-      if (tcl.list_command.count() < 7) {goto command_warn;}
+      if (tcl.list_commandwords.count() < 7) {myLine=__LINE__;goto command_warn;}
       tcl_command_NAMESPACE(text);
       goto command_end;
     }
@@ -2119,21 +2148,21 @@ tcl_debug("+++%s",text);
   }
   if (strcmp("itcl::class",myStr)==0)
   {
-    if (tcl.list_command.count() != 5) {goto command_warn;}
+    if (tcl.list_commandwords.count() != 5) {myLine=__LINE__;goto command_warn;}
     tcl_command_ITCL_CLASS(text);
     goto command_end;
   }
   if (strcmp("itcl::body",myStr)==0)
   {
-    if (tcl.list_command.count() != 7) {goto command_warn;}
-    tcl_command_ITCL_BODY(text);
+    if (tcl.list_commandwords.count() != 7) {myLine=__LINE__;goto command_warn;}
+    tcl_command_METHOD(text);
     goto command_end;
   }
   if (strcmp("oo::class",myStr)==0)
   {
-    if (strcmp("create",*tcl.list_command.at(2))==0)
+    if (strcmp("create",*tcl.list_commandwords.at(2))==0)
     {
-      if (tcl.list_command.count() != 7) {goto command_warn;}
+      if (tcl.list_commandwords.count() != 7) {myLine=__LINE__;goto command_warn;}
       tcl_command_OO_CLASS(text);
       goto command_end;
     }
@@ -2142,13 +2171,13 @@ tcl_debug("+++%s",text);
   }
   if (strcmp("oo::define",myStr)==0)
   {
-    if (tcl.list_command.count() < 5) {goto command_warn;}
+    if (tcl.list_commandwords.count() < 5) {myLine=__LINE__;goto command_warn;}
     tcl_command_OO_DEFINE(text);
     goto command_end;
   }
   if (strcmp("variable",myStr)==0)
   {
-    if (tcl.list_command.count() < 3) {goto command_warn;}
+    if (tcl.list_commandwords.count() < 3) {myLine=__LINE__;goto command_warn;}
     if (tcl.scan.at(0)->entry_fn == NULL)
     {// only parsed outside functions
       tcl_command_VARIABLE(text,tcl.scan.at(0)->entry_cl!=NULL&&tcl.scan.at(0)->entry_cl->name!="");
@@ -2157,7 +2186,7 @@ tcl_debug("+++%s",text);
   }
   if (strcmp("common",myStr)==0)
   {
-    if (tcl.list_command.count() < 3) {goto command_warn;}
+    if (tcl.list_commandwords.count() < 3) {myLine=__LINE__;goto command_warn;}
     if (tcl.scan.at(0)->entry_fn == NULL)
     {// only parsed outside functions
       tcl_command_VARIABLE(text,0);
@@ -2166,22 +2195,22 @@ tcl_debug("+++%s",text);
   }
   if (strcmp("inherit",myStr)==0 || strcmp("superclass",myStr)==0)
   {
-    if (tcl.list_command.count() < 3) {goto command_warn;}
+    if (tcl.list_commandwords.count() < 3) {myLine=__LINE__;goto command_warn;}
     if (tcl.scan.at(0)->entry_cl!=NULL&&tcl.scan.at(0)->entry_cl->name!="")
     {
-      for (unsigned int i = 2; i < tcl.list_command.count(); i++)
+      for (unsigned int i = 2; i < tcl.list_commandwords.count(); i++)
       {
-        tcl.scan.at(0)->entry_cl->extends->append(new BaseInfo(*tcl.list_command.at(i),Public,Normal));
+        tcl.scan.at(0)->entry_cl->extends->append(new BaseInfo(*tcl.list_commandwords.at(i),Public,Normal));
       }
     }
   }
   tcl_command_OTHER(text);
   goto command_end;
   command_warn:
-    tcl_warn("count=%d: %s",tcl.list_command.count(),tcl.list_command.join(" ").ascii());
+    tcl_war("%d count=%d: %s\n",myLine,tcl.list_commandwords.count(),tcl.list_commandwords.join(" ").ascii());
     tcl_command_OTHER(text);
   command_end:
-    tcl.list_command.clear();
+    tcl.list_commandwords.clear();
     tcl.command = 0;
     tcl.protection = myProt;
 }
@@ -2190,28 +2219,41 @@ tcl_debug("+++%s",text);
 //! Common initializations.
 static void tcl_init()
 {
-#if HAS_TCL_SUBST 
   // Get values from option TCL_SUBST
-  QStrList myStrLst = Config_getList("TCL_SUBST");
-  if (myStrLst.count()%2 != 0) 
+  tcl.config_subst.clear();
+  if (Config::instance()->get("TCL_SUBST")) 
   {
-    tcl.config_subst.clear();
+    QStrList myStrList = Config_getList("TCL_SUBST");
+    const char *s=myStrList.first();
+    while (s) 
+    {
+      QCString myStr=s;
+      int i=myStr.find('=');
+      if (i>0)
+      {
+        QCString myName=myStr.left(i).stripWhiteSpace();
+        QCString myValue=myStr.right(myStr.length()-i-1).stripWhiteSpace();
+        if (!myName.isEmpty() && !myValue.isEmpty())
+tcl_inf("TCL_SUBST: use '%s'\n",s);
+        tcl.config_subst[myName] = myValue;
+      }
+      s = myStrList.next();
+    }
+  }
+
+  if (tcl.input_string.at(tcl.input_string.length()-1) == '\n') 
+  {
+    tcl.input_string[tcl.input_string.length()-1] = 0x1A;
   } 
   else 
   {
-    for (unsigned int i=0; i < myStrLst.count(); i=i+2) 
-    {
-      tcl.config_subst[myStrLst.at(i)] = myStrLst.at(i+1);
-    }
+    tcl.input_string += 0x1A;
   }
-#endif
-  
   tcl.code = NULL;
   tcl.code_font=NULL;
   tcl.code_line=1;
   tcl.code_linenumbers=1;
   tcl.config_autobrief = Config_getBool("JAVADOC_AUTOBRIEF");
-  tcl.input_string = NULL;
   tcl.input_position = 0;
   tcl.file_name = NULL;
   tcl.this_parser = NULL;
@@ -2230,17 +2272,18 @@ static void tcl_init()
   tcl.entry_file	= NULL;
   tcl.entry_current	= NULL;
   tcl.entry_inside	= NULL;
-  tcl.list_command.clear();
+  tcl.list_commandwords.clear();
   tcl.scan.clear();
   tcl.ns.clear();
   tcl.cl.clear();
   tcl.fn.clear();
   yylineno		= 1;
   tcl.protection	= Public;
+  tcl.memberdef		= NULL;
 }
 
 //! Start parsing.
-static void tcl_parse()
+static void tcl_parse(const QString ns, const QString cls)
 {
   tcl_scan *myScan;
 
@@ -2259,14 +2302,12 @@ static void tcl_parse()
   myScan->string_after="";
   myScan->line0=yylineno;
   myScan->line1=yylineno;
-  myScan->start_stack_ptr=yy_start_stack_ptr;
   myScan->buffer_state=YY_CURRENT_BUFFER;
-  myScan->entry_ns=tcl_entry_namespace("");
-  myScan->entry_cl=tcl_entry_class("");
+  myScan->ns=ns;
+  myScan->entry_cl=tcl_entry_class(cls);
   myScan->entry_fn=NULL;
-  tcl.entry_inside = myScan->entry_ns;
   tcl.entry_inside = tcl.entry_file;
-  myScan->entry_scan = myScan->entry_ns;
+  myScan->entry_scan = tcl.entry_inside;
   tcl.scan.insert(0,myScan);
 
   tclscanYYlex();
@@ -2281,20 +2322,23 @@ static void tcl_parse()
 void TclLanguageScanner::parseInput(const char *fileName,const char *input,Entry *root)
 {
   QFile            myFile;
-
+tcl_inf("%s\n",fileName);
   myFile.setName(fileName);
   if (!myFile.open(IO_ReadOnly)) return;
+  if (strlen(input)<1) return;
 
-  msg("Parsing '%s'...\n",fileName);
+  tcl.input_string = input;
+  if (tcl.input_string.length()<1) return;
+
+  msg("Parsing %s...\n",fileName);
   groupEnterFile(fileName,yylineno);
 
   tcl_init();
   tcl.code = NULL;
-  tcl.input_string = input;
   tcl.file_name = fileName;
   tcl.this_parser = this;
   tcl.entry_main          = root; /* toplevel entry */
-  tcl_parse();
+  tcl_parse("","");
 
   groupLeaveFile(tcl.file_name,yylineno);
   root->program.resize(0);
@@ -2320,26 +2364,58 @@ void TclLanguageScanner::parseCode(CodeOutputInterface & codeOutIntf,
   (void)fileDef;
   (void)endLine;
   (void)inlineFragment;
-  (void)memberDef;
 
-  if (input.isEmpty()) return;
-/*
+  if (input.length()<1) return;
+  tcl.input_string = input;
+
+  QString myNs="";
+  QString myCls="";
+  if (memberDef)
+  {
+    if (memberDef->getClassDef())
+    {
+      myCls = memberDef->getClassDef()->displayName();
+      myNs = myCls;
+    }
+    else if (memberDef->getNamespaceDef())
+    {
+      myNs = memberDef->getNamespaceDef()->displayName();
+    }
+  }
+
   QString myStr="Codifying..";
-  if (scopeName) {myStr+=" scope=";myStr+=scopeName;}
-  if (exampleName) {myStr+=" example=";myStr+=exampleName;}
-  if (memberDef) {myStr+=" member=";myStr+=memberDef->memberTypeName();
-	myStr+=" ";myStr+=memberDef->qualifiedName();}
-  if (fileDef) {myStr+=" file=";myStr+=fileDef->fileName();}
-  
-printf("%s (%d,%d) %d %d\n====%s\n====\n",myStr.ascii(),startLine,endLine,isExampleBlock,inlineFragment,input.data());
-*/
-  QCString myInput = input;
-  if (input.at(input.length()-1) != '\n') 
+  if (scopeName)
+  {
+    myStr +=" scope=";
+    myStr+=scopeName;
+  }
+  if (exampleName)
+  {
+    myStr+=" example=";
+    myStr+=exampleName;
+  }
+  if (memberDef)
+  {
+    myStr+=" member=";
+    myStr+=memberDef->memberTypeName();
+    myStr+=" ";
+    myStr+=memberDef->qualifiedName();
+  }
+  if (fileDef)
   {
-    myInput += "\n";
+    myStr+=" file=";
+    myStr+=fileDef->fileName();
+  }
+tcl_inf("%s (%d,%d) %d %d\n",myStr.ascii(),startLine,endLine,isExampleBlock,inlineFragment);
+//tcl_inf("%s\n"input.data());
+
+  if (isExampleBlock)
+  {
+    tcl_codify(NULL,input);
+    return;
   }
-  if (isExampleBlock) {tcl_codify(NULL,input);return;}
   tcl_init();
+  tcl.memberdef = memberDef;
   tcl.code = &codeOutIntf;
   if (startLine<0) 
   {
@@ -2352,11 +2428,10 @@ printf("%s (%d,%d) %d %d\n====%s\n====\n",myStr.ascii(),startLine,endLine,isExam
   {
     tcl.code->writeLineNumber(0,0,0,tcl.code_line);
   }
-  tcl.input_string = myInput.data();
   tcl.file_name = "";
   tcl.this_parser = NULL;
   tcl.entry_main = tcl_entry_new();
-  tcl_parse();
+  tcl_parse(myNs,myCls);
   tcl.scan.clear();
   tcl.ns.clear();
   tcl.cl.clear();
@@ -2384,9 +2459,9 @@ static int yyread(char *buf,int max_size)
   int c=0;
 
   *buf = '\0';
-  while ( c < max_size && tcl.input_string[tcl.input_position] )
+  while ( c < max_size && tcl.input_string.at(tcl.input_position) )
   {
-    *buf = tcl.input_string[tcl.input_position++] ;
+    *buf = tcl.input_string.at(tcl.input_position++) ;
     c++; buf++;
   }
   //printf("Read from=%d size=%d max=%d c=%d\n",tcl.input_position,strlen(&tcl.input_string[tcl.input_position]),max_size,c);
diff --git a/src/util.cpp b/src/util.cpp
index c18e65e..5618078 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -6274,6 +6274,10 @@ g_lang2extMap[] =
   { "python",      "python",  SrcLangExt_Python  },
   { "fortran",     "fortran", SrcLangExt_Fortran },
   { "vhdl",        "vhdl",    SrcLangExt_VHDL    },
+  { "vhd",         "vhd",     SrcLangExt_VHDL    },
+  { "ucf",         "vhd",     SrcLangExt_VHDL    },
+  { "qsf",         "vhd",     SrcLangExt_VHDL    },
+  
   { "dbusxml",     "dbusxml", SrcLangExt_XML     },
   { "tcl",         "tcl",     SrcLangExt_Tcl     },
   { 0,             0,        (SrcLangExt)0       }
@@ -6340,6 +6344,9 @@ void initDefaultExtensionMapping()
   updateLanguageMapping(".vhd",   "vhdl");
   updateLanguageMapping(".vhdl",  "vhdl");
   updateLanguageMapping(".tcl",   "tcl");
+  updateLanguageMapping(".ucf",   "vhdl");
+  updateLanguageMapping(".qsf",   "vhdl");
+
   //updateLanguageMapping(".xml",   "dbusxml");
 }
 
diff --git a/src/vhdlcode.l b/src/vhdlcode.l
index f0b02b5..4500140 100644
--- a/src/vhdlcode.l
+++ b/src/vhdlcode.l
@@ -119,7 +119,7 @@ static void setCurrentDoc(const QCString &name,const QCString &base,const QCStri
   }
 }
 
-static bool checkString(QCString &name)
+static bool checkVhdlString(QCString &name)
 {
   if (name.isEmpty()) return FALSE;
   static QRegExp regg("[\\s\"]");
@@ -286,7 +286,7 @@ static void writeWord(const char *word,const char* curr_class=0,bool classLink=F
           }
           else                                                                          
 	  {
-          if (!checkString(temp))
+          if (!checkVhdlString(temp))
             g_code->codify(temp.data());
 	  }
         }
@@ -775,6 +775,8 @@ MAPCOMPONENT2 {BN}*("port"|"generic"){BN}+("map"){BN}*("("){1}
 MAPCOMPONENT3 ({ALLTYPESMAP}[:]{BN}*{ALLTYPESMAP1}{TEXTT}*{BN}+("port"|"generic"){BN}+("map"){BN}*("("){1})
 MAPCOMPONENT4 ({ALLTYPESMAP}[:]{BN}*("entity"|"component"|"configuration"){BN}+{ALLTYPESMAP1}{TEXTT}*{BN}*("port"|"generic"){BN}*("map"){BN}*("("){1})
 
+XILINX      "INST"|"NET"|"PIN"|"BLKNM"|"BUFG"|"COLLAPSE"|"CPLD"|"COMPGRP"|"CONFIG"|"CONFIG_MODE"|"COOL_CLK"|"DATA_GATE"|"DCI_VALUE"|"DISABLE"|"DRIVE"|"DROP_SPEC"|"ENABLE"|"FAST"|"FEEDBACK"|"FILE"|"FLOAT"|"FROM-THRU-TO"|"FROM-TO"|"HBLKNM"|"HU_SET"|"INREG"|"IOB"|"IOBDELAY"|"IOSTANDARD"|"KEEP"|"KEEPER"|"LOC"|"LOCATE"|"LOCK_PINS"|"MAP"|"MAXDELAY"|"MAXPT"|"MAXSKEW"|"NODELAY"|"NOREDUCE"|"OFFSET"|"OPEN_DRAIN"|"OPT_EFFORT"|"OPTIMIZE"|"PERIOD"|"PIN"|"PRIORITY"|"PROHIBIT"|"PULLDOWN"|"PULLUP"|"PWR_MODE"|"REG"|"RLOC"|"RLOC_ORIGIN"|"RLOC_RANGE"|"SAVE NET"|"FLAG"|"SYSTEM_JITTER"|"TEMPERATURE"|"TIMEGRP"|"TIMESPEC"|"VOLTAGE"
+
 %option noyywrap
 %option nounput
 
@@ -856,7 +858,7 @@ MAPCOMPONENT4 ({ALLTYPESMAP}[:]{BN}*("entity"|"component"|"configuration"){BN}+{
 			    cc=t1.at(index);
 			  }        
 			  s2=s2.stripWhiteSpace();
-			    if (!checkString(s2))
+			    if (!checkVhdlString(s2))
 			  generateMemLink(*g_code,g_CurrClass,s2); 
 			  while (index++<t1.size()) 
 			  { 
@@ -1114,7 +1116,7 @@ MAPCOMPONENT4 ({ALLTYPESMAP}[:]{BN}*("entity"|"component"|"configuration"){BN}+{
 <ParseComponent>[_a-zA_Z][_a-zA-Z0-9]*  {
                          QCString temp(vhdlcodeYYtext);
                          appStringLower(g_PrevString,vhdlcodeYYtext);
-                         if (!checkString(temp)){
+                         if (!checkVhdlString(temp)){
                          if (!writeColoredWord(g_PrevString))
 		         {
                            generateMemLink(*g_code,g_tempComp,temp); 
@@ -1124,7 +1126,7 @@ MAPCOMPONENT4 ({ALLTYPESMAP}[:]{BN}*("entity"|"component"|"configuration"){BN}+{
 
 <ParseComponent>{STRING} { 
                             QCString temp(vhdlcodeYYtext);
-                        if (!checkString(temp))
+                        if (!checkVhdlString(temp))
                          codifyLines(vhdlcodeYYtext);
                         }
 
@@ -1214,8 +1216,8 @@ MAPCOMPONENT4 ({ALLTYPESMAP}[:]{BN}*("entity"|"component"|"configuration"){BN}+{
                                else
 			       {
                                  generateClassOrGlobalLink(*g_code,left.data()); 
-                                 tt=tt.right(tt.length()-left.length()-1);
-                                 tt.prepend(" ");
+                                 tt.stripPrefix(left.data()); //=tt.right(tt.length()-left.length()-1);
+                                 
                                  g_PortMapComp=left;
                                  codifyLines(tt.data());
                                }
@@ -1424,6 +1426,19 @@ MAPCOMPONENT4 ({ALLTYPESMAP}[:]{BN}*("entity"|"component"|"configuration"){BN}+{
                        writeFont("keyword",vhdlcodeYYtext);
                 }
 
+<Bases>{B}*"#"[^\n]*  { 
+                                      writeFont("keyword",vhdlcodeYYtext);
+                                    }
+                                     
+<Bases>^{B}*{XILINX}[^\n]*  { 
+                            writeWord(yytext);
+                            //codifyLines(vhdlcodeYYtext,g_CurrClass.data(),TRUE);
+                         }           
+                             
+<Bases>^{B}*"set_"[^\n]*  { 
+                                      writeWord(yytext);
+                                    }
+                                    
 <*>\n                    {
 			   codifyLines(vhdlcodeYYtext);
 			   BEGIN(Bases);
@@ -1443,7 +1458,7 @@ MAPCOMPONENT4 ({ALLTYPESMAP}[:]{BN}*("entity"|"component"|"configuration"){BN}+{
 			   }  
 			   else // normal comment
 			   {
-			     startFontClass("comment");
+			     startFontClass("keyword");
 			     codifyLines(text);
 			     endFontClass();
 			   }
@@ -1458,7 +1473,7 @@ MAPCOMPONENT4 ({ALLTYPESMAP}[:]{BN}*("entity"|"component"|"configuration"){BN}+{
 			   }  
 			   else // normal comment
 			   {
-			     startFontClass("comment");
+			     startFontClass("keyword");
 			     codifyLines(text);
 			     endFontClass();
 			   }
@@ -1541,6 +1556,7 @@ void parseVhdlCode(CodeOutputInterface &od,const char *className,const QCString
   {
     setParameterList(memberDef);
   }
+  int iLine=countLines();
   vhdlcodeYYrestart( vhdlcodeYYin );
   BEGIN( Bases );
   vhdlcodeYYlex();
@@ -1555,6 +1571,7 @@ void parseVhdlCode(CodeOutputInterface &od,const char *className,const QCString
     delete g_sourceFileDef;
     g_sourceFileDef=0;
   }
+  assert(g_yyLineNr==iLine);
   return;
 }
 
diff --git a/src/vhdldocgen.cpp b/src/vhdldocgen.cpp
index 9646c42..7de52c1 100644
--- a/src/vhdldocgen.cpp
+++ b/src/vhdldocgen.cpp
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright (C) 1997-2011 by Dimitri van Heesch.
+ * Copyright (C) 1997-2010 by Dimitri van Heesch.
  *
  * Permission to use, copy, modify, and distribute this software and its
  * documentation under the terms of the GNU General Public License is hereby 
@@ -15,7 +15,7 @@
 /******************************************************************************
  * Parser for VHDL subset
  * written by M. Kreis
- * supports VHDL-87
+ * supports VHDL-87/93/2002
  * does not support VHDL-AMS 
  ******************************************************************************/
 
@@ -27,7 +27,7 @@
 #include <qcstring.h>
 #include <qfileinfo.h>
 #include <qstringlist.h>
-
+#include "memberdef.h"
 /* --------------------------------------------------------------- */
 
 // local includes
@@ -43,55 +43,44 @@
 #include "searchindex.h"
 #include "outputlist.h"
 #include "parserintf.h"
-/* --------------------------------------------------------------- */
+#include "vhdlscanner.h"
+#include "layout.h"
+
 
-//#define theTranslator_vhdlType theTranslator->trVhdlType
 #define theTranslator_vhdlType VhdlDocGen::trVhdlType
 
 static QDict<QCString> g_vhdlKeyDict0(17,FALSE); 
 static QDict<QCString> g_vhdlKeyDict1(17,FALSE); 
 static QDict<QCString> g_vhdlKeyDict2(17,FALSE);
 
-static  QCString g_vhdlkeyword("vhdlkeyword");
-static  QCString g_vhdltype("comment");
-static  QCString g_vhdllogic("vhdllogic");
+static QDict<QCString> g_xilinxUcfDict(17,FALSE);
 
-// keywords
-static const char* g_vhdlKeyWordMap0[] = 
-{ 
-  "std","ieee","work","standard","textio","std_logic_1164",
-  "std_logic_arith","std_logic_misc","std_logic_signed","std_logic_textio",
-  "std_logic_unsigned","numeric_bit","numeric_std","math_complex","math_real",
-  "vital_primitives","vital_timing","severity_level","time","delay_length",
-  "natural", "positive", "bit_vector","file_open_kind","file_open_status",
-  "line","text","side", "width","event","rising_edge", "falling_edge",
-  "access","after","alias", "all","architecture","array", "assert","attribute",
-  "begin","block","body", "buffer", "bus", "case", "component", "configuration", 
-  "constant", "disconnect", "downto", "else", "elsif", "end", "entity", "exit",
-  "file", "for", "function", "generate", "generic", "group", "guarded", "if", 
-  "impure", "in", "inertial", "inout", "is","label", "library", "linkage", 
-  "literal", "loop","map", "new", "next", "null", "of", "on", "open", "others", 
-  "out", "package", "port", "postponed", "procedure", "process", "pure",
-  "range", "record", "register", "reject", "report", "return","select", 
-  "severity", "shared", "signal", "subtype", "then", "to", "transport", 
-  "type","unaffected", "units", "until", "use","variable", "wait", "when", 
-  "while", "with","true","false","protected",0
-};
+static void initUCF(Entry* root,const char* type,QCString &  qcs,int line,QCString & fileName,QCString & brief);
+static void writeUCFLink(const MemberDef* mdef,OutputList &ol);
+static void assignConfiguration(ConfNode* ,QCString); 
+static void assignBinding(ConfNode* conf,QCString label);
+static void addInstance(ClassDef* entity, ClassDef* arch, ClassDef *inst,Entry *cur,ClassDef* archBind=NULL);
 
-// type
-static const char* g_vhdlKeyWordMap1[] = 
+#if 0
+static ConfNode* findConfiguration(QCString config)
 { 
-  "natural","unsigned","signed","string","boolean", "bit","character",
-  "std_ulogic","std_ulogic_vector","sTd_logic","std_logic_vector","integer",
-  "real","zzz",0
-};
+  QList<ConfNode> confList= getVhdlConfiguration();
+  uint size=confList.count();
+  if (size==0) return NULL;
 
-// logic
-static const char* g_vhdlKeyWordMap2[] = 
-{
-  "abs","and","or","not","mod", "xor","rem","xnor","ror","rol","sla",
-  "sll",0
-};
+  for (uint i=0;i<size;i++)
+  {
+    ConfNode* conf= (ConfNode *)confList.at(i);
+    QCString entity=VhdlDocGen::getIndexWord(conf->confVhdl.data(),1);
+    if (entity==config) 
+    {
+      return conf;
+    }
+  }
+
+  return NULL;
+}
+#endif
 
 VhdlDocGen::VhdlDocGen()
 {
@@ -103,6 +92,48 @@ VhdlDocGen::~VhdlDocGen()
 
 void VhdlDocGen::init()
 {
+  
+ // vhdl keywords inlcuded VHDL 2008
+const char* g_vhdlKeyWordMap0[] = 
+{ 
+  "abs","access","after","alias","all","and","architecture","array","assert","assume","assume_guarantee","attribute",
+  "begin","block","body","buffer","bus",
+  "case","component","configuration","constant","context","cover",
+  "default","disconnect","downto",
+  "else","elsif","end","entity","exit",
+  "fairness","file","for","force","function",
+  "generate","generic","group","guarded",
+  "if","impure","in","inertial","inout","is",
+  "label","library","linkage","literal","loop",
+  "map","mod",
+  "nand","new","next","nor","not","null",
+  "of","on","open","or","others","out",
+  "package","parameter","port","postponed","procedure","process","property","proctected","pure",
+  "range","record","register","reject","release","restrict","restrict_guarantee","rem","report","rol","ror","return",
+  "select","sequence","severity","signal","shared","sla","sll","sra","srl","strong","subtype",
+  "then","to","transport","type",
+  "unaffected","units","until","use",
+  "variable","vmode","vprop","vunit",
+  "wait","when","while","with",
+  "xor","xnor",
+  0 
+};
+	
+// type
+const char* g_vhdlKeyWordMap1[] = 
+{ 
+  "natural","unsigned","signed","string","boolean", "bit","bit_vector","character",
+  "std_ulogic","std_ulogic_vector","std_logic","std_logic_vector","integer",
+  "real","float","ufixed","sfixed","time",0
+};
+
+// logic
+const char* g_vhdlKeyWordMap2[] = 
+{
+  "abs","and","or","not","mod", "xor","rem","xnor","ror","rol","sla",
+  "sll",0
+};
+
   int j=0;
   g_vhdlKeyDict0.setAutoDelete(TRUE);
   g_vhdlKeyDict1.setAutoDelete(TRUE);
@@ -140,6 +171,10 @@ void VhdlDocGen::init()
 
 QCString* VhdlDocGen::findKeyWord(const QCString& word)
 {
+  static  QCString g_vhdlkeyword("vhdlkeyword");
+  static  QCString g_vhdltype("comment");
+  static  QCString g_vhdllogic("vhdllogic");
+
   if (word.isEmpty() || word.at(0)=='\0') return 0;
   //printf("VhdlDocGen::findKeyWord(%s)\n",word.data());
 
@@ -160,33 +195,6 @@ QCString* VhdlDocGen::findKeyWord(const QCString& word)
  */
 
 
-void VhdlDocGen::debugClassName(ClassSDict* mDict)
-{
-  // for each class
-  ClassSDict::Iterator cli(*mDict);
-  ClassDef *cd;
-  for ( ; (cd=cli.current()) ; ++cli )
-  {
-    printf("\n -------------------------class----------------------------------------\n");
-
-    QCString nnn=cd->className();
-    QCString qref=cd->getReference();
-    QCString outBase=cd->getOutputFileBase();
-    QCString fileBase=cd->getFileBase();
-    QCString compType=cd->compoundTypeString();
-    QCString inDoc=cd->documentation();//->inbodyDocumentation();
-    printf("\n refernz [%p]",cd);
-    printf("\n compType [%s]",compType.data());
-    printf("\n Name [%s]",nnn.data());
-    printf("\n TYPE[%d ",cd->definitionType());
-    printf("\n Ref [%s] ",qref.data());
-    printf("\n OutBase [%s] fileBase [%s]",outBase.data(),fileBase.data());
-
-    printf("\n -------------------------------------------------------------------\n");
-
-  }// for
-}// Debug Class Name
-
 
 bool found =FALSE;
 static Entry eMerge;
@@ -203,57 +211,8 @@ ClassDef *VhdlDocGen::getClass(const char *name)
   return cd;
 }
 
-/*!
- * adds architectures to their entity
- */
-void VhdlDocGen::computeVhdlComponentRelations()
-{
-  ClassSDict::Iterator cli(*Doxygen::classSDict);
-  ClassDef *cd;
-  for (cli.toFirst();(cd=cli.current());++cli)
-  {
-    if (cd->getLanguage()==SrcLangExt_VHDL &&
-        ((VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::ARCHITECTURECLASS || 
-         (VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::PACKBODYCLASS
-        )
-       )
-    {
-      QCString bName=cd->name();
-      int i=bName.find("::");
-      if (i>0)
-      {
-        QCString entityName=bName.left(i);
-        entityName.stripPrefix("_");
-        ClassDef *classEntity=Doxygen::classSDict->find(entityName);
-        // entity for architecutre ?
-        if (classEntity)
-        {
-          // printf("\n entity %s  arch %s",entityName.data(),bName.data());
-          classEntity->insertBaseClass(cd,bName,Public,Normal,0);
-          cd->insertSubClass(classEntity,Public,Normal,0);
-        }
-      }
-    }
-  }
-} // computeVhdlComponentRelations
-
-
-/*
- * returns a reference, if one class [package(body),entity or an architecture is found]
- */
 
-ClassDef* VhdlDocGen::findComponent(int type)
-{
-  ClassSDict::Iterator cli(*Doxygen::classSDict);
-  ClassDef *cd=0;
 
-  for ( ; (cd=cli.current()) ; ++cli )
-  {
-    if (cd->protection()==type)
-      return cd;
-  }
-  return cd;
-}
 
 ClassDef* VhdlDocGen::getPackageName(const QCString & name)
 {
@@ -287,8 +246,8 @@ MemberDef* VhdlDocGen::findMember(const QCString& className, const QCString& mem
       (VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::PACKBODYCLASS)
   {
     Definition *d = cd->getOuterScope();
-     // searching upper/lower case names
- 
+    // searching upper/lower case names
+
     QCString tt=d->name();   
     ClassDef *ecd =getClass(tt);
     if (!ecd)
@@ -307,8 +266,8 @@ MemberDef* VhdlDocGen::findMember(const QCString& className, const QCString& mem
       //ClassDef *ecd = (ClassDef*)d;
       mdef=VhdlDocGen::findMemberDef(ecd,memName,MemberList::variableMembers);
       if (mdef) return mdef;
-       mdef=VhdlDocGen::findMemberDef(cd,memName,MemberList::pubMethods);
-       if (mdef) return mdef;
+      mdef=VhdlDocGen::findMemberDef(cd,memName,MemberList::pubMethods);
+      if (mdef) return mdef;
     }
     //cd=getClass(getClassName(cd));
     //if (!cd) return 0;
@@ -320,7 +279,7 @@ MemberDef* VhdlDocGen::findMember(const QCString& className, const QCString& mem
       (VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::PACKBODYCLASS)
   {
     Definition *d = cd->getOuterScope();
-   
+
     QCString tt=d->name();
     ClassDef *ecd =getClass(tt);
     if (!ecd)
@@ -387,7 +346,9 @@ MemberDef* VhdlDocGen::findMemberDef(ClassDef* cd,const QCString& key,MemberList
   for (fmni.toFirst();(md=fmni.current());++fmni)
   {
     if (stricmp(key.data(),md->name().data())==0)
+    {
       return md;
+    }
   } 
   return 0;
 }//findMemberDef
@@ -409,26 +370,26 @@ void VhdlDocGen::findAllPackages(const QCString& className,QDict<QCString>& qdic
       MemberListIterator fmni(*mem);
       for (fmni.toFirst();(md=fmni.current());++fmni)
       {
-	if (VhdlDocGen::isPackage(md))
-	{
-	  QCString *temp1=new QCString(md->name().data());
-	  //*temp1=temp1->lower();
-	  QCString p(md->name().data());
-	  //p=p.lower();
-	  ClassDef* cd=VhdlDocGen::getPackageName(*temp1);
-	  if (cd) 
-	  { 
-	    QCString *ss=qdict.find(*temp1);
-	    if (ss==0)
-	    {
-	      qdict.insert(p,temp1);
-	      QCString tmp=cd->className();
-	      VhdlDocGen::findAllPackages(tmp,qdict);
-	    }
-	    else delete temp1;
-	  }
-	  else delete temp1;
-	}
+        if (VhdlDocGen::isPackage(md))
+        {
+          QCString *temp1=new QCString(md->name().data());
+          //*temp1=temp1->lower();
+          QCString p(md->name().data());
+          //p=p.lower();
+          ClassDef* cd=VhdlDocGen::getPackageName(*temp1);
+          if (cd) 
+          { 
+            QCString *ss=qdict.find(*temp1);
+            if (ss==0)
+            {
+              qdict.insert(p,temp1);
+              QCString tmp=cd->className();
+              VhdlDocGen::findAllPackages(tmp,qdict);
+            }
+            else delete temp1;
+          }
+          else delete temp1;
+        }
       }//for
     }//if
   }//cdef
@@ -440,8 +401,8 @@ void VhdlDocGen::findAllPackages(const QCString& className,QDict<QCString>& qdic
  */
 
 MemberDef* VhdlDocGen::findFunction(const QList<Argument> &ql,
-                                    const QCString& funcname,
-				    const QCString& package, bool type)
+    const QCString& funcname,
+    const QCString& package, bool type)
 {
   MemberDef* mdef=0;
   int funcType;
@@ -463,173 +424,45 @@ MemberDef* VhdlDocGen::findFunction(const QList<Argument> &ql,
       QCString mname=mdef->name();
       if ((VhdlDocGen::isProcedure(mdef) || VhdlDocGen::isVhdlFunction(mdef)) && (VhdlDocGen::compareString(funcname,mname)==0))
       {
-	LockingPtr<ArgumentList> alp = mdef->argumentList();
-
-	//  ArgumentList* arg2=mdef->getArgumentList();
-	if (alp==0) break;
-	ArgumentListIterator ali(*alp.pointer());
-	ArgumentListIterator ali1(ql);
-
-	if (ali.count() != ali1.count()) break;
-
-	Argument *arg,*arg1;
-	int equ=0;
-
-	for (;(arg=ali.current());++ali)
-	{
-	  arg1=ali1.current(); ++ali1;
-	  equ+=abs(VhdlDocGen::compareString(arg->type,arg1->type));
-
-	  QCString s1=arg->type;
-	  QCString s2=arg1->type;
-	  VhdlDocGen::deleteAllChars(s1,' ');
-	  VhdlDocGen::deleteAllChars(s2,' ');
-	  equ+=abs(VhdlDocGen::compareString(s1,s2));
-	  s1=arg->attrib;
-	  s2=arg1->attrib;
-	  VhdlDocGen::deleteAllChars(s1,' ');
-	  VhdlDocGen::deleteAllChars(s2,' ');
-	  equ+=abs(VhdlDocGen::compareString(s1,s2));
-	  // printf("\n 1. type [%s] name [%s] attrib [%s]",arg->type,arg->name,arg->attrib);
-	  // printf("\n 2. type [%s] name [%s] attrib [%s]",arg1->type,arg1->name,arg1->attrib);
-	} // for
-	if (equ==0) return mdef;
+        LockingPtr<ArgumentList> alp = mdef->argumentList();
+
+        //  ArgumentList* arg2=mdef->getArgumentList();
+        if (alp==0) break;
+        ArgumentListIterator ali(*alp.pointer());
+        ArgumentListIterator ali1(ql);
+
+        if (ali.count() != ali1.count()) break;
+
+        Argument *arg,*arg1;
+        int equ=0;
+
+        for (;(arg=ali.current());++ali)
+        {
+          arg1=ali1.current(); ++ali1;
+          equ+=abs(VhdlDocGen::compareString(arg->type,arg1->type));
+
+          QCString s1=arg->type;
+          QCString s2=arg1->type;
+          VhdlDocGen::deleteAllChars(s1,' ');
+          VhdlDocGen::deleteAllChars(s2,' ');
+          equ+=abs(VhdlDocGen::compareString(s1,s2));
+          s1=arg->attrib;
+          s2=arg1->attrib;
+          VhdlDocGen::deleteAllChars(s1,' ');
+          VhdlDocGen::deleteAllChars(s2,' ');
+          equ+=abs(VhdlDocGen::compareString(s1,s2));
+          // printf("\n 1. type [%s] name [%s] attrib [%s]",arg->type,arg->name,arg->attrib);
+          // printf("\n 2. type [%s] name [%s] attrib [%s]",arg1->type,arg1->name,arg1->attrib);
+        } // for
+        if (equ==0) return mdef;
       }//if
     }//for       
   }//if 
   return mdef;
 } //findFunction
 
-/*!
- * returns the function with the matching argument list
- * is called in vhdscan.l
- */
-
-Entry* VhdlDocGen::findFunction( Entry* root, Entry* func)
-{
-  //bool found=FALSE;
-  Entry *found=0;
-  int functype=func->spec;
-  EntryListIterator eli(*root->children());
-  Entry *rt;
-  for (;(rt=eli.current());++eli)
-  { 
-    if (rt->spec==functype && VhdlDocGen::compareString(rt->name,func->name)==0 && rt!=func )
-    {
-      if (VhdlDocGen::compareArgList(func->argList,rt->argList))
-      {
-	found=rt;
-	return found;
-      }
-    }//if1
-    if (!found)  
-    {
-      found = VhdlDocGen::findFunction(rt,func);
-    }
-  } // for
-  return found;
-}// findFunction
-
-/*
- * compares two argument list of a fuction|procedure
- */ 
-
-bool VhdlDocGen::compareArgList(ArgumentList* l1,ArgumentList* l2)
-{
-  if (l1== 0 || l2== 0) return FALSE;
-
-  ArgumentListIterator ali(*l1);
-  ArgumentListIterator ali1(*l2);
 
-  if (ali.count() != ali1.count()) return FALSE; 
 
-  Argument *arg,*arg1;
-  int equ=0;
-
-  for (;(arg=ali.current());++ali) 
-  {
-    bool found = FALSE;
-    for (ali1.toFirst();(arg1=ali1.current());++ali1) 
-    {
-      equ=0;  
-      QCString s1=arg->type;
-      QCString s2=arg1->type;
-      VhdlDocGen::deleteAllChars(s1,' '); // remove whitespaces
-      VhdlDocGen::deleteAllChars(s2,' ');
-      equ+=abs(VhdlDocGen::compareString(s1,s2));
-      s1=arg->attrib;
-      s2=arg1->attrib;
-      VhdlDocGen::deleteAllChars(s1,' ');
-      VhdlDocGen::deleteAllChars(s2,' ');        
-      equ+=abs(VhdlDocGen::compareString(s1,s2));
-      if (equ==0) found=TRUE;
-    }
-    if (!found) return FALSE;
-  }
-  return TRUE;
-}// compareArgList
-
-/*
- * finds a matching prototype for a function description  
- */ 
-
-Entry* VhdlDocGen::findFunction(Entry* func)
-{
-  ClassSDict::Iterator cli(*Doxygen::classSDict);
-  ClassDef *cd;
-  for (;(cd=cli.current());++cli) 
-  {
-    MemberList *mf = cd->getMemberList (MemberList::pubMethods);
-    if (mf) 
-    {
-      MemberListIterator fmni(*mf);
-      MemberDef *mdd;
-      for (fmni.toFirst();(mdd=fmni.current());++fmni)
-      {
-	int type=mdd->getMemberSpecifiers();
-	if (type==VhdlDocGen::PROCEDURE || type==VhdlDocGen::FUNCTION)
-	{
-	  QCString nnk=mdd->name();
-	  QCString ff=func->name;
-
-	  if (stricmp(mdd->name(),ff.data())==0) 
-	  {
-	    LockingPtr< ArgumentList > lp=mdd->argumentList();
-	    ArgumentList *l=lp.pointer(); 
-	    if (VhdlDocGen::compareArgList(l,func->argList))
-	    {
-	      mdd->setDocumentation(func->doc.data(),func->docFile.data(),func->docLine,TRUE);
-	      mdd->setBriefDescription(func->brief,func->briefFile,func->briefLine);
-	      addMemberToGroups(func,mdd);// do not forget grouping!
-	      return func;
-	    }  
-	  }
-	}
-      }
-    }// if
-  }//for
-  return 0;
-}// findFunction
-
-/*
- * adds the documentation for a function|procedure 
- */ 
-
-void VhdlDocGen::addFuncDoc(EntryNav* rootNav)
-{
-  Entry *root = rootNav->entry();
-  if (root &&  root->spec==VhdlDocGen::DOCUMENT)
-  {
-    Entry *func=VhdlDocGen::findFunction(root);
-    if (!func && Config_getBool("WARNINGS"))
-    {
-      warn(root->fileName,root->docLine,
-      "warning: documentation for unknown function %s found.\n",
-      root->name.data()
-      );
-    }
-  }
-}// AddFuncDoc
 
 /*! 
  * returns the class title+ref
@@ -684,13 +517,15 @@ void VhdlDocGen::writeInlineClassLink(const ClassDef* cd ,OutputList& ol)
 
   QCString type;
   if (ii==VhdlDocGen::ENTITY)
-    type=theTranslator_vhdlType(VhdlDocGen::ARCHITECTURE,TRUE);
+    type+=theTranslator_vhdlType(VhdlDocGen::ARCHITECTURE,TRUE);
   else if (ii==VhdlDocGen::ARCHITECTURE)
-    type=theTranslator_vhdlType(VhdlDocGen::ENTITY,TRUE);
+    type+=theTranslator_vhdlType(VhdlDocGen::ENTITY,TRUE);
   else if (ii==VhdlDocGen::PACKAGE_BODY)
-    type=theTranslator_vhdlType(VhdlDocGen::PACKAGE,TRUE);
+    type+=theTranslator_vhdlType(VhdlDocGen::PACKAGE,TRUE);
   else if (ii==VhdlDocGen::PACKAGE)
-    type=theTranslator_vhdlType(VhdlDocGen::PACKAGE_BODY,TRUE);
+    type+=theTranslator_vhdlType(VhdlDocGen::PACKAGE_BODY,TRUE);
+  else 
+    type+="";
 
   //type=type.lower(); 
   type+=" >> ";
@@ -732,7 +567,7 @@ void VhdlDocGen::writeInlineClassLink(const ClassDef* cd ,OutputList& ol)
       ClassDef*cc = getClass(temp->data());
       if (cc)
       {
-	VhdlDocGen::writeVhdlLink(cc,ol,type,s2,s1); 
+        VhdlDocGen::writeVhdlLink(cc,ol,type,s2,s1); 
       }
     }    
   }  
@@ -762,13 +597,33 @@ void VhdlDocGen::findAllArchitectures(QList<QCString>& qll,const ClassDef *cd)
       QCString temp=(QCString)ql[1];
       if (stricmp(cd->className().data(),temp.data())==0) 
       {
-	QCString *cl=new QCString(jj.data());
-	qll.insert(0,cl);
+        QCString *cl=new QCString(jj.data());
+        qll.insert(0,cl);
       }
     }           
   }// for
 }//findAllArchitectures
 
+ClassDef* VhdlDocGen::findArchitecture(const ClassDef *cd)
+{
+  ClassDef *citer;
+  QCString nn=cd->name();
+  ClassSDict::Iterator cli(*Doxygen::classSDict);
+
+  for ( ; (citer=cli.current()) ; ++cli )
+  {
+    QCString jj=citer->name();
+    QStringList ql=QStringList::split(":",jj,FALSE);
+    if (ql.count()>1)
+    {
+      if ((QCString)ql[0]==nn )
+      {        		
+        return citer;
+      }
+    }
+  }
+  return 0;
+}
 /*
  * writes the link entity >> .... or architecture >> ... 
  */
@@ -781,7 +636,7 @@ void VhdlDocGen::writeVhdlLink(const ClassDef* ccd ,OutputList& ol,QCString& typ
   ol.docify(type.data());
   ol.endBold();
   nn.stripPrefix("_");
-  ol.writeObjectLink(ccd->getReference(),ccd->getOutputFileBase(),ccd->anchor(),nn.data());
+  ol.writeObjectLink(ccd->getReference(),ccd->getOutputFileBase(),0,nn.data());
 
   if (!behav.isEmpty()) 
   {
@@ -790,19 +645,7 @@ void VhdlDocGen::writeVhdlLink(const ClassDef* ccd ,OutputList& ol,QCString& typ
     ol.docify(behav.data());
     ol.endBold();
   }
-  /*
-     if (Config_getBool("SOURCE_BROWSER")) { // writes a source link for latex docu
-     ol.pushGeneratorState();
-     ol.disableAllBut(OutputGenerator::Latex);
-     ol.docify(" | ");
-     ol.startEmphasis();
-     FileDef* fd=ccd->getFileDef();
-     if (fd)
-     ol.writeObjectLink(0,fd->getSourceFileBase(),0,theTranslator->trGotoSourceCode().data());
-     ol.endEmphasis();
-     ol.popGeneratorState();
-     }
-   */    
+
   ol.lineBreak();
 }
 
@@ -814,152 +657,6 @@ bool VhdlDocGen::compareString(const QCString& s1,const QCString& s2)
   return stricmp(str1.data(),str2.data());
 }
 
-bool VhdlDocGen::getSigTypeName(QList<QCString>& ql, const char* str,QCString& buffer)
-{
-  //QCString temp(str);
-  //QStringList qlist=QStringList::split(" is ",temp,FALSE);
-  //if (qlist.count()!=2) return FALSE;
-  //temp.resize(0);
-  //temp+=(QCString)qlist[0]+":"+(QCString)qlist[1];
-  //return VhdlDocGen::getSigName(ql,temp.data(),buffer);  
-  return VhdlDocGen::getSigName(ql,str,buffer);  
-}
-
-/*!
- * divides a port input   in its name,direction and type
- * @param ql stores the input name(s)
- * @param str input string
- * @param buffer stores the input direction
- * @returns FALSE if it is a port
- */
-
-bool VhdlDocGen::getSigName(QList<QCString>& ql, 
-                            const char* str,QCString& buffer)
-{
-  int j,ll,index;
-  const char *signal = "signal ";
-  QCString qmem;
-  QCString temp(str);
-  QCString st(str);
-
-  //QRegExp semi(",");
-  //QRegExp r(":");
-
-  // colon position
-  j = temp.find(':');
-  if (j < 0) return FALSE; // no input definition
-  st=st.left(j); // name only
-  index=st.find(signal,0,FALSE);
-  if (index > -1) // found "signal "
-  {
-    qmem=st.remove(index,strlen(signal)); // strip it
-    temp=qmem;
-    st=qmem;
-  }
-  else
-  {
-    qmem=temp;
-  }
-
-  ll=st.find(',');
-
-  if (ll>0) // multiple names
-  {
-    while (TRUE)
-    {
-      st=st.left(ll).stripWhiteSpace(); // one name
-
-      QCString *sig =new QCString(st);
-      ql.insert(0,sig);
-      qmem=qmem.right(qmem.length()-ll-1); // strip from list
-      st=qmem; // remainder
-      ll=st.find(',');
-      if (ll<0) // last name
-      {
-	ll = st.find(':');
-	st=st.left(ll).stripWhiteSpace();
-	ql.insert(0,new QCString(st));
-	break;
-      }
-    }
-  }
-  else // single name
-  {
-    st=st.stripWhiteSpace();
-    ql.insert(0,new QCString(st));
-  }
-  QCString *qdir=new QCString(str);
-  st=qdir->mid(j+1); // part after :
-  st=st.lower().stripWhiteSpace();
-  *qdir=st;
-  ql.insert(0,qdir);
-
-  if (st.stripPrefix("inout"))
-  {
-    buffer+="inout";
-    return TRUE;
-  }
-  if (st.stripPrefix("INOUT"))
-  {
-    buffer+="inout";
-    return TRUE;
-  }
-
-  if (st.stripPrefix("out"))
-  {
-    buffer+="out";
-    return TRUE;
-  }
-  if (st.stripPrefix("OUT"))
-  {
-    buffer+="out";
-    return TRUE;
-  }
-
-  if (st.stripPrefix("in"))
-  {
-    buffer+="in";
-    return TRUE;
-  }
-  if (st.stripPrefix("IN"))
-  {
-    buffer+="in";
-    return TRUE;
-  }
-  return FALSE;
-}
-
-/*!
- * divides a process string in its name and types
- * @param text process text
- * @param name points to the process name
- * @param ql stores the process types
- */
-
-void VhdlDocGen::parseProcessProto(const char* text,
-                                  QCString& name,QStringList& ql)
-{
-  int index,end;
-  const char *s=":";
-  QCString temp;
-  QCString s1(text);
-  index=s1.find(s,0,FALSE);
-  if (index >=0)
-  {
-    name=s1.left(index);
-    //  strcpy(name,tt.data());
-  }
-
-  index=s1.find("(",0,FALSE);
-  end=s1.findRev(")",s1.length(),FALSE);
-  // end=s1.find(")",0,FALSE);
-
-  if ((end-index)>1) 
-  {
-    temp=s1.mid(index+1,(end-index-1));
-    ql=QStringList::split(",",temp,FALSE);
-  }
-}//parseProcessProto
 
 /*!
  * strips the "--" prefixes of vhdl comments 
@@ -972,17 +669,6 @@ void VhdlDocGen::prepareComment(QCString& qcs)
   //const char *end="--!}";
   int index=0; 
 
-#if 0
-  index=qcs.find(start,0,TRUE);
-  if (index>0)
-    temp=qcs.remove(index,strlen(start));
-  qcs=temp;
-
-  index=qcs.find(end,0,TRUE);
-  if (index>0)
-    temp=qcs.remove(index,strlen(end));
-  qcs=temp;
-#endif
   while (TRUE)
   {
     index=qcs.find(s,0,TRUE);
@@ -1003,8 +689,9 @@ void VhdlDocGen::prepareComment(QCString& qcs)
  * @param doc ???
  */
 void VhdlDocGen::parseFuncProto(const char* text,QList<Argument>& qlist,
-                                QCString& name,QCString& ret,bool doc)
+    QCString& name,QCString& ret,bool doc)
 {
+  (void)qlist; //unused
   int index,end;
   QCString s1(text);
   QCString temp;
@@ -1016,7 +703,7 @@ void VhdlDocGen::parseFuncProto(const char* text,QList<Argument>& qlist,
   {
     QCString tt=s1.mid(index,(end-index+1));
     temp=s1.mid(index+1,(end-index-1));
-    getFuncParams(qlist,temp);
+    //getFuncParams(qlist,temp);
   } 
   if (doc)
   {
@@ -1058,7 +745,7 @@ QCString VhdlDocGen::getIndexWord(const char* c,int index)
 {
   QStringList ql;
   QCString temp(c);
-  QRegExp reg("[\\s]");
+  QRegExp reg("[\\s:|]");
 
   ql=QStringList::split(reg,temp,FALSE);
 
@@ -1071,101 +758,6 @@ QCString VhdlDocGen::getIndexWord(const char* c,int index)
 }
 
 
-/*!
- * \brief returns the arguments of a function or procedure prototype
- * @param ql list ql stores the arguments
- * @param str prototype
- */
-
-void VhdlDocGen::getFuncParams(QList<Argument>& ql, const char* str)
-{
-
-  int len;
-  QCString qmem,s1,s2,ttype;
-  QCString temp(str);
-  temp=temp.stripWhiteSpace();
-  if (temp.isEmpty()) return;
-
-  QCString st(str);
-  QStringList strList;
-
-  strList=QStringList::split(";",temp,FALSE);
-  int kk=strList.count();
-  int j=kk;
-  while (kk>=1)
-  {
-    temp=strList[j-kk];
-    QStringList tempList,tt;
-    tempList=QStringList::split(":",temp,FALSE);
-    if (tempList.count()>2)
-      ttype=tempList[1];
-    else
-      ttype=tempList.last();
-
-    ttype=ttype.stripWhiteSpace();
-
-    uint zui=ttype.contains('(',FALSE);
-    if (zui == 0)
-    {
-      tt=QStringList::split(QRegExp("[\\s]"),ttype,FALSE);
-    }
-    else
-    {
-      if (ttype.stripPrefix("in"))
-	tt.append("in");
-      else if (ttype.stripPrefix("out"))
-	tt.append("out");
-      else if (ttype.stripPrefix("inout"))
-	tt.append("inout");
-      if (ttype.stripPrefix("IN"))
-	tt.append("in");
-      else if (ttype.stripPrefix("OUT"))
-	tt.append("out");
-      else if (ttype.stripPrefix("INOUT"))
-	tt.append("inout");
-
-      ttype=ttype.stripWhiteSpace();
-      tt.append(ttype);
-    }
-
-    s1=tt.first();
-    //s1=s1.lower();
-
-    if (tempList.count()>2)
-      s2=tt.last()+":"+tempList[2];
-    else
-      s2=tt.last();
-
-    QCString first=(QCString)tempList.first();
-
-    tempList.clear();
-    tt.clear();
-
-    tempList=QStringList::split(",",first,FALSE);
-    len=tempList.count();
-    ttype.resize(0);
-    for (int j=0;j<len;j++)
-    {
-      Argument *arg=new Argument;
-      QCString name=(QCString)tempList[j];
-      name=name.stripWhiteSpace();
-
-      tt=QStringList::split(QRegExp("[\\s]"),name,FALSE);
-      if (tt.count() > 1)
-	ttype=(tt.first()).stripWhiteSpace();
-
-      arg->defval=ttype.copy();
-      arg->type=s2.stripWhiteSpace();
-      arg->attrib=s1.stripWhiteSpace();
-      arg->name=(tt.last()).stripWhiteSpace();
-
-      // printf("--proto \n [%s] [%s] [%s] [%s] [%s]",ttype.data(),arg->type.data(),arg->attrib.data(),arg->name.data(),s1.data());
-      ql.append(arg);
-    }
-    kk--;
-  }//while
-} // getFuncName
-
 QCString VhdlDocGen::getProtectionName(int prot)
 {
   if (prot==VhdlDocGen::ENTITYCLASS)
@@ -1202,9 +794,8 @@ QCString VhdlDocGen::trTypeString(int type)
     case VhdlDocGen::PROCESS:        return "Process";
     case VhdlDocGen::PORT:           return "Port";
     case VhdlDocGen::GENERIC:        return "Generic";
-    case VhdlDocGen::DOCUMENT:       return "Doc"; 
     case VhdlDocGen::UNITS:          return "Units"; 
-    //case VhdlDocGen::PORTMAP:        return "Port Map"; 
+                                     //case VhdlDocGen::PORTMAP:        return "Port Map"; 
     case VhdlDocGen::SHAREDVARIABLE: return "Shared Variable"; 
     case VhdlDocGen::GROUP:          return "Group"; 
     case VhdlDocGen::VFILE:          return "File"; 
@@ -1212,6 +803,7 @@ QCString VhdlDocGen::trTypeString(int type)
     case VhdlDocGen::ALIAS:          return "Alias";
     case VhdlDocGen::CONFIG:         return "Configuration";                                     
     case VhdlDocGen::MISCELLANEOUS:  return "Miscellaneous";                                 
+    case VhdlDocGen::UCF_CONST:      return "Constraints";   
     default:                         return "";
   }
 } // convertType
@@ -1278,7 +870,7 @@ QCString VhdlDocGen::getProcessNumber()
 
 void VhdlDocGen::writeFormatString(QCString& qcs,OutputList&ol,const MemberDef* mdef)
 {
-  QRegExp reg("[\\/\\:\\<\\>\\:\\s\\,\\;\\'\\+\\-\\*\\|\\&\\=\\(\\)\"]");
+  QRegExp reg("[\\[\\]\\.\\/\\:\\<\\>\\:\\s\\,\\;\\'\\+\\-\\*\\|\\&\\=\\(\\)\"]");
   qcs+=QCString(" ");// parsing the last sign
   QCString *ss;
   QCString find=qcs;
@@ -1307,20 +899,33 @@ void VhdlDocGen::writeFormatString(QCString& qcs,OutputList&ol,const MemberDef*
       }
       else if (j != 0 && ss)
       {
-	VhdlDocGen::startFonts(find,ss->data(),ol);
+        VhdlDocGen::startFonts(find,ss->data(),ol);
       }
       else
       {
-	if (j>0)
-	{
-	  VhdlDocGen::writeStringLink(mdef,find,ol);
-	}
+        if (j>0)
+        {
+          VhdlDocGen::writeStringLink(mdef,find,ol);
+        }
       }
       VhdlDocGen::startFonts(&buf[0],"vhdlchar",ol);
 
       QCString st=temp.remove(0,j+1);
       find=st;
-      temp=st;
+      if (!find.isEmpty() && find.at(0)=='"')
+      {
+        int ii=find.find('"',2);
+        if (ii>1)
+        {
+          QCString com=find.left(ii+1);			  
+          VhdlDocGen::startFonts(com,"keyword",ol);
+          temp=find.remove(0,ii+1);      
+        }
+      }
+      else
+      {
+        temp=st;
+      }
       j = reg.match(temp.data(),0,&len);
     }//while
   }//if
@@ -1337,24 +942,14 @@ void VhdlDocGen::writeFormatString(QCString& qcs,OutputList&ol,const MemberDef*
 
 bool VhdlDocGen::isNumber(const QCString& s)
 {
-  static QRegExp regg("[0-9][0-9eEfFbBcCdDaA_.#-]*");
- 
+  static QRegExp regg("[0-9][0-9eEfFbBcCdDaA_.#-+?xXzZ]*");
+
   if (s.isEmpty()) return FALSE;
   int j,len;
   j = regg.match(s.data(),0,&len);
   if ((j==0) && (len==(int)s.length())) return TRUE; 
   return FALSE;
- 
-  #if 0
-  int len=s.length();
-  if (len==0) return FALSE;
-  for (int j=0;j<len;j++)
-  {
-    if (isdigit((int)(s.at(j) & 0xff))==0)
-      return FALSE;
-  }
-  return TRUE;
-  #endif 
+
 }// isNumber
 
 void VhdlDocGen::startFonts(const QCString& q, const char *keyword,OutputList& ol)
@@ -1378,7 +973,7 @@ void VhdlDocGen::formatString(QCString & qcs, OutputList& ol,const MemberDef* md
   qcs.stripPrefix("of");
   qcs.stripPrefix("OF");
 
-  VhdlDocGen::deleteCharRev(qcs,';');
+  // VhdlDocGen::deleteCharRev(qcs,';');
   //char white='\t';
   int len = qcs.length();
   unsigned int index=1;//temp.length();
@@ -1388,11 +983,11 @@ void VhdlDocGen::formatString(QCString & qcs, OutputList& ol,const MemberDef* md
     char c=qcs[j];
     char b=c;
     if (j>0) b=qcs[j-1];
-    if (c=='"' || c==',' || c==';' || c=='\''|| c=='(' || c==')'  || c==':' ) // || (c==':' && b!='=')) // || (c=='=' && b!='>')) 
+    if (c=='"' || c==',' || c=='\''|| c=='(' || c==')'  || c==':' || c=='[' || c==']' ) // || (c==':' && b!='=')) // || (c=='=' && b!='>')) 
     {
       if (temp.at(index-1) != ' ')
       {
-	temp+=" ";
+        temp+=" ";
       }
       temp+=c;
       temp+=" "; 
@@ -1401,14 +996,14 @@ void VhdlDocGen::formatString(QCString & qcs, OutputList& ol,const MemberDef* md
     {
       if (b==':') // := operator
       {   
-	temp.replace(index-1,1,"=");
-	temp+=" "; 
+        temp.replace(index-1,1,"=");
+        temp+=" "; 
       }
       else // = operator
       {
-	temp+=" ";      
-	temp+=c;
-	temp+=" "; 
+        temp+=" ";      
+        temp+=c;
+        temp+=" "; 
       }
     }
     else      
@@ -1508,15 +1103,15 @@ void VhdlDocGen::writeFunctionProto(OutputList& ol,const ArgumentList* al,const
       QCString *str=VhdlDocGen::findKeyWord(att);
       att+=" ";
       if (str)
-	VhdlDocGen::formatString(att,ol,mdef);
+        VhdlDocGen::formatString(att,ol,mdef);
       else
-	VhdlDocGen::startFonts(att,"vhdlchar",ol);         
+        VhdlDocGen::startFonts(att,"vhdlchar",ol);         
     }  
 
     QCString nn=arg->name;
     nn+=": ";
-    QCString ss=arg->type; //.lower();
-    QCString w=ss;//.upper();
+    QCString ss=arg->type.stripWhiteSpace(); //.lower();
+    QCString w=ss.stripWhiteSpace();//.upper();
     VhdlDocGen::startFonts(nn,"vhdlchar",ol);
     VhdlDocGen::startFonts("in ","stringliteral",ol);
     QCString *str=VhdlDocGen::findKeyWord(ss);
@@ -1525,6 +1120,10 @@ void VhdlDocGen::writeFunctionProto(OutputList& ol,const ArgumentList* al,const
     else
       VhdlDocGen::startFonts(w,"vhdlchar",ol);         
 
+    if (arg->attrib)
+      VhdlDocGen::startFonts(arg->attrib,"vhdlchar",ol);
+
+
     sem=TRUE;    
     ol.endBold();
     if (len > 2)    
@@ -1593,12 +1192,13 @@ void VhdlDocGen::writeFuncProcDocu(
     return;
   }
   ol.startParameterList(TRUE); 
+  //ol.startParameterName(FALSE);
   Argument *arg;
   bool first=TRUE;
   for (;(arg=ali.current());++ali)
   { 
     ol.startParameterType(first,"");  
-    //if (first) ol.writeChar('(');
+    //   if (first) ol.writeChar('(');
     if (VhdlDocGen::isProcedure(md))
     {
       startFonts(arg->defval,"keywordtype",ol);
@@ -1611,17 +1211,22 @@ void VhdlDocGen::writeFuncProcDocu(
     ol.docify(" ");
 
     if (VhdlDocGen::isProcedure(md))
+    {
       startFonts(arg->attrib,"stringliteral",ol);
+    }
     else if (VhdlDocGen::isVhdlFunction(md))
+    {
       startFonts(QCString("in"),"stringliteral",ol);
-
+    }
 
     ol.docify(" ");
     ol.disable(OutputGenerator::Man);
     ol.startEmphasis();
     ol.enable(OutputGenerator::Man);
     if (!VhdlDocGen::isProcess(md))
+    {
       startFonts(arg->type,"vhdlkeyword",ol);
+    }
     ol.disable(OutputGenerator::Man);
     ol.endEmphasis();
     ol.enable(OutputGenerator::Man);
@@ -1629,13 +1234,14 @@ void VhdlDocGen::writeFuncProcDocu(
     if (--index) 
     {
       ol.docify(" , ");    
-      ol.endParameterName(FALSE,FALSE,FALSE);
     }
     else
     {
-      //ol.docify(" ) ");
+      //    ol.docify(" ) ");
       ol.endParameterName(TRUE,FALSE,TRUE);
+      break;
     }
+    ol.endParameterName(FALSE,FALSE,FALSE);
 
     sem=TRUE;        
     first=FALSE;
@@ -1644,38 +1250,8 @@ void VhdlDocGen::writeFuncProcDocu(
 
 } // writeDocFunProc
 
-/*!
- * returns TRUE if this string is a function prototype or 
- * FALSE if this is a procedure
- */
-
-bool VhdlDocGen::isFunctionProto(QCString& ss)
-{
-  QCString name=ss;
-  QCString proc("procedure");
-  QCString func("function");
-  name=name.stripWhiteSpace();
-  QStringList ql=QStringList::split(QRegExp("[\\s]"),name,FALSE);
-  int j=ql.count();
-  if (j<2) return FALSE;
-  QCString tt=(QCString)ql[0].lower();
-
-  if (tt=="impure" || tt=="pure") tt=ql[1];
 
-  if (VhdlDocGen::compareString(tt,proc)!=0 && VhdlDocGen::compareString(tt,func)!=0) 
-    return FALSE;
 
-  QCString temp=(QCString)ql[j-1];
-  temp=temp.stripWhiteSpace();
-  if (stricmp(temp.data(),"is")==0)
-  {
-    VhdlDocGen::deleteCharRev(name,'s');
-    VhdlDocGen::deleteCharRev(name,'i');
-    ss=name;
-    return TRUE;
-  }
-  return FALSE;
-}
 
 QCString VhdlDocGen::convertArgumentListToString(const ArgumentList* al,bool func)
 {
@@ -1707,7 +1283,7 @@ QCString VhdlDocGen::convertArgumentListToString(const ArgumentList* al,bool fun
 
 
 void VhdlDocGen::writeVhdlDeclarations(MemberList* ml,
-                        OutputList& ol,GroupDef* gd,ClassDef* cd,FileDef *fd)
+    OutputList& ol,GroupDef* gd,ClassDef* cd,FileDef *fd,NamespaceDef* nd)
 {
   static ClassDef *cdef;
   //static GroupDef* gdef;
@@ -1718,36 +1294,38 @@ void VhdlDocGen::writeVhdlDeclarations(MemberList* ml,
   }
 
   /*
-  if (gd && gdef==gd) return;
-  if (gd && gdef!=gd)
-  {
-    gdef=gd;
-  }
-*/
-  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::LIBRARY,FALSE),0,FALSE,VhdlDocGen::LIBRARY);
-  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::USE,FALSE),0,FALSE,VhdlDocGen::USE);
-  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::FUNCTION,FALSE),0,FALSE,VhdlDocGen::FUNCTION);
-  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::COMPONENT,FALSE),0,FALSE,VhdlDocGen::COMPONENT);
-  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::CONSTANT,FALSE),0,FALSE,VhdlDocGen::CONSTANT);
-  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::TYPE,FALSE),0,FALSE,VhdlDocGen::TYPE);
-  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::SUBTYPE,FALSE),0,FALSE,VhdlDocGen::SUBTYPE);
-  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::GENERIC,FALSE),0,FALSE,VhdlDocGen::GENERIC);
-  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::PORT,FALSE),0,FALSE,VhdlDocGen::PORT);
-  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::PROCESS,FALSE),0,FALSE,VhdlDocGen::PROCESS);
-  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::SIGNAL,FALSE),0,FALSE,VhdlDocGen::SIGNAL);
-  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::ATTRIBUTE,FALSE),0,FALSE,VhdlDocGen::ATTRIBUTE);
-  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::PROCEDURE,FALSE),0,FALSE,VhdlDocGen::PROCEDURE);
-  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::RECORD,FALSE),0,FALSE,VhdlDocGen::RECORD);
-  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::UNITS,FALSE),0,FALSE,VhdlDocGen::UNITS);
-  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::SHAREDVARIABLE,FALSE),0,FALSE,VhdlDocGen::SHAREDVARIABLE);
-  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::VFILE,FALSE),0,FALSE,VhdlDocGen::VFILE);
-  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::GROUP,FALSE),0,FALSE,VhdlDocGen::GROUP);
-  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::COMPONENT_INST,FALSE),0,FALSE,VhdlDocGen::COMPONENT_INST);
-  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::ALIAS,FALSE),0,FALSE,VhdlDocGen::ALIAS);
-  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::MISCELLANEOUS),0,FALSE,VhdlDocGen::MISCELLANEOUS);
-  
+     if (gd && gdef==gd) return;
+     if (gd && gdef!=gd)
+     {
+     gdef=gd;
+     }
+   */
+  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::LIBRARY,FALSE),0,FALSE,VhdlDocGen::LIBRARY);
+  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::USE,FALSE),0,FALSE,VhdlDocGen::USE);
+  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::FUNCTION,FALSE),0,FALSE,VhdlDocGen::FUNCTION);
+  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::COMPONENT,FALSE),0,FALSE,VhdlDocGen::COMPONENT);
+  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::CONSTANT,FALSE),0,FALSE,VhdlDocGen::CONSTANT);
+  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::TYPE,FALSE),0,FALSE,VhdlDocGen::TYPE);
+  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::SUBTYPE,FALSE),0,FALSE,VhdlDocGen::SUBTYPE);
+  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::GENERIC,FALSE),0,FALSE,VhdlDocGen::GENERIC);
+  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::PORT,FALSE),0,FALSE,VhdlDocGen::PORT);
+  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::PROCESS,FALSE),0,FALSE,VhdlDocGen::PROCESS);
+  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::SIGNAL,FALSE),0,FALSE,VhdlDocGen::SIGNAL);
+  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::ATTRIBUTE,FALSE),0,FALSE,VhdlDocGen::ATTRIBUTE);
+  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::PROCEDURE,FALSE),0,FALSE,VhdlDocGen::PROCEDURE);
+  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::RECORD,FALSE),0,FALSE,VhdlDocGen::RECORD);
+  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::UNITS,FALSE),0,FALSE,VhdlDocGen::UNITS);
+  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::SHAREDVARIABLE,FALSE),0,FALSE,VhdlDocGen::SHAREDVARIABLE);
+  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::VFILE,FALSE),0,FALSE,VhdlDocGen::VFILE);
+  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::GROUP,FALSE),0,FALSE,VhdlDocGen::GROUP);
+  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::COMPONENT_INST,FALSE),0,FALSE,VhdlDocGen::COMPONENT_INST);
+  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::ALIAS,FALSE),0,FALSE,VhdlDocGen::ALIAS);
+  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::MISCELLANEOUS),0,FALSE,VhdlDocGen::MISCELLANEOUS);
+
   // configurations must be added to global file definitions.  
-  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,fd,gd,theTranslator_vhdlType(VhdlDocGen::CONFIG,FALSE),0,FALSE,VhdlDocGen::CONFIG);
+  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::CONFIG,FALSE),0,FALSE,VhdlDocGen::CONFIG);
+  VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::UCF_CONST,FALSE),0,FALSE,VhdlDocGen::UCF_CONST);
+
 }
 
 static void setGlobalType(MemberList *ml)
@@ -1757,15 +1335,17 @@ static void setGlobalType(MemberList *ml)
   MemberListIterator mmli(*ml);
   for ( ; (mdd=mmli.current()); ++mmli )
   {
-    if (stricmp(mdd->argsString(),"configuration")==0)
+    QCString l=mdd->typeString();
+
+    if (strcmp(mdd->argsString(),"configuration")==0)
     {
       mdd->setMemberSpecifiers(VhdlDocGen::CONFIG);        
     }
-    else if (stricmp(mdd->typeString(),"library")==0)
+    else if (strcmp(mdd->typeString(),"library")==0)
     {
       mdd->setMemberSpecifiers(VhdlDocGen::LIBRARY);        
     }
-    else if (stricmp(mdd->typeString(),"package")==0)
+    else if (strcmp(mdd->typeString(),"package")==0)
     {
       mdd->setMemberSpecifiers(VhdlDocGen::USE);        
     } 
@@ -1773,6 +1353,10 @@ static void setGlobalType(MemberList *ml)
     {
       mdd->setMemberSpecifiers(VhdlDocGen::MISCELLANEOUS);        
     } 
+    else if (stricmp(mdd->typeString(),"ucf_const")==0)
+    {
+      mdd->setMemberSpecifiers(VhdlDocGen::UCF_CONST);        
+    } 
   }
 }
 
@@ -1780,7 +1364,12 @@ static void setGlobalType(MemberList *ml)
 void VhdlDocGen::writeVHDLTypeDocumentation(const MemberDef* mdef, const Definition *d, OutputList &ol)
 {
   ClassDef *cd=(ClassDef*)d;
+
   if (cd==0) return;
+
+  QCString ttype=mdef->typeString();
+  QCString largs=mdef->argsString();	
+
   if ((VhdlDocGen::isVhdlFunction(mdef) || VhdlDocGen::isProcedure(mdef) || VhdlDocGen::isProcess(mdef)))
   {
     QCString nn=mdef->typeString();
@@ -1790,6 +1379,7 @@ void VhdlDocGen::writeVHDLTypeDocumentation(const MemberDef* mdef, const Definit
     if (memdef && memdef->isLinkable()) 
     { 
       ol.docify(" ");
+
       ol.startBold();
       //ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),0,mdef->typeString());                
       writeLink(memdef,ol);
@@ -1799,7 +1389,6 @@ void VhdlDocGen::writeVHDLTypeDocumentation(const MemberDef* mdef, const Definit
     else
     {
       ol.docify(" ");
-      QCString ttype=mdef->typeString();
       VhdlDocGen::formatString(ttype,ol,mdef);
       ol.docify(" "); 
     }
@@ -1807,22 +1396,46 @@ void VhdlDocGen::writeVHDLTypeDocumentation(const MemberDef* mdef, const Definit
     VhdlDocGen::writeFuncProcDocu(mdef,ol, mdef->argumentList().pointer());
   }
 
-  if(VhdlDocGen::isMisc(mdef))
-  {
-    writeLink(mdef,ol);
-    return;
-  }
+
   if (mdef->isVariable())
-  { 
+  {
     //ol.docify(mdef->name().data());
-    writeLink(mdef,ol);
-    ol.docify(" ");
-    QCString ttype=mdef->typeString();
-    VhdlDocGen::formatString(ttype,ol,mdef);
+    //   QCString ttype;
+    if (VhdlDocGen::isConstraint(mdef))
+    {
+
+      writeLink(mdef,ol);
+      ol.docify(" ");
+
+      largs=largs.replace(QRegExp("#")," ");
+      VhdlDocGen::formatString(largs,ol,mdef);
+      return;
+    }
+    else
+    { 
+      writeLink(mdef,ol);
+      ol.docify(" ");
+      //	 ttype=mdef->typeString();
+    }
+
+    // QCString largs=mdef->argsString();	
+
+
+    bool brec=largs.stripPrefix("record");
+
+    if (!brec)	 
+      VhdlDocGen::formatString(ttype,ol,mdef);
+
+    if (brec || largs.stripPrefix("units"))
+    {	  
+      VhdlDocGen::writeRecUnitDocu(mdef,ol,largs);
+      return;	  
+    }
+
     ol.docify(" ");
-    if (VhdlDocGen::isPort(mdef))
+    if (VhdlDocGen::isPort(mdef) || VhdlDocGen::isGeneric(mdef))
     {
-      QCString largs=mdef->argsString();
+      // QCString largs=mdef->argsString();
       VhdlDocGen::formatString(largs,ol,mdef);
       ol.docify(" ");
     }
@@ -1835,7 +1448,7 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol,
     ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,
     bool /*inGroup*/) 
 {
-
+  static QRegExp reg("[%]");
   LockingPtr<MemberDef> lock(mdef,mdef);
 
   Definition *d=0;
@@ -1853,9 +1466,9 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol,
    */
 
   ASSERT(cd!=0 || nd!=0 || fd!=0 || gd!=0 || 
-         mdef->getMemberSpecifiers()==VhdlDocGen::LIBRARY || 
-         mdef->getMemberSpecifiers()==VhdlDocGen::USE   
-        ); // member should belong to something
+      mdef->getMemberSpecifiers()==VhdlDocGen::LIBRARY || 
+      mdef->getMemberSpecifiers()==VhdlDocGen::USE   
+      ); // member should belong to something
   if (cd) d=cd; 
   else if (nd) d=nd; 
   else if (fd) d=fd; 
@@ -1866,27 +1479,27 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol,
   if (!Config_getString("GENERATE_TAGFILE").isEmpty())
   {
     Doxygen::tagFile << "    <member kind=\"";
-    if      (VhdlDocGen::isGeneric(mdef))      Doxygen::tagFile << "generic";
-    if      (VhdlDocGen::isPort(mdef))         Doxygen::tagFile << "port";
-    if      (VhdlDocGen::isEntity(mdef))       Doxygen::tagFile << "entity";
-    if      (VhdlDocGen::isComponent(mdef))    Doxygen::tagFile << "component";
-    if      (VhdlDocGen::isVType(mdef))        Doxygen::tagFile << "type";
-    if      (VhdlDocGen::isConstant(mdef))     Doxygen::tagFile << "constant";
-    if      (VhdlDocGen::isSubType(mdef))      Doxygen::tagFile << "subtype";
-    if      (VhdlDocGen::isVhdlFunction(mdef)) Doxygen::tagFile << "function";
-    if      (VhdlDocGen::isProcedure(mdef))    Doxygen::tagFile << "procedure";
-    if      (VhdlDocGen::isProcess(mdef))      Doxygen::tagFile << "process";
-    if      (VhdlDocGen::isSignals(mdef))      Doxygen::tagFile << "signal";
-    if      (VhdlDocGen::isAttribute(mdef))    Doxygen::tagFile << "attribute";
-    if      (VhdlDocGen::isRecord(mdef))       Doxygen::tagFile << "record";
-    if      (VhdlDocGen::isLibrary(mdef))      Doxygen::tagFile << "library";
-    if      (VhdlDocGen::isPackage(mdef))      Doxygen::tagFile << "package";
-    if      (VhdlDocGen::isVariable(mdef))     Doxygen::tagFile << "shared variable";
-    if      (VhdlDocGen::isFile(mdef))         Doxygen::tagFile << "file";
-    if      (VhdlDocGen::isGroup(mdef))        Doxygen::tagFile << "group";
-    if      (VhdlDocGen::isCompInst(mdef))     Doxygen::tagFile << "component instantiation";
-    if      (VhdlDocGen::isAlias(mdef))        Doxygen::tagFile << "alias";
-    if      (VhdlDocGen::isCompInst(mdef))     Doxygen::tagFile << "configuration";
+    if (VhdlDocGen::isGeneric(mdef))      Doxygen::tagFile << "generic";
+    if (VhdlDocGen::isPort(mdef))         Doxygen::tagFile << "port";
+    if (VhdlDocGen::isEntity(mdef))       Doxygen::tagFile << "entity";
+    if (VhdlDocGen::isComponent(mdef))    Doxygen::tagFile << "component";
+    if (VhdlDocGen::isVType(mdef))        Doxygen::tagFile << "type";
+    if (VhdlDocGen::isConstant(mdef))     Doxygen::tagFile << "constant";
+    if (VhdlDocGen::isSubType(mdef))      Doxygen::tagFile << "subtype";
+    if (VhdlDocGen::isVhdlFunction(mdef)) Doxygen::tagFile << "function";
+    if (VhdlDocGen::isProcedure(mdef))    Doxygen::tagFile << "procedure";
+    if (VhdlDocGen::isProcess(mdef))      Doxygen::tagFile << "process";
+    if (VhdlDocGen::isSignals(mdef))      Doxygen::tagFile << "signal";
+    if (VhdlDocGen::isAttribute(mdef))    Doxygen::tagFile << "attribute";
+    if (VhdlDocGen::isRecord(mdef))       Doxygen::tagFile << "record";
+    if (VhdlDocGen::isLibrary(mdef))      Doxygen::tagFile << "library";
+    if (VhdlDocGen::isPackage(mdef))      Doxygen::tagFile << "package";
+    if (VhdlDocGen::isVariable(mdef))     Doxygen::tagFile << "shared variable";
+    if (VhdlDocGen::isFile(mdef))         Doxygen::tagFile << "file";
+    if (VhdlDocGen::isGroup(mdef))        Doxygen::tagFile << "group";
+    if (VhdlDocGen::isCompInst(mdef))     Doxygen::tagFile << "component instantiation";
+    if (VhdlDocGen::isAlias(mdef))        Doxygen::tagFile << "alias";
+    if (VhdlDocGen::isCompInst(mdef))     Doxygen::tagFile << "configuration";
 
     Doxygen::tagFile << "\">" << endl;
     Doxygen::tagFile << "      <type>" << convertToXML(mdef->typeString()) << "</type>" << endl;
@@ -1915,7 +1528,7 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol,
   }
 
   QCString cname  = d->name();
-  QCString cfname = mdef->getOutputFileBase();
+  QCString cfname = d->getOutputFileBase();
 
   //HtmlHelp *htmlHelp=0;
   //  bool hasHtmlHelp = Config_getBool("GENERATE_HTML") && Config_getBool("GENERATE_HTMLHELP");
@@ -1947,16 +1560,19 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol,
   }
   // *** write type
   /*VHDL CHANGE */
+  bool bRec,bUnit;
   QCString ltype(mdef->typeString()); 
+  ltype=ltype.replace(reg," ");
   QCString largs(mdef->argsString());
+  largs=largs.replace(reg," ");
   int mm=mdef->getMemberSpecifiers();
-  //printf(":: ltype=%s largs=%s name=%s mm=%d\n",
-  //    ltype.data(),largs.data(),mdef->name().data(),mm);
-
+  mdef->setType(ltype.data());
+  mdef->setArgsString(largs.data());
+  //ClassDef * plo=mdef->getClassDef();
   ClassDef *kl=0;
-  //FileDef *fdd=0;
   LockingPtr<ArgumentList> alp = mdef->argumentList();
   QCString nn;
+
   if (gd) gd=0;
   switch(mm)
   {
@@ -1970,13 +1586,13 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol,
       ol.endBold();
       ol.insertMemberAlign();
       ol.docify(" ");
-	
+
       writeLink(mdef,ol);
       if (alp!=0 && mm==VhdlDocGen::FUNCTION)
-	VhdlDocGen::writeFunctionProto(ol,alp.pointer(),mdef);
+        VhdlDocGen::writeFunctionProto(ol,alp.pointer(),mdef);
 
       if (alp!=0 && mm==VhdlDocGen::PROCEDURE)
-	VhdlDocGen::writeProcedureProto(ol,alp.pointer(),mdef);
+        VhdlDocGen::writeProcedureProto(ol,alp.pointer(),mdef);
 
       break;
     case VhdlDocGen::USE:
@@ -2007,25 +1623,28 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol,
       writeLink(mdef,ol);
       ol.insertMemberAlign();
       break;
+
     case VhdlDocGen::GENERIC:
     case VhdlDocGen::PORT:
+    case VhdlDocGen::ALIAS: 
+
       writeLink(mdef,ol);
       ol.docify(" ");
       ol.insertMemberAlign();
       if (mm==VhdlDocGen::GENERIC)
       {
-	ol.startBold();
-	VhdlDocGen::formatString(ltype,ol,mdef);
-	ol.endBold();
+        ol.startBold();
+        VhdlDocGen::formatString(largs,ol,mdef);
+        ol.endBold();
       }
       else
       {
-	ol.docify(" ");
-	ol.startBold();
-	ol.docify(mdef->typeString());
-	ol.endBold();
-	ol.docify(" ");
-	VhdlDocGen::formatString(largs,ol,mdef);
+        ol.docify(" ");
+        ol.startBold();
+        VhdlDocGen::formatString(ltype,ol,mdef);
+        ol.endBold();
+        ol.docify(" ");
+        VhdlDocGen::formatString(largs,ol,mdef);
       }
       break;
     case VhdlDocGen::PROCESS:
@@ -2038,10 +1657,21 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol,
     case VhdlDocGen::COMPONENT:
     case VhdlDocGen::COMPONENT_INST:
     case VhdlDocGen::CONFIG:
-      writeLink(mdef,ol);
+      if (VhdlDocGen::isCompInst(mdef) )
+      {
+        largs.prepend("::");
+        largs.prepend(mdef->name().data());
+        ol.writeObjectLink(mdef->getReference(),
+            cfname,
+            mdef->anchor(),
+            mdef->name());
+      }
+      else
+        writeLink(mdef,ol);
+
       ol.insertMemberAlign();
       ol.docify("  ");
-       
+
       ol.startBold();
       ol.docify(ltype);
       ol.endBold();
@@ -2052,19 +1682,20 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol,
       {
         if (VhdlDocGen::isConfig(mdef) || VhdlDocGen::isCompInst(mdef))
         {
+          nn=mdef->getOutputFileBase();
           nn=ltype;
         }
         else
         {
-	  nn=mdef->name();
+          nn=mdef->name();
         }
-	kl=getClass(nn.data());
-	if (kl) 
-	{
-	  nn=kl->getOutputFileBase();
-	  ol.pushGeneratorState();
-	  ol.disableAllBut(OutputGenerator::Html);
-	  ol.startEmphasis();
+        kl=getClass(nn.data());
+        if (kl) 
+        {
+          nn=kl->getOutputFileBase();
+          ol.pushGeneratorState();
+          ol.disableAllBut(OutputGenerator::Html);
+          ol.startEmphasis();
           QCString name("<Entity ");
           if (VhdlDocGen::isConfig(mdef) || VhdlDocGen::isCompInst(mdef))
           {
@@ -2074,46 +1705,48 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol,
           {
             name+=mdef->name()+"> ";
           }
-	  ol.writeObjectLink(kl->getReference(),kl->getOutputFileBase(),0,name.data());
-	  ol.endEmphasis();
-	  ol.popGeneratorState();
-	}
+          ol.writeObjectLink(kl->getReference(),kl->getOutputFileBase(),0,name.data());
+          ol.endEmphasis();
+          ol.popGeneratorState();
+        }
       } 
       break;
+    case VhdlDocGen::UCF_CONST: 
+      mm=mdef->name().findRev('_');
+      if (mm>0)		 
+        mdef->setName(mdef->name().left(mm));
+      writeUCFLink(mdef,ol);
+      break;
     case VhdlDocGen::SIGNAL:
     case VhdlDocGen::ATTRIBUTE:
-    case VhdlDocGen::TYPE:
     case VhdlDocGen::SUBTYPE:
     case VhdlDocGen::CONSTANT:      
     case VhdlDocGen::SHAREDVARIABLE:    
     case VhdlDocGen::VFILE:
     case VhdlDocGen::GROUP: 
-    case VhdlDocGen::ALIAS: 
       writeLink(mdef,ol);
       ol.docify(" ");
       ol.insertMemberAlign();
       VhdlDocGen::formatString(ltype,ol,mdef);
       break;
-    case VhdlDocGen::RECORD:    
-      writeLink(mdef,ol);
-      ol.docify(" ");
-      ol.startBold();
-      if (ltype.isEmpty()) ol.docify("     : record");    
-      ol.insertMemberAlign();
-      if (!ltype.isEmpty()) 
-	VhdlDocGen::formatString(ltype,ol,mdef);
-      ol.endBold();
-      break;
-    case VhdlDocGen::UNITS:
+    case VhdlDocGen::TYPE:    
+      bRec=largs.stripPrefix("record") ;
+      bUnit=largs.stripPrefix("units") ;
       ol.startBold();
+      if (bRec)
+        ol.docify("record: ");
+      if (bUnit)
+        ol.docify("units: ");
       writeLink(mdef,ol);
-      ol.docify(" ");
-      if (ltype.isEmpty()) ol.docify("     : unit");    
       ol.insertMemberAlign();
-      if (!ltype.isEmpty())
-	VhdlDocGen::formatString(ltype,ol,mdef);
+      if (!bRec) 
+        VhdlDocGen::formatString(ltype,ol,mdef);
+      if (bUnit) ol.lineBreak();
+      if (bRec || bUnit)
+        writeRecorUnit(largs,ol,mdef);
       ol.endBold();    
       break;
+
     default: break;
   }
 
@@ -2141,8 +1774,8 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol,
   {
     ol.startMemberDescription();
     ol.parseDoc(mdef->briefFile(),mdef->briefLine(),
-                mdef->getOuterScope()?mdef->getOuterScope():d,
-                mdef,mdef->briefDescription(),TRUE,FALSE,0,TRUE,FALSE);
+        mdef->getOuterScope()?mdef->getOuterScope():d,
+        mdef,mdef->briefDescription(),TRUE,FALSE,0,TRUE,FALSE);
     if (detailsVisible) 
     {
       ol.pushGeneratorState();
@@ -2151,11 +1784,11 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol,
       ol.docify(" ");
       if (mdef->getGroupDef()!=0 && gd==0) // forward link to the group
       {
-	ol.startTextLink(mdef->getOutputFileBase(),mdef->anchor());
+        ol.startTextLink(mdef->getOutputFileBase(),mdef->anchor());
       }
       else // local link
       {
-	ol.startTextLink(0,mdef->anchor());
+        ol.startTextLink(0,mdef->anchor());
       }
       ol.endTextLink();
       //ol.startEmphasis();
@@ -2172,9 +1805,9 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol,
 void VhdlDocGen::writeLink(const MemberDef* mdef,OutputList &ol) 
 {
   ol.writeObjectLink(mdef->getReference(),
-                     mdef->getOutputFileBase(),
-		     mdef->anchor(),
-		     mdef->name());
+      mdef->getOutputFileBase(),
+      mdef->anchor(),
+      mdef->name());
 }
 
 void VhdlDocGen::writePlainVHDLDeclarations(
@@ -2201,9 +1834,9 @@ void VhdlDocGen::writePlainVHDLDeclarations(
     {
       if (!pack.find(md->name().data()))
       {
-	if (first) ol.startMemberList(),first=FALSE;
-	VhdlDocGen::writeVHDLDeclaration(md,ol,cd,nd,fd,gd,FALSE);
-	pack.append(md->name().data(),new QCString(md->name().data()));
+        if (first) ol.startMemberList(),first=FALSE;
+        VhdlDocGen::writeVHDLDeclaration(md,ol,cd,nd,fd,gd,FALSE);
+        pack.append(md->name().data(),new QCString(md->name().data()));
       }
     } //if
   } //for
@@ -2310,9 +1943,13 @@ void VhdlDocGen::adjustRecordMember(MemberDef *mdef)
 
 /* strips the prefix for package and package body */
 
-bool VhdlDocGen::writeClassType( ClassDef * cd,
-                                 OutputList &ol ,QCString & cname)
+bool VhdlDocGen::writeClassType( ClassDef *& cd,
+    OutputList &ol ,QCString & cname)
 {
+  //static ClassDef *prev = 0;
+  //if (prev == cd)  return TRUE;
+  //if (cd != prev) prev=cd;
+
   int id=cd->protection();
   QCString qcs = VhdlDocGen::trTypeString(id+2);
   cname=VhdlDocGen::getClassName(cd);
@@ -2320,6 +1957,7 @@ bool VhdlDocGen::writeClassType( ClassDef * cd,
   ol.writeString(qcs.data());
   ol.writeString(" ");
   ol.endBold();
+  //ol.insertMemberAlign();
   return FALSE;
 }// writeClassLink
 
@@ -2373,15 +2011,13 @@ QCString VhdlDocGen::trVhdlType(int type,bool sing)
       if (sing) return "Port";          
       else      return "Ports";
     case VhdlDocGen::USE:          
-      if (sing) return "Package";       
-      else      return "Packages";
+      if (sing) return "use clause";       
+      else      return "Use Clauses";
     case VhdlDocGen::GENERIC:      
       if (sing) return "Generic";       
       else      return "Generics";
     case VhdlDocGen::PACKAGE_BODY: 
       return "Package Body";
-    case VhdlDocGen::DOCUMENT:     
-      return "Doc"; 
     case VhdlDocGen::UNITS:        
       return "Units"; 
     case VhdlDocGen::SHAREDVARIABLE:     
@@ -2402,8 +2038,10 @@ QCString VhdlDocGen::trVhdlType(int type,bool sing)
     case VhdlDocGen::CONFIG:        
       if (sing) return "Configuration";       
       return "Configurations";
-     case VhdlDocGen::MISCELLANEOUS:
+    case VhdlDocGen::MISCELLANEOUS:
       return "Miscellaneous";  
+    case VhdlDocGen::UCF_CONST:        
+      return "Constraints";
     default:                       
       return "Class";
   }
@@ -2427,7 +2065,7 @@ QCString VhdlDocGen::trDesignUnitMembers()
 QCString VhdlDocGen::trDesignUnitListDescription()
 {
   return "Here is a list of all design unit members with links to "
-         "the Entities and Packages they belong to:"; 
+    "the Entities  they belong to:"; 
 }
 
 QCString VhdlDocGen::trDesignUnitIndex()
@@ -2447,18 +2085,6 @@ QCString VhdlDocGen::trFunctionAndProc()
 
 
 
-/*! adds  documentation to a function/procedure */
-bool VhdlDocGen::writeDoc(EntryNav* rootNav)
-{
-  Entry *e=rootNav->entry();
-  //if (e->section==Entry::Entry::OVERLOADDOC_SEC) 
-  if (stricmp(e->type.data(),"function")==0)
-  {
-    VhdlDocGen::addFuncDoc(rootNav);     
-  }
-
-  return FALSE;
-}// writeDoc
 
 
 /* do not insert the same component twice */
@@ -2491,11 +2117,11 @@ void VhdlDocGen::writeStringLink(const MemberDef *mdef,QCString mem, OutputList&
       MemberDef* memdef=VhdlDocGen::findMember(n,mem);
       if (memdef && memdef->isLinkable()) 
       { 
-	ol.startBold();
-	writeLink(memdef,ol);                
-	ol.endBold();
-	ol.docify(" ");
-	return;
+        ol.startBold();
+        writeLink(memdef,ol);                
+        ol.endBold();
+        ol.docify(" ");
+        return;
       }
     }
   }
@@ -2513,20 +2139,18 @@ void VhdlDocGen::writeCodeFragment( MemberDef *mdef,OutputList& ol)
   //int start=mdef->getStartBodyLine();
   //int end=mdef->getEndBodyLine();
   QStringList qsl=QStringList::split("\n",codeFragment);
-
   writeLink(mdef,ol);
   ol.docify(" ");
   ol.insertMemberAlign();
-  int len = qsl.count();	
-  int j;
-  for (j=0;j<len;j++)
+  int len= qsl.count();	
+  for(int j=0;j<len;j++)
   {
     QCString q=(QCString)qsl[j];
     VhdlDocGen::writeFormatString(q,ol,mdef);
     ol.lineBreak(); 
     if (j==2) // only the first three lines are shown
     {
-      q="...";
+      q = "...";
       VhdlDocGen::writeFormatString(q,ol,mdef);
       break;
     }
@@ -2550,17 +2174,17 @@ void VhdlDocGen::writeSource(MemberDef *mdef,OutputList& ol,QCString & cname)
   ol.startParagraph();
   ol.startCodeFragment();
   pIntf->parseCode(ol,               // codeOutIntf
-                   scope,            // scope
-                   codeFragment,     // input
-                   FALSE,            // isExample
-                   0,                // exampleName
-                   fd,               // fileDef
-                   start,            // startLine
-                   end,              // endLine
-                   TRUE,             // inlineFragment
-                   mdef,             // memberDef
-                   FALSE             // show line numbers
-                   );
+      scope,            // scope
+      codeFragment,     // input
+      FALSE,            // isExample
+      0,                // exampleName
+      fd,               // fileDef
+      start,            // startLine
+      end,              // endLine
+      TRUE,             // inlineFragment
+      mdef,             // memberDef
+      FALSE             // show line numbers
+      );
   ol.endCodeFragment();
   ol.endParagraph();
 
@@ -2569,3 +2193,540 @@ void VhdlDocGen::writeSource(MemberDef *mdef,OutputList& ol,QCString & cname)
   mdef->writeSourceReffedBy(ol,cname);
 }
 
+
+QCString VhdlDocGen::convertFileNameToClassName(QCString name)
+{
+
+  QCString n=name;
+  n=n.remove(0,6);
+
+  int i=0;
+
+  while((i=n.find("__"))>0)
+  {
+    n=n.remove(i,1);
+  }
+
+  while((i=n.find("_1"))>0)
+  {
+    n=n.replace(i,2,":");
+  }
+
+  return n;
+}
+
+void VhdlDocGen::parseUCF(const char*  input,  Entry* entity,QCString fileName,bool altera)
+{
+  QCString ucFile(input);
+  int lineNo=0;
+  QCString  newLine="\n";
+  QCString comment("##");
+  QCString brief;
+
+  while(!ucFile.isEmpty())
+  {
+    int i=ucFile.find("\n"); 
+    if (i<0) break;
+    lineNo++;
+    QCString temp=ucFile.left(i);
+    temp=temp.stripWhiteSpace();
+    if (!temp.isEmpty())
+    {
+      if (temp.stripPrefix("##") || temp.stripPrefix("//") )
+      {
+        brief+=temp;
+        brief.append("\\n");
+      }
+      else if (!temp.stripPrefix("#"))
+      {	      
+        if (altera)
+        {
+          int i=temp.find("-name");
+          if (i>0)
+            temp=temp.remove(0,i+5);
+
+          temp.stripPrefix("set_location_assignment");
+
+          initUCF(entity,0,temp,lineNo,fileName,brief);
+        }
+        else
+        {
+          QRegExp ee("[\\s=]");
+          int i=temp.find(ee);
+          QCString ff=temp.left(i);			  
+          temp.stripPrefix(ff.data());
+          ff.append("#");			  		  
+          if (!temp.isEmpty())
+          {
+            initUCF(entity,ff.data(),temp,lineNo,fileName,brief);
+          }
+        }
+      }
+    }//temp
+
+    ucFile=ucFile.remove(0,i+1);
+  }// while 
+}
+
+static void initUCF(Entry* root,const char*  type,QCString &  qcs,int line,QCString & fileName,QCString & brief)
+{
+  if (qcs.isEmpty())return; 
+  QRegExp sp("\\s");
+  QRegExp reg("[\\s=]");
+  QCString n;
+  // bool bo=(stricmp(type,qcs.data())==0);
+
+  VhdlDocGen::deleteAllChars(qcs,';');
+  qcs=qcs.stripWhiteSpace();  
+
+  int i= qcs.find(reg); 
+  if (i<0) return;
+  if (i==0)
+  { 
+    n=type;
+    VhdlDocGen::deleteAllChars(n,'#');
+    type="";
+  }  
+  else
+  {
+    n=qcs.left(i);
+  }
+  qcs=qcs.remove(0,i+1);
+  //  qcs.prepend("|");
+
+  qcs.stripPrefix("=");
+
+  Entry* current=new Entry;
+  current->spec=VhdlDocGen::UCF_CONST;
+  current->section=Entry::VARIABLE_SEC;
+  current->bodyLine=line;
+  current->fileName=fileName;
+  current->type="ucf_const";
+  //if (!bo) 
+  //current->args=type;
+  current->args+=qcs;
+  current->lang=  SrcLangExt_VHDL ;
+
+  // adding dummy name for constraints like VOLTAGE=5,TEMPERATURE=20 C 
+  if (n.isEmpty())
+  {
+    n="dummy";
+    n+=VhdlDocGen::getRecordNumber();
+  }
+
+  current->name= n+"_";
+  current->name.append(VhdlDocGen::getRecordNumber().data());
+
+  if (!brief.isEmpty())
+  {
+    current->brief=brief;
+    current->briefLine=line;
+    current->briefFile=fileName;
+    brief.resize(0);
+  }
+
+  root->addSubEntry(current);
+}
+
+
+static void writeUCFLink(const MemberDef* mdef,OutputList &ol)
+{
+
+  QCString largs(mdef->argsString());
+  QCString n= VhdlDocGen::splitString(largs, '#');
+  // VhdlDocGen::adjustRecordMember(mdef);
+  bool equ=(n.length()==largs.length());
+
+  if (!equ)
+  {
+    ol.writeString(n.data());
+    ol.docify(" ");
+    ol.insertMemberAlign();
+  }
+
+  if (mdef->name().contains("dummy")==0)
+    VhdlDocGen::writeLink(mdef,ol);
+  if (equ)
+    ol.insertMemberAlign();
+  ol.docify(" ");
+  VhdlDocGen::formatString(largs,ol,mdef);
+}
+
+QCString VhdlDocGen::splitString(QCString& str,  char c)
+{
+  QCString n=str;
+  int i=str.find(c);
+  if (i>0) 
+  {
+    n=str.left(i);
+    str=str.remove(0,i+1);
+  }
+  return n;
+}
+
+bool VhdlDocGen::findConstraintFile(LayoutNavEntry *lne)
+{
+  FileName *fn=Doxygen::inputNameList->first();
+  //LayoutNavEntry *cc = LayoutDocManager::instance().rootNavEntry()->find(LayoutNavEntry::Files);
+
+  LayoutNavEntry *kk = lne->parent();//   find(LayoutNavEntry::Files);
+  // LayoutNavEntry *kks = kk->parent();//   find(LayoutNavEntry::Files);
+  QCString file;
+  QCString co("Constraints");
+  while (fn)
+  {
+    FileDef *fd=fn->first();
+    if (fd->name().contains(".ucf") || fd->name().contains(".qsf"))
+    {
+      file = convertNameToFile(fd->name().data(),FALSE,FALSE);
+      LayoutNavEntry *ucf=new LayoutNavEntry(lne,LayoutNavEntry::MainPage,TRUE,file,co,"");  
+      kk->addChild(ucf); 
+      //   break;
+    }
+    fn=Doxygen::inputNameList->next();
+  }
+  return  FALSE;
+}
+
+void VhdlDocGen::writeAlphbeticalClass(OutputList& ol,const ClassDef* cd,const QCString & cname)
+{ 
+  if (cname.contains("::")==0)
+  {	
+    ClassDef*oo=	VhdlDocGen::findArchitecture(cd);
+    ol.writeObjectLink(cd->getReference(),
+        cd->getOutputFileBase(),0,cname);
+    if (oo)
+    {
+      ol.docify(" [");
+      ol.writeObjectLink(oo->getReference(),
+          oo->getOutputFileBase(),0,"arch");
+      ol.docify("] ");
+    }
+  }
+}
+
+
+
+
+//        for cell_inst : [entity] work.proto [ (label|expr) ]
+QCString  VhdlDocGen::parseForConfig(QCString & entity,QCString & arch)
+{
+  int index;
+  QCString label;
+  QCString ent("entity");	
+  if (!entity.contains(":")) return "";
+
+  QRegExp exp("[:()\\s]");
+  QStringList ql=QStringList::split(exp,entity,FALSE);
+  //int ii=ql.findIndex(ent);
+  assert(ql.count()>=2);
+  label = (QCString)ql[0];
+  entity = (QCString)ql[1];
+  if ((index=entity.findRev("."))>=0)
+  {
+    entity.remove(0,index+1);
+  }
+
+  if (ql.count()==3)
+  {
+    arch= (QCString)ql[2];
+    ql=QStringList::split(exp,arch,FALSE);
+    if (ql.count()>1) // expression
+      arch="";
+  }
+  return label; // label
+}
+
+
+//        use (configuration|entity|open) work.test [(cellfor)];
+
+QCString  VhdlDocGen::parseForBinding(QCString & entity,QCString & arch)
+{
+  int index;
+  QRegExp exp("[()\\s]");
+
+  QCString label="";
+  QStringList ql=QStringList::split(exp,entity,FALSE);
+
+  if (ql.contains("open"))
+    return "open";
+
+  if (ql.count()==1)
+    (QCString)ql[0];
+  //assert(ql.count()>=2);
+
+
+  label=(QCString)ql[0];
+
+  entity = (QCString)ql[1];
+  if ((index=entity.findRev("."))>=0)
+    entity.remove(0,index+1);
+
+  if (ql.count()==3)
+    arch=(QCString)ql[2];
+  return label;
+}
+
+ClassDef*  VhdlDocGen::findArchitecture(QCString identifier, QCString entity_name)
+{
+  QCString archName=entity_name+"::"+identifier;
+  return  Doxygen::classSDict->find(archName.data());
+}
+
+
+//@param arch bit0:flipflop
+//@param binding  e.g entity work.foo(bar) 
+//@param label  |label0|label1 
+//                          label0:architecture name 
+//@param confVhdl of configuration file (identifier::entity_name) or 
+//               the architecture if isInlineConf TRUE
+//@param isInlineConf 
+//@param confN List of configurations 
+
+void assignBinding(ConfNode * conf,QCString label)
+{
+  QList<Entry> instList= getVhdlInstList();
+  QListIterator<Entry> eli(instList);
+  Entry *cur;
+  ClassDef *archClass;
+  QCString archName,entityName;
+  bool allOthers=FALSE;
+
+  if (conf->isInlineConf)
+  {
+    archClass=Doxygen::classSDict->find(conf->confVhdl.data());
+  }
+  else
+  {
+    archName= VhdlDocGen::getIndexWord(label.data(),0);
+    entityName= VhdlDocGen::getIndexWord(conf->confVhdl.data(),1);
+    archClass=VhdlDocGen::findArchitecture(archName,entityName);
+  }
+
+  if (!archClass)
+  {
+    fprintf(stderr,"\n architecture %s not found ! ",conf->confVhdl.data());
+    return;
+  }
+
+  archName=archClass->name();
+
+  QCString allOt=VhdlDocGen::getIndexWord(conf->arch.data(),0);
+
+  if (allOt=="all" || allOt=="others")
+    allOthers=TRUE;
+
+  for (;(cur=eli.current());++eli)
+  {
+    if (conf->isInlineConf &&  (conf->confVhdl!=cur->args))
+      continue;
+
+    if (!conf->isInlineConf &&  (archName!=cur->args))
+      continue;
+
+    if (cur->exception==label || conf->isInlineConf)	
+    {
+      QCString sign,archy;
+
+      if (allOthers==FALSE)
+      {
+        archy=conf->arch;
+        sign=cur->name+":"+cur->type;
+      }
+      else
+      {
+        sign=cur->type;
+        archy=VhdlDocGen::getIndexWord(conf->arch.data(),1);
+      }
+
+
+      if (archy==sign && !cur->stat)
+      {
+        // fprintf(stderr," \n label [%s] [%s] [%s]",cur->exception.data(),cur->type.data(),cur->name.data());
+        QCString ent1=conf->binding;
+        QCString arch1;
+        QCString rr=VhdlDocGen::parseForBinding(ent1,arch1);
+        arch1=ent1+"::"+arch1;
+        //ClassDef *archBind=Doxygen::classSDict->find(arch1.data());
+        ClassDef *ent=Doxygen::classSDict->find(ent1.data());
+        QCString	  inst=VhdlDocGen::getIndexWord(cur->args.data(),0);  
+        ClassDef *cd=Doxygen::classSDict->find(inst.data());
+
+        if (cd==0 || ent==0) 
+          continue;
+
+        addInstance(ent,archClass,cd,cur);
+        cur->stat=TRUE;
+      }
+    }
+  }//for
+}//assignBinding
+
+
+void assignConfiguration(ConfNode* rootNode,QCString label)
+{
+  if (rootNode==NULL) return;
+  uint iter;
+
+  if (!rootNode->isBinding())
+  {
+    //   printf("\n ARCH %s  BIND %s \n",rootNode->arch.data(),rootNode->binding.data());
+    assignBinding(rootNode,label);
+    return;
+  }
+  else
+    label+="|"+rootNode->arch;
+
+
+  for(iter=0;iter<rootNode->confN.count();iter++)
+  {
+    ConfNode* conf= (ConfNode *)rootNode->confN.at(iter);
+    assignConfiguration(conf,label);
+  }
+}
+
+/*
+
+// file foo.vhd
+// enitity foo 
+//        .....
+// end entity
+
+// file foo_arch.vhd 
+// architecture xxx of foo is
+//          ........  
+//  end architecture
+
+ */
+void VhdlDocGen::computeVhdlComponentRelations()
+{
+  ClassSDict::Iterator cli(*Doxygen::classSDict);
+  ClassDef *cl;
+  for ( cli.toFirst() ; (cl=cli.current()) ; ++cli)
+  {
+    // @MARTIN: THE FOLLOWING IS DONE FOR ALL LANGUAGES, WHICH IS WRONG!!!
+    cl->setLanguage(SrcLangExt_VHDL);
+  }
+
+  QCString entity,inst,arch,vhd;
+
+  QList<ConfNode> confList =  getVhdlConfiguration();
+  for(uint iter=0;iter<confList.count(); iter++)
+  {
+    ConfNode* conf= (ConfNode *)confList.at(iter);
+    assignConfiguration(conf,"");
+  }
+
+  QList<Entry> qsl= getVhdlInstList();
+  QListIterator<Entry> eli(qsl);
+  Entry *cur;
+
+  for (eli.toFirst();(cur=eli.current());++eli)
+  {
+    if (cur->stat ) //  was bind
+      continue;
+
+    if (cur->includeName=="entity" || cur->includeName=="component" )
+    {
+      entity=cur->includeName+" "+cur->type;
+      QCString rr=VhdlDocGen::parseForBinding(entity,arch);
+    }
+    else if (cur->includeName.isEmpty())
+    {
+      entity=cur->type;
+    }
+    ClassDef *classEntity=Doxygen::classSDict->find(entity.data());
+    inst=VhdlDocGen::getIndexWord(cur->args.data(),0);  
+    ClassDef *cd=Doxygen::classSDict->find(inst.data());
+    ClassDef *ar=Doxygen::classSDict->find(cur->args.data());
+
+
+    if (cd==0 || classEntity==0 ) 
+      continue;
+
+    addInstance(classEntity,ar,cd,cur);
+
+  }
+}
+
+static void addInstance(ClassDef* classEntity, ClassDef* ar, 
+                        ClassDef *cd , Entry *cur,ClassDef* /*archBind*/)
+{
+
+  if (classEntity==cd) return;
+  QCString bName=classEntity->name();
+  //bName+="::"+cur->name;
+
+  cd->insertBaseClass(classEntity,bName,Public,Normal,0);
+
+  QCString n1=cur->name+"::"+cur->type;
+  //	 n1+="::"+cur->name;
+  //	 classEntity->setName(n1.data());
+  //	 classEntity->_setSymbolName(n1.data());
+
+  //      if (archBind)
+  //		 cd->insertSubClass(archBind,Public,Normal,0);
+  //	  else
+  classEntity->insertSubClass(cd,Public,Normal,0);
+
+  if (ar==0) return;
+  QCString uu=cur->name;
+  MemberDef *md=new MemberDef(
+      ar->getDefFileName(), cur->startLine, 
+      cur->type,uu,uu, 0,
+      Public, Normal, cur->stat,Member,
+      MemberDef::Variable,
+      0,
+      0);
+  md->setLanguage(SrcLangExt_VHDL);
+  md->setMemberSpecifiers(VhdlDocGen::COMPONENT_INST);
+  md->setBriefDescription(cur->brief,cur->briefFile,cur->briefLine);
+  md->setBodySegment(cur->startLine,-1) ;
+  FileDef *fd=ar->getFileDef();
+  md->setBodyDef(fd);  
+  ar->insertMember(md);
+  //	 printf("\nMemberreference [%p]",md);
+}
+
+void  VhdlDocGen::writeRecorUnit(QCString & largs,OutputList& ol ,const MemberDef *mdef)
+{
+  QStringList ql=QStringList::split("#",largs,FALSE);
+  uint len=ql.count();
+  for(uint i=0;i<len;i++)
+  {
+    QCString n=(QCString)ql[i];
+    VhdlDocGen::formatString(n,ol,mdef);
+    if ((len-i)>1) ol.lineBreak();
+  }
+}
+
+
+void VhdlDocGen::writeRecUnitDocu(
+    const MemberDef *md, 
+    OutputList& ol,
+    QCString largs
+    )
+{
+
+  QStringList ql=QStringList::split("#",largs,FALSE);
+  uint len=ql.count();
+  ol.startParameterList(TRUE); 
+  bool first=TRUE;
+  for(uint i=0;i<len;i++)
+  {
+    QCString n=(QCString)ql[i];
+    ol.startParameterType(first,"");  	 
+    VhdlDocGen::formatString(n,ol,md);
+    if ((len-i)>1) 
+    {
+      ol.endParameterName(FALSE,FALSE,FALSE);
+    }
+    else
+    {
+      ol.endParameterName(TRUE,FALSE,TRUE);
+    }
+
+    first=FALSE;
+  }
+}//
+
diff --git a/src/vhdldocgen.h b/src/vhdldocgen.h
index cebee43..2be5995 100644
--- a/src/vhdldocgen.h
+++ b/src/vhdldocgen.h
@@ -2,7 +2,7 @@
  *
  * 
  *
- * Copyright (C) 1997-2011 by Dimitri van Heesch.
+ * Copyright (C) 1997-2010 by Dimitri van Heesch.
  *
  * Permission to use, copy, modify, and distribute this software and its
  * documentation under the terms of the GNU General Public License is hereby 
@@ -25,7 +25,7 @@
 
 #include <qdict.h>
 #include <qcstring.h>
-
+#include "layout.h"
 #include "memberlist.h"
 
 class QStringList;
@@ -36,6 +36,19 @@ class EntryNav;
 class ClassDef;
 class MemberDef;
 
+// wrapper class for the vhdl parser
+class MyParserVhdl 
+{
+  public:
+  uint iFileSize; 
+
+  ~MyParserVhdl(){}
+  MyParserVhdl(){}
+  
+ int parse(MyParserVhdl*);
+ int doLex();
+ }; 
+
 class VhdlDocGen  
 {
   public:
@@ -47,6 +60,7 @@ class VhdlDocGen
       ARCHITECTURECLASS,   // Overlays: Private
       PACKAGECLASS         // Overlays: Package
     };
+
     enum VhdlKeyWords
     {
       LIBRARY=1,
@@ -66,36 +80,31 @@ class VhdlDocGen
       USE,
       PROCESS,
       PORT,
-      DOCUMENT, //18 0x12
       UNITS,	  
       GENERIC,
-      PORTMAP, // obsolete
       COMPONENT_INST,
       GROUP,
       VFILE,   
       SHAREDVARIABLE,
       CONFIG,
       ALIAS,
-      MISCELLANEOUS
+	  MISCELLANEOUS,
+	  UCF_CONST
     };
 
+
+
+
     VhdlDocGen();
     virtual ~VhdlDocGen();
     static void init();
-
+ static QCString convertFileNameToClassName(QCString name);
     // --- used by vhdlscanner.l -----------
+    
     static QCString getIndexWord(const char* ,int index);
     static  bool    foundInsertedComponent(const QCString& name,Entry* root);
     static bool     deleteCharRev(QCString &s,char c);
-    static bool     isFunctionProto(QCString& ss);
-    static Entry*   findFunction(Entry* func);
     static void     deleteAllChars(QCString &s,char c);
-    static bool     getSigName(QList<QCString>& ql, 
-                               const char* str,
-                               QCString& buffer);
-    static bool     getSigTypeName(QList<QCString>& ql, 
-                                   const char* str,
-                                   QCString& buffer);
     static void     parseFuncProto(const char* text,
                                    QList<Argument>& , 
                                    QCString& name,
@@ -103,21 +112,13 @@ class VhdlDocGen
                                    bool doc=false);
     // -----------------------------------
 
-    static void debugClassName(ClassSDict*);
-    //static void MergeFuncDoc(Entry* p,Entry* root);
 
     static void computeVhdlComponentRelations();
 
-    //static void  addVariableToComponents(EntryNav *rootNav,ClassDef *cd, MemberDef::MemberType mtype, const QCString &name, bool fromAnnScope,MemberDef *fromAnnMemb,Protection prot,bool related);
 
     static QCString* findKeyWord(const QCString& word);
-    static void addFuncDoc(EntryNav* root);
-
-    //static void MapArchitecturesToEntity(Entry* cur_root);
 
-    //static void MapComponentToEntity(const ClassSDict*);
 
-    static ClassDef* findComponent(int type);
     static ClassDef* getPackageName(const QCString& name);
     static MemberDef* findMember(const QCString& className, 
                                  const QCString& memName);
@@ -127,7 +128,6 @@ class VhdlDocGen
                                 const QCString& key,
                                 MemberList::ListType type);
     static ClassDef *getClass(const char *name);
-    static Entry* findFunction(Entry* root,Entry* func);
     static MemberDef* findFunction(const QList<Argument> &ql,
                                    const QCString& name,
                                    const QCString& package, bool type);
@@ -137,9 +137,9 @@ class VhdlDocGen
     static void writeInlineClassLink(const ClassDef*,
                                      OutputList &ol);
 
-    //static void writeVhdlComponentList(OutputList &ol,int type);
-     static bool isMisc(const MemberDef *mdef) 
-    { return mdef->getMemberSpecifiers()==VhdlDocGen::MISCELLANEOUS; }   
+
+    static bool isConstraint(const MemberDef *mdef) 
+    { return mdef->getMemberSpecifiers()==VhdlDocGen::UCF_CONST; }   
     static bool isConfig(const MemberDef *mdef) 
     { return mdef->getMemberSpecifiers()==VhdlDocGen::CONFIG; }
     static bool isAlias(const MemberDef *mdef) 
@@ -190,6 +190,8 @@ class VhdlDocGen
     { return mdef->getMemberSpecifiers()==VhdlDocGen::GROUP; }
     static bool isCompInst(const MemberDef *mdef) 
     { return mdef->getMemberSpecifiers()==VhdlDocGen::COMPONENT_INST; }
+static bool isMisc(const MemberDef *mdef) 
+{ return mdef->getMemberSpecifiers()==VhdlDocGen::MISCELLANEOUS; }
 
     //-----------------------------------------------------
     // translatable items
@@ -222,12 +224,9 @@ class VhdlDocGen
     //-----------------------------------------------------
 
     static void prepareComment(QCString&);
-    static QCString getpackname(const char* text,
-                                const char* word,
-                                const char* patter);
-    static void parseProcessProto(const char* text,
-                                  QCString&,
-                                  QStringList&);
+    
+	
+ 
     static void formatString(QCString&,OutputList& ol,const MemberDef*);
 
     static void writeFormatString(QCString&,OutputList& ol,const MemberDef*);
@@ -237,13 +236,11 @@ class VhdlDocGen
     static void writeFuncProcDocu(const MemberDef *mdef, OutputList& ol,const ArgumentList* al,bool type=false);
     static void writeRecordProto(const MemberDef *mdef, OutputList& ol,const ArgumentList *al);
 
-    static QCString convertArgumentListToString(const ArgumentList* al,bool f);
-    static QCString getProcessNumber();
-    static QCString getRecordNumber();
+
 
     static void writeVHDLTypeDocumentation(const MemberDef* mdef, const Definition* d, OutputList &ol);
 
-    static void writeVhdlDeclarations(MemberList*,OutputList&,GroupDef*,ClassDef*,FileDef*);
+    static void writeVhdlDeclarations(MemberList*,OutputList&,GroupDef*,ClassDef*,FileDef*,NamespaceDef*);
 
     static void writeVHDLDeclaration(MemberDef* mdef,OutputList &ol,
         ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,
@@ -256,10 +253,15 @@ class VhdlDocGen
         ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,
         const char *title,const char *subtitle,bool showEnumValues,int type);
 
+    static bool writeClassType(ClassDef *&,OutputList &ol ,QCString & cname);
+   
+
+    static QCString convertArgumentListToString(const ArgumentList* al,bool f);
+    static QCString getProcessNumber();
+    static QCString getRecordNumber();
+   
     static QCString getClassName(const ClassDef*);
-    static bool writeClassType(ClassDef *,OutputList &ol ,QCString & cname);
     static void adjustRecordMember(MemberDef *mdef);
-    static bool writeDoc(EntryNav* rootNav);
 
     static void writeLink(const MemberDef* mdef,OutputList &ol);
     static void adjustMemberName(QCString& nn);
@@ -267,15 +269,29 @@ class VhdlDocGen
     static void startFonts(const QCString& q, const char *keyword,OutputList& ol);
     static bool isNumber(const QCString& s);
     static QCString getProtectionName(int prot);
-	static void writeSource(MemberDef *mdef,OutputList& ol,QCString &);
+    static QCString splitString(QCString & str,  char c);
+    static void parseUCF(const char*  input,Entry* entity,QCString f,bool vendor);
+	
+	
+    static bool findConstraintFile( LayoutNavEntry *lne);
+
+    static ClassDef*  findArchitecture(const ClassDef *cd);
+    static ClassDef*  findArchitecture(QCString identifier, QCString entity_name);
+
+    static void writeCodeFragment( MemberDef *mdef,OutputList& ol);
+    static void writeSource(MemberDef *mdef,OutputList& ol,QCString & cname);
+    static void writeAlphbeticalClass(OutputList& ol,const ClassDef* cd,const QCString &);
+
+
+	static QCString  parseForConfig(QCString & entity,QCString & arch);
+	static QCString  parseForBinding(QCString & entity,QCString & arch);
   private:
-    static void getFuncParams(QList<Argument>&, const char* str);
+    static void findAllArchitectures(QList<QCString>& ql,const ClassDef *cd);
     static bool compareArgList(ArgumentList*,ArgumentList*);
     static void writeVhdlLink(const ClassDef* cdd ,OutputList& ol,QCString& type,QCString& name,QCString& beh);
-    static void findAllArchitectures(QList<QCString>& ql,const ClassDef *cd);
     static void writeStringLink(const MemberDef *mdef,QCString mem,OutputList& ol);
-     static void writeCodeFragment(MemberDef *mdef,OutputList& ol);
-
+	static void writeRecUnitDocu( const MemberDef *md, OutputList& ol,QCString largs);
+	static void  writeRecorUnit(QCString & largs,OutputList& ol ,const MemberDef *mdef);
 };
 
 #endif
diff --git a/src/vhdlscanner.h b/src/vhdlscanner.h
index 9a80b42..197de40 100644
--- a/src/vhdlscanner.h
+++ b/src/vhdlscanner.h
@@ -2,7 +2,7 @@
  *
  * 
  *
- * Copyright (C) 1997-2011 by Dimitri van Heesch.
+ * Copyright (C) 1997-2010 by Dimitri van Heesch.
  *
  * Permission to use, copy, modify, and distribute this software and its
  * documentation under the terms of the GNU General Public License is hereby 
@@ -68,8 +68,64 @@ class VHDLLanguageScanner : public ParserInterface
     void parsePrototype(const char *text);
 };
 
+// container for vhdlscanner 
+struct  s_contVhdl
+{
+  int yyLineNr;          // current line no
+  int iLine;             // line no of last t_identifier  
+  QCString qstr;         //  t_identifier 
+  QCString fileName;     // current file
+  Entry*  root;          // root
+};   
+
+struct ConfNode
+{ 
+  ConfNode *prevNode;
+  ConfNode(const char*  a,const char*  b,const char* config) 
+  { 
+    arch=a;              // architecture  e.g. for iobuffer
+    binding=b;           // binding e.g.  use entiy work.xxx(bev)
+    confVhdl=config;     // configuration foo is bar
+    isBind=false;
+    prevNode=NULL;
+    isRoot=false;          
+    isInlineConf=false;  // primary configuration?
+  };
+
+  QCString confVhdl;
+  QCString arch;
+  QCString binding;
+  QList<ConfNode> confN;
+  bool isBind;
+  bool isInlineConf;
+  bool isRoot;
+
+  void addNode(ConfNode* n) { confN.append(n); }
+  bool isBinding()          { return binding.isEmpty(); }
+} ;
+
+// returns the current conpound entity,architecture, package,package body 
+Entry* getVhdlCompound();
+
+// return the current parsed entry
+Entry* getCurrentVhdlEntry();
+
+void newVhdlEntry();
+
+void initVhdlParser();
+
+struct s_contVhdl*    getVhdlCont();
+
+// returns the  parsed line 
+// @ param object index of vhdl keyword like t_Identifier t_Entity 
+int getParsedLine(int object);
+
 void vhdlscanFreeScanner();
 
-//---------------------------------------------------------------------------------
+// return the list of component instantiations e.g. foo: component bar 
+QList<Entry> &  getVhdlInstList();
+
+// returns the list of found configurations
+QList<ConfNode>& getVhdlConfiguration();
 
 #endif
diff --git a/src/vhdlscanner.l b/src/vhdlscanner.l
index 5db595b..a2f2bd0 100644
--- a/src/vhdlscanner.l
+++ b/src/vhdlscanner.l
@@ -1,1557 +1,513 @@
-/******************************************************************************
+/************** VHDL scanner in LEX format **********
  *
- * Copyright (C) 1997-2011 by Dimitri van Heesch.
+ * Version 0.2 Wed Aug 11, 1993
  *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby 
- * granted. No representations are made about the suitability of this software 
- * for any purpose. It is provided "as is" without express or implied warranty.
- * See the GNU General Public License for more details.
+ * This scanner is derived from a scanner of the ALLIANCE CAD toolset,
+ * release 1.1. That toolset was written from:
+ *   MASI/CAO-VLSI CAD Team
+ *   Laboratoire MASI/CAO-VLSI
+ *   Tour 55-65, 2eme etage, Porte 13
+ *   Universite Pierre et Marie Curie (PARIS VI)
+ *   4, place Jussieu 75252 PARIS Cedex 05, FRANCE
+ * The ALLIANCE CAD Toolset can be obtained from ftp site : ftp-masi.ibp.fr    
  *
- * Documents produced by Doxygen are derivative works derived from the
- * input used in their production; they are not affected by this license.
+ * This scanner is avail at: ftp.cs.utwente.nl in pub/src/VHDL/Grammar
+ * A corresponding Yacc grammar is available at the same site
  *
- */
+ * author of this derived scanner version:
+ * Thomas Dettmer
+ * Dortmund University
+ * Dept. of Computer Scienc, LS1
+ * PB 500 500
+ * D-44221 Dortmund (Germany)
+ * Phone: +49-231-755-6464
+ * e-mail: dettmer@ls1.informatik.uni-dortmund.de
+ *
+ *
+ ****************************************************************
+ * 
+ * This file is intended not to be used for commercial purposes
+ * without permission of the University of Dortmund
+ *
+ * NOTE THAT THERE IS NO WARRANTY FOR CORRECTNES, COMPLETENESS, SUPPORT
+ * OR ANYTHING ELSE.
+ *******************************************************/
 /******************************************************************************
- * Parser for VHDL subset
- * written by M. Kreis
- * supports VHDL-87/93
- * does not support VHDL-AMS 
+ * modified for doxygen by M. Kreis
+ * extended to VHDL 93/2002/2008 
  ******************************************************************************/
 %{
 
-// global includes
+#ifndef YYSTYPE
+	typedef int YYSTYPE;
+#endif
+
+#include <ctype.h>
+#include <search.h>
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <assert.h>
 #include <string.h>
-#include <qcstring.h>
-#include <qfileinfo.h>
-#include <qstringlist.h>
-
-/* --------------------------------------------------------------- */
-
-// local includes
+#include <ctype.h>
+#include "commentscan.h"
+#include "vhdlparser.h"
 #include "vhdlscanner.h"
-#include "vhdlcode.h"
-#include "vhdldocgen.h"
-#include "message.h"
-#include "config.h"
+
 #include "doxygen.h"
-#include "util.h"
-#include "language.h"
-#include "commentscan.h"
-#include "index.h"
-#include "definition.h"
 #include "searchindex.h"
-#include "outputlist.h"
-
-/* --------------------------------------------------------------- */
+#include <ctype.h>
+#include "scanner.h"
+#include "vhdldocgen.h"
+#include "util.h"
+#include "bufstr.h"
+#include "message.h"
+#include "vhdlcode.h"
+#include <qmap.h>
+#include "entry.h"
 
-//#define theTranslator_vhdlType theTranslator->trVhdlType
-#define theTranslator_vhdlType VhdlDocGen::getVhdlType
+static MyParserVhdl *pconv;
 
-static QStringList      qrl;
-static int              openGroups;
+static bool          g_lexInit = FALSE;
 static ParserInterface *g_thisParser;
-static const char *     inputString;
+static struct s_contVhdl* yycont=NULL;
+static Entry* current_root;
+static Entry   gBlock;
+
+static int yyLineNr =1;
+//static int yyPrevLine=1;
+//static int yyEndLine=1;
+static int   g_lastCommentContext;
 static int              inputPosition;
-static int              inputLen;
-static int              startComment  = 0;
+//static int defineLineContinue=0;
+static int startComment;
+//static int iSize=0;
+static QCString inputVhdlString;
 static QFile            inputFile;
-static QCString         inbuf;
-static Entry*           global_root   = 0;
-static Entry*           current_root  = 0;
-static Entry*           current       = 0;
-static Entry*           previous      = 0;
-static Entry*           functionEntry = 0;
-static Entry*           lastEntity    = 0;
-static Entry*           lastCompound  = 0;
-static int              genPort       = 0;
 static QCString         yyFileName;
-static int              iFuncLine     = 1;
-static bool             g_inputFromFile ;
-static bool             g_lexInit     = FALSE;
-static int              isBody=0;
-static int              isFunc=0;
-static int              yyLineNr      = 1;
-static char *           g_buf         = 0;
-static uint             g_bufSize     = 0;
-static int              iTextCounter  = 0;
-static int              iCounter      = 0;
-static int              bropen        = 0;
-static int              scantype      = 0;
-static int              g_lastCommentContext = 0;
-static bool             docBlockAutoBrief;
-static char             docBlockTerm;
-static int              iDocLine      = -1;
-static Entry            gBlock;
-static int              num_chars;
-
-//#define YY_A_INTERACTIVE 1
-#define YY_NEVER_INTERACTIVE 1
-//-----------------------------------------------------------------------------
-#define YY_USER_ACTION num_chars += yyleng;
-static void parserInit();
-static void deleteSpecChars(char* str,char *buf);
+static QList<QCString> qlist;
+
+static QCString lastLetter;
+//static int totLines=0;
+
+//static bool multLineComment=FALSE;
+static bool doxComment=FALSE; // doxygen comment ? 
+static QCString strComment;
+static int iDocLine=-1;
+static int* lineIndex=NULL;
+static int num_chars;
+static  int prevToken;
+static int iCodeLen;
+
+//static const char *  g_inputString;       //!< the    code fragment as text
+//static int           g_inputLines=0;      //!<number of line in the code fragment
+//static bool          g_needsTermination;
+static	QMap<QCString, int> keyMap;
+
 static void handleCommentBlock(const QCString &doc,bool brief);
-static void newEntry();
-static void initEntry(Entry *e);
+static void mapLibPackage(const Entry* ce);
+static Entry* getEntryAtLine(const Entry* ce,int line);
 
-static int iCodeLen;
 
-static void makeInline()
-{
-  int diff=num_chars-iCodeLen;
-  assert(inputLen>iCodeLen+diff);
-  QCString par(&inputString[iCodeLen],diff);
-  int index=par.findRev("\\endcode");
-  int tt=par.length()-par.find("\n",index);
-  QCString qc(&inputString[iCodeLen-tt],diff);
-  index=qc.findRev("--!");
-  if (index<=0) return;
-  par=qc.left(index);
-  /*
-     fprintf(stderr,"\n-------------------------------------------------------------------------------- ");
-     fprintf(stderr,"\n bytes since %d %d \n %s",num_chars,iCodeLen,par.data());
-     fprintf(stderr,"\n-------------------------------------------------------------------------------- ");
-   */
-  gBlock.doc=par;
-  gBlock.section=Entry::VARIABLE_SEC;
-  gBlock.spec=VhdlDocGen::MISCELLANEOUS;
-  gBlock.fileName = yyFileName;
-  gBlock.endBodyLine=yyLineNr-1;
-  Entry *temp=new Entry(gBlock);
-  if (lastCompound)
-    lastCompound->addSubEntry(temp);
-  else if (lastEntity)
-    lastEntity->addSubEntry(temp);
-  else
-  {
-    temp->type="misc"; // global code
-    current_root->addSubEntry(temp);
-  }
+#define YY_NEVER_INTERACTIVE 1
+#define YY_USER_ACTION num_chars += vhdlScanYYleng;
 
-  gBlock.reset();
+#define MAX_KEYWORD_LEN 20
 
-}// makeInline
+typedef struct 
+{
+  char nom[MAX_KEYWORD_LEN];
+  int kval;
+} el_mc;
 
-static void addSubEntry(Entry* root, Entry* e)
+static el_mc tab_mc []=
 {
-  if (e==0 || root==0) return;
-  //if (isPrevDoc) 
-  //{
-  //  e->brief=prevDocEntry.brief;
-  //  e->briefLine=prevDocEntry.briefLine;
-  //  prevDocEntry.reset();
-  //  isPrevDoc=FALSE;
-  //}
-  root->addSubEntry(e);
-} 
-
-static void bufferClear()
+    { "abs",                t_ABS                },
+    { "access",             t_ACCESS             },
+    { "after",              t_AFTER              },
+    { "alias",              t_ALIAS              },
+    { "all",                t_ALL                },
+    { "and",                t_AND                },
+    { "architecture",       t_ARCHITECTURE       },
+    { "array",              t_ARRAY              },
+    { "assert",             t_ASSERT             },
+    { "assume",             t_ASSUME             },
+    { "assume_guarantee",   t_ASSUME_GUARANTEE   },
+    { "attribute",          t_ATTRIBUTE          },
+
+    { "begin",              t_BEGIN              },
+    { "block",              t_BLOCK              },
+    { "body",               t_BODY               },
+    { "buffer",             t_BUFFER             },
+    { "bus",                t_BUS                },
+
+    { "case",               t_CASE               },
+    { "component",          t_COMPONENT          },
+    { "configuration",      t_CONFIGURATION      },
+    { "constant",           t_CONSTANT           },
+    { "context",            t_CONTEXT            },
+    { "cover",              t_COVER              },
+
+    { "default",            t_DEFAULT            },
+    { "disconnect",         t_DISCONNECT         },
+    { "downto",             t_DOWNTO             },
+
+    { "else",               t_ELSE               },
+    { "elsif",              t_ELSIF              },
+    { "end",                t_END                },
+    { "entity",             t_ENTITY             },
+    { "exit",               t_EXIT               },
+
+    { "fairness",           t_FAIRNESS           },
+    { "file",               t_FILE               },
+    { "for",                t_FOR                },
+    { "force",              t_FORCE              },
+    { "function",           t_FUNCTION           },
+
+    { "generate",           t_GENERATE           },
+    { "generic",            t_GENERIC            },
+    { "group",              t_GROUP              },
+    { "guarded",            t_GUARDED            },
+
+    { "if",                 t_IF                 },
+    { "impure",             t_IMPURE             },
+    { "in",                 t_IN                 },
+    { "inertial",           t_INERTIAL           },
+    { "inout",              t_INOUT              },
+    { "is",                 t_IS                 },
+  
+    { "label",              t_LABEL              },
+    { "library",            t_LIBRARY            },
+    { "linkage",            t_LINKAGE            },
+    { "literal",            t_LITERAL            },
+    { "loop",               t_LOOP               },
+
+    { "map",                t_MAP                },
+    { "mod",                t_MOD                },
+
+    { "nand",               t_NAND               },
+    { "new",                t_NEW                },
+    { "next",               t_NEXT               },
+    { "nor",                t_NOR                },
+    { "not",                t_NOT                },
+    { "null",               t_NULL               },
+
+    { "of",                 t_OF                 },
+    { "on",                 t_ON                 },
+    { "open",               t_OPEN               },
+    { "or",                 t_OR                 },
+    { "others",             t_OTHERS             },
+    { "out",                t_OUT                },
+
+    { "package",            t_PACKAGE            },
+    { "parameter",          t_PARAMETER          },
+    { "port",               t_PORT               },
+    { "postponed",          t_POSTPONED          },
+    { "procedure",          t_PROCEDURE          },
+    { "process",            t_PROCESS            },
+    { "property",           t_PROPERTY           },
+    { "protected",          t_PROTECTED          },
+    { "pure",               t_PURE               },
+  
+    { "range",              t_RANGE              },
+    { "record",             t_RECORD             },
+    { "register",           t_REGISTER           },
+    { "reject",             t_REJECT             },
+    { "release",            t_RELEASE            },
+    { "restrict",           t_RESTRICT           },
+    { "restrict_guarantee", t_RESTRICT_GUARANTEE },
+    { "rem",                t_REM                },
+    { "report",             t_REPORT             },
+    { "rol",                t_ROL                },
+    { "ror",                t_ROR                },
+    { "return",             t_RETURN             },
+
+    { "select",             t_SELECT             },
+    { "sequence",           t_SEQUENCE           },
+    { "severity",           t_SEVERITY           },
+    { "signal",             t_SIGNAL             },
+    { "shared",             t_SHARED             },
+    { "sla",                t_SLA                },
+    { "sll",                t_SLL                },
+    { "sra",                t_SRA                },
+    { "srl",                t_SRL                },
+    { "strong",             t_STRONG             },
+    { "subtype",            t_SUBTYPE            },
+
+    { "then",               t_THEN               },
+    { "to",                 t_TO                 },
+    { "transport",          t_TRANSPORT          },
+    { "type",               t_TYPE               },
+
+    { "unaffected",         t_UNAFFECTED         },
+    { "units",              t_UNITS              },
+    { "until",              t_UNTIL              },
+    { "use",                t_USE                },
+
+    { "variable",           t_VARIABLE           },
+    { "vmode",              t_VMODE              },
+    { "vprop",              t_VPROP              },
+    { "vunit",              t_VUNIT              },
+
+    { "wait",               t_WAIT               },
+    { "when",               t_WHEN               },
+    { "while",              t_WHILE              },
+    { "with",               t_WITH               },
+
+    { "xor",                t_XOR                },
+    { "xnor",               t_XNOR               },
+    { "zz",                 -1                   } // list end
+};
+
+   
+static int find_keyword(char *s)
 {
-  int j;
-  for (j=0;j<iCounter+1;j++)
-  {
-    g_buf[j]=0;
-  }
+  QCString word(s);
+  // keyword ?
+  if (word.length() >  MAX_KEYWORD_LEN) 
+	return -1;
 
-  iCounter=0;
-}
+  word=word.lower();
+  QMap<QCString, int>::Iterator it = keyMap.find(word);
+  if (it.key())
+	return it.data();
 
-static void  addText (char *word, int llen)
-{
-  if ((uint)(iCounter + llen) > g_bufSize)
-  {
-    char *pTmp = (char*)realloc(g_buf,iCounter+llen+2048);
-    if (pTmp)
-    {
-      g_buf = pTmp;
-    }
-    else
-    {
-      fprintf(stderr,"\n not enough memory for realloc\n");
-      return; 
-    }
-  }
-  while (llen>0)
-  {
-    g_buf[iCounter]=*word++;
-    iCounter++;
-    llen--;
-  }    
-  g_buf[iCounter]='\0'; 
-} 
-
-static void getBufText(QCString& qc,int start)
-{
-  while (start < iCounter)
-  {
-    qc+=(g_buf[start]);
-    start++;
-  }
+  return -1;
 }
 
+// update current line
 static void lineCount()
 {
-  for ( const char* c = yytext ; *c ; ++c )
+  for (const char* c=vhdlScanYYtext ; *c ; ++c )
   {
     yyLineNr += (*c == '\n') ;
   }
 }
 
-static void deleteSpecChars(char* str,char *buf)
-{
-  while (*str)
-  {
-    if ((*str == '\t') || (*str == '\n') || (*str == '\r') || (*str == ' ')) 
-    {
-      str++;
-    }
-    else
-    {
-      *buf++ = *str++;
-    }
-  }
-  *buf='\0';
-}
-
-static void getType(Entry* p,char* text)
-{
-  QCString name(text);
-  name=name.stripWhiteSpace();           
-  if (stricmp(name.data(),"signal" )==0)
-  {
-    p->spec=VhdlDocGen::SIGNAL;
-  }
-  else if (stricmp(name.data(),"type" )==0)
-  {
-    p->spec=VhdlDocGen::TYPE; 
-  }
-  else if (stricmp(name.data(),"subtype" )==0)
-  {
-    p->spec=VhdlDocGen::SUBTYPE;   
-  }
-  else if (stricmp(name.data(),"constant" )==0)
-  {
-    p->spec=VhdlDocGen::CONSTANT;    
-  }
-  else if (stricmp(name.data(),"attribute" )==0)
-  {
-    p->spec=VhdlDocGen::ATTRIBUTE;
-  }
-  else if (stricmp(name.data(),"function" )==0)
-  {
-    p->spec=VhdlDocGen::FUNCTION;    
-  }
-  else if (stricmp(name.data(),"procedure" )==0)
-  {
-    p->spec=VhdlDocGen::PROCEDURE;
-  }
-  else if (stricmp(name.data(),"units" )==0)
-  {
-    p->spec=VhdlDocGen::UNITS;
-  }
-  else if (name.contains("shared",false) && name.contains("variable",false))
-  {
-    p->spec=VhdlDocGen::SHAREDVARIABLE;
-  }
-  else if (stricmp(name.data(),"file" )==0) 
-  {
-    p->spec=VhdlDocGen::VFILE;
-  }
-  else if (stricmp(name.data(),"group" )==0) 
-  {
-    p->spec=VhdlDocGen::GROUP; 
-  }
-  else if (stricmp(name.data(),"alias" )==0) 
-  {
-    p->spec=VhdlDocGen::ALIAS; 
-  }
-  else 
-  {
-    err("wrong type");
-  }
-  p->section=Entry::VARIABLE_SEC;
-}
-
-//-------------------------------------------------------------------------
-
-/*
- * adds signals found in entities|records|units
- */
-
-static void addSignals(const char* str,int line, Entry *e,const char *comment=0)
-{
-  //printf("===> addSignals (%s) comment='%s'\n",str,comment);
-  QList<QCString> ql;
-  QCString bufio;
-  ql.setAutoDelete(TRUE);
-
-  VhdlDocGen::getSigName(ql,str,bufio);
-  int count = ql.count();
-
-  QCString brief  = current->brief;
-  QCString doc    = current->doc;
-  Entry *tmpEntry = current;
-  current = new Entry;
-  initEntry(current);
-  handleCommentBlock(comment,TRUE);
-  if (!current->brief.isEmpty())
-  {
-    if (doc.isEmpty())
-    {
-      doc = brief;
-    }
-    else if (!brief.isEmpty())
-    {
-      doc = brief + "<p>" + doc;
-    }
-    brief = current->brief;
-  }
-  delete current;
-  current = tmpEntry;
-  current->brief.resize(0);
-  current->doc.resize(0);
- 
-  if (genPort!=3) // not a unit
-  {
-    for (int k=1;k<count;k++)
-    {
-      //printf("adding '%s' '%s'\n",ql.at(0)->data(),ql.at(k)->data());
-      Entry *pTemp=new Entry;
-      initEntry(pTemp);
-      pTemp->startLine = line;
-      pTemp->bodyLine  = line;
-      pTemp->name      = ql.at(k)->data();
-      pTemp->section   = Entry::VARIABLE_SEC;
-      pTemp->brief     = brief;
-      pTemp->doc       = doc;
-      pTemp->mGrpId    = current->mGrpId; // copy member group id
-      QCString stSpec  = ql.at(0)->data();
-      if (genPort==1) // found port
-      {
-	pTemp->spec    = VhdlDocGen::PORT;
-	stSpec.stripPrefix(bufio.data()); 
-	stSpec=stSpec.stripWhiteSpace();
-	pTemp->args    = stSpec;
-	pTemp->type    = bufio;
-	addSubEntry(e,pTemp);
-      }
-      else if (genPort==2) // found record
-      {
-	pTemp->spec    = VhdlDocGen::RECORD;
-	pTemp->type    = stSpec;
-	pTemp->name.prepend(VhdlDocGen::getRecordNumber());
-	delete current;
-	current = new Entry(*pTemp); // make a deep copy of pTemp
-	newEntry();                  // add it to lastCompound and make a new current
-	delete pTemp;
-      }
-      else 
-      {
-	pTemp->spec    = VhdlDocGen::GENERIC;
-	pTemp->type    = stSpec;
-	addSubEntry(e,pTemp);
-      }
-    }// for
-  }
-  else // found a unit 
-  {
-    Entry *pTemp=new Entry;
-    initEntry(pTemp);
-    QCString tt(str);
-    QStringList ql=QStringList::split("=",tt,FALSE);
-    pTemp->spec      = VhdlDocGen::UNITS;
-    pTemp->section   = Entry::VARIABLE_SEC;
-    pTemp->startLine = line;
-    pTemp->bodyLine  = line;
-    pTemp->brief     = brief; // adds brief description to the unit member
-    pTemp->doc       = doc;   // adds doc to the unit member
-    pTemp->type      = ql[1];
-    pTemp->name      = ql[0].stripWhiteSpace();
-    pTemp->name.prepend(VhdlDocGen::getRecordNumber());
-    delete current;
-    current = new Entry(*pTemp); // make a deep copy
-    newEntry();                  // add it to lastCompound
-    delete pTemp;
-  }
-}                                              
-
-/*
- * this function parses a process prototype
- * and adds the signal to the process
- */
-
-static void parseProcessProto()
-{
-  QStringList ql;
-  QCString qcs;
-  bool sem=FALSE;
-  //Entry* ppEntry=new Entry;
-  //ppEntry->fileName=yyFileName;
-  //processEntry=ppEntry;
-  QCString name; 
-  scantype=0;
-  getBufText(qcs,0);
-  if (qcs.contains('(') != qcs.contains(')')) return; 
-  VhdlDocGen::deleteAllChars(qcs,'\n');
-  VhdlDocGen::parseProcessProto(qcs,name,ql);
-  current->section=Entry::FUNCTION_SEC;
-  //current->stat=TRUE;
-  current->spec=VhdlDocGen::PROCESS;
-  current->startLine=iFuncLine;
-  current->bodyLine=iFuncLine;
-  current->fileName=yyFileName;
-  if (!name.isEmpty())
-  {
-    current->name=name.stripWhiteSpace();
-  }
-  else // found an anonymous process, so we add a generated name  
-  {
-    current->name=VhdlDocGen::getProcessNumber(); 
-  }
-
-  current->args+=" ( "; 
-  if (!ql.isEmpty())
-  {
-    QValueList<QString>::Iterator iter = ql.begin();
-    for ( ; iter != ql.end(); ++iter)
-    {
-      if (sem)
-      {
-        current->args+=',';
-      }
-      Argument *arg=new Argument;
-      arg->name=((QCString)*iter).stripWhiteSpace();    
-      current->argList->append(arg);
-      current->args+=(QCString)*iter; 
-      sem = TRUE;
-    }    
-  }
-  current->args+=" ) ";
-  bufferClear();
-}//parseProcessProto
-
-
-/*
- * parses a function|procedure protoype
- */
 
-static void parseFunctionProto()
+static void makeInlineDoc(int endCode)
 {
-  QCString name,ret,qcs,temp;
-  bool sem=FALSE;
-  QList<Argument> ql;
-  ql.setAutoDelete(TRUE);
-  getBufText(qcs,0);
-  if (qcs.contains('(') != qcs.contains(')')) 
-    return; // function without a prototype 
-  if (qcs.contains("function",FALSE)==0 && qcs.contains("procedure",FALSE)==0) 
-    return; 
-  qcs=qcs.stripWhiteSpace();
-  temp=qcs.lower();
-  if (temp.stripPrefix("impure"))
-  {
-    current->exception="impure";
-    qcs=qcs.remove(0,6);
-  }
-  else if (temp.stripPrefix("pure")) 
-  {
-    current->exception="pure";
-    qcs=qcs.remove(0,4);
-  }
-
-  VhdlDocGen::parseFuncProto(qcs.data(),ql,name,ret); 
-  //printf("parseFuncProto(%s)=%s,%s\n",qcs.data(),name.data(),ret.data());
-  VhdlDocGen::deleteAllChars(name,';');
-  current->name=name;
-  current->startLine=iFuncLine;
-  current->bodyLine=iFuncLine;
-
-  int count = ql.count(); 
-
-  current->args+" ( "; 
-  for (int k=0;k<count;k++)
-  {
-    if (sem)
-    {
-      current->args+=",";
-    }
-    Argument *arg=new Argument;
-    Argument *hh=(Argument*)ql.at(k);
-    arg->name=hh->name;
-    arg->type=hh->type;
-    arg->defval=hh->defval;
-    arg->attrib=hh->attrib;
-    current->argList->append(arg);
-    current->args+=hh->name;
-    sem=TRUE;
-  }
-  current->args+" )";
+  int len=endCode-iCodeLen;
+  QCString par=inputVhdlString.mid(iCodeLen,len);
+  gBlock.doc=par;
+  gBlock.inbodyDocs=par;
+  gBlock.section=Entry::VARIABLE_SEC;
+  gBlock.spec=VhdlDocGen::MISCELLANEOUS;
+  gBlock.fileName = yyFileName;
+  gBlock.endBodyLine=yyLineNr-1;
+  gBlock.lang=SrcLangExt_VHDL;
+  Entry *temp=new Entry(gBlock);
 
-  if (!ret.isEmpty()) 
-    current->spec=VhdlDocGen::FUNCTION;
-  else
-    current->spec=VhdlDocGen::PROCEDURE;
+  Entry* compound=getVhdlCompound();
 
-  current->section=Entry::FUNCTION_SEC;
-  current->type=ret;
-  //addSubEntry(ee,ppEntry); 
-  if (lastCompound)
+  if (compound)
   {
-    lastCompound->addSubEntry(current);
-    current = new Entry;
-    initEntry(current);
+	compound->addSubEntry(temp);
   }
   else
   {
-    newEntry();
-  }
-  bufferClear();
-}//parseFunctionProto
-
-static Entry* getEntryAtLine(const Entry* ce,int line)
-{
-  EntryListIterator eli(*ce->children());
-  Entry *found=0;
-  Entry *rt;
-  for (;(rt=eli.current());++eli)
-  {
-    if (rt->bodyLine==line)
-    {
-      found=rt;
-    } // if
-    if (!found) 
-    {
-      found=getEntryAtLine(rt,line);
-    }
+	temp->type="misc"; // global code like library ieee...
+	current_root->addSubEntry(temp);
   }
-  return found;
-}// getEntryAtLine
-
-//-------------------------------------------------------------------------
 
-static void parserInit()
-{
-  iCounter=0; 
-  iTextCounter=0;
-  yyLineNr=1;
-  current=0;
-  previous=0;
-  isFunc=0;
-  isBody=0;
-  scantype=0;
-  lastCompound=0;
-  lastEntity=0;
-  bropen=0;
-  openGroups=0;
-  iDocLine=-1;
-  qrl.clear();
-  num_chars=0;
-
-  if (!g_lexInit) 
-  {
-    VhdlDocGen::init();
-  }
+  gBlock.reset();
 
-  g_bufSize=inputFile.size()+1024;
-  if (g_buf==0) free(g_buf);
-  g_buf=(char*)(calloc(g_bufSize,sizeof(char)));
 
-  if (g_buf==0)
-  {
-    fprintf(stderr,"\n not enough memory");
-    return;
-  }
-  g_buf[g_bufSize-1]='\0';
-}
+}// makeInlineDoc
 
-bool VHDLLanguageScanner::needsPreprocessing(const QCString &)
+static bool isConstraintFile(const QCString &fileName,const QCString &ext)
 {
-  return FALSE;
+  return fileName.right(ext.length())==ext;
 }
 
+//static void resetScanner(const char* s,MyParserVhdl* parse);
 
-void VHDLLanguageScanner::resetCodeParserState()
-{
-
-}
+#undef  YY_INPUT
+#define	YY_INPUT(buf,result,max_size) result=vhdlScanYYread(buf,max_size);
 
-#undef    YY_INPUT
-#define    YY_INPUT(buf,result,max_size) result=yyread(buf,max_size);
 
-static int yyread(char *buf,int max_size)
+static int vhdlScanYYread(char *buf,int max_size)
 {
   int c=0;
-  if (g_inputFromFile)
-  {
-    c = inputFile.readBlock(buf,max_size);
-    if (c==-1) yy_fatal_error("input in flex scanner failed");
-  }
-  else
+  while ( c < max_size && inputVhdlString.at(inputPosition) )
   {
-    while ( c < max_size && inputString[inputPosition] )
-    {
-      *buf = inputString[inputPosition++] ;
-      c++; 
-      buf++;
-    }
+	*buf = inputVhdlString.at(inputPosition++) ;
+	c++; buf++;
   }
   return c;
 }
 
+%}
 
+upper_case_letter          [A-Z]
+digit                      [0-9]
+special_character          [\#\&\'\(\)\*\+\,\-\.\/\:\;\<\=\>\_\|]
+space_character            [ \t]
+format_effector            [\t\v\r\l\f]
+end_of_line                \n
+lower_case_letter          [a-z]
+other_special_character    [\!\$\@\?\[\\\]\^\`\{\}\~]
 
-%}
+graphic_character          ({basic_graphic_character}|{lower_case_letter}|{other_special_character})
+basic_graphic_character    ({upper_case_letter}|{digit}|{special_character}|{space_character})
+letter                     ({upper_case_letter}|{lower_case_letter})
+letter_or_digit            ({letter}|{digit})
+decimal_literal            {integer}(\.{integer})?({exponent})?
+integer                    {digit}(_?{digit})*
+exponent                   ([eE][-+]?{integer})
+base                       {integer}
+based_integer              {extended_digit}(_?{extended_digit})*
+extended_digit             ({digit}|[a-fA-F])
 
+extended_character         [\\]{graphic_character}*[\\] 
 
-  /* start command character */
-  /* -------------- VHDL SECTION -----------------------------------*/
-
-B                       [ \t]
-CR                      [\r\n]
-BR                      [ \t\n\r]
-DIGIT                   [0-9]
-LOWER_CASE_LETTER       [a-z]
-UPPER_CASE_LETTER       [A-Z]
-LETTER                  [a-zA-Z_0-9]
-SPACE_CHARACTER         [ \t]
-SPECIAL_CHARACTER       [#&'()*+,\-\./:;<=>_|]
-OTHER_SPECIAL_CHARACTER [~!$§%?@\[\\\]^{}]
-BASIC_GRAPHIC_CHARACTER {UPPER_CASE_LETTER}|{DIGIT}|{SPECIAL_CHARACTER}|{SPACE_CHARACTER}
-GRAPHIC_CHARACTER       {BASIC_GRAPHIC_CHARACTER}|{LOWER_CASE_LETTER}|{OTHER_SPECIAL_CHARACTER}
-EXTENDED_CHARACTER      [\\]{GRAPHIC_CHARACTER}*[\\] 
-
-NAME                    ({LETTER}[a-zA-Z0-9_.]*)|{EXTENDED_CHARACTER}
-STRING_LITERAL          \"{GRAPHIC_CHARACTER}*\"
-FUNCNAME                ([a-zA-Z"][*+\-_a-zA-Z0-9"\/=<>]*)|{EXTENDED_CHARACTER}
-DIGITS                  [0-9]+|[0-9]+"."[0-9]+|[0-9]+"#"[0-9_a-fA-F\+\.]+"#"
-COMMENT                 "--"[^\n]*
-LABELID                 [a-z_A-Z][^\;]*";"({B}*{COMMENT})*
-PROTO                   [ (]*
-TEXTT                   "--"[^\/\@\*\#][^\n]*
-PROC                    ("function"|"procedure")
-ENDE                    ({BR}*("end"){BR}*{PROC}*{BR}*[;]{1})
-ENDEFF                  ("if"|"case"|"loop"|"generate"){BR}*[;]
-ENDE3                   ({BR}*("end"){BR}*{PROC}*{BR}*{FUNCNAME}{BR}*[;])|{ENDE}
-ENDFUNC                 {B}*"end"{BR}*{PROC}*{BR}*{FUNCNAME}{BR}*[;]
-FUNCIMPURE              "impure"|"pure"
-FUNCPROC                ^{B}*{FUNCIMPURE}*{BR}*("function"|"procedure"){B}*
-ARCHITECTURE            ("architecture"){BR}+{NAME}{BR}*("of")
-   /* Removed due to bug 538239
-      POST         "postponed"
-      PROCESS      ({BR}*{FUNCNAME}{B}*[:]{BR}*({POST}{BR}+)?("process"){BR}*{PROTO})|("process"){BR}*("("){BR}*{PROTO}|[^a-zA-Z]("process"){CR}|[^a-zA-Z]("process"){BR}+("is")
-   */
-PROCESS                 ({B}*{FUNCNAME}{B}*:{BR}*)?({B}*("postponed"){BR}+)?{B}*("process"){BR}*{PROTO}
-
-ENDPROCESS              ("end"){BR}*("postponed")*("process"){BR}*{FUNCNAME}*{BR}*[;]
-LIBUSE                  ^{B}*("use"|"library"){BR}+
-ENTITY                  ^{B}*("component"|"entity"|"package"){BR}+
-PBODY                   ("package"){B}+("body"){BR}+{NAME}
-SHARED                  ("shared"){BR}+("variable")
-SIGTYPES                ^{B}*({SHARED}|"alias"|"file"|"group"|"subtype"|"type"|"constant"|"attribute"|"signal"|"units"){BR}+
-CONFIG                  ("configuration"){BR}+{NAME}{BR}*("of"){BR}+{NAME}{BR}+"is"
-
-ALLTYPESMAP             {B}*[_a-zA-ZA_Z0-9.() ]*{B}*
-MAPCOMPONENT            ({ALLTYPESMAP}{BR}*[:]{BR}*("component"|"configuration")*{ALLTYPESMAP}{BR}*{TEXTT}*{BR}*("port"|"generic"){BR}*("map"){BR}*("("){1})
-MAPCOMPONENT1           ({ALLTYPESMAP}{BR}*[:]{BR}*("entity"){BR}*{ALLTYPESMAP}{BR}*("port"|"generic"){BR}*("map"){BR}*("("){1})
-
-BRACEOPEN               [(]{1}
-BRACECLOSE              [)]{1}
-
-ALLID                   [^;()\t ]
-
-/* VHDL 2001 */
-ENDPROTECTED            ("end"{BR}+"protected"{BR}+{NAME}{BR}*";")|("end"{BR}+"protected"{BR}*";")
-ENDPROTECEDBODY         "end"{BR}+"protected"{BR}+"body"{BR}+{NAME}
+base_specifier             {digit}*(B|b|D|O|o|X|x|"UB"|"UO"|"UX"|"SB"|"SO"|"SX")
 
+vhdl2008tooldir            `{graphic_character}+
 
-%option noyywrap
+B                          [ \t]
+BR                         [ \t\n\r]
 
-  /* language parsing states */
 
-%x Start
+%option noyywrap
 %x Comment
-%x FindTypeName
-%x ParseType 
-%x ParseRecord
-%x ParseUnits
-%x ParseProcess
-%x ParseFunc
-%x FindName
-%x FindEntityName
-%x FindGenPort
-%x FindTypes
-%x FindSigName
-%x FindFuncName
-%x FindBegin
-
+%x Vhdl2008Comment
+%x EndVhdl2008Comment
 %%
 
-<Start>{ENDPROTECTED}|{ENDPROTECEDBODY}  {
- lineCount();
-}
-
-
-
-<Start>{CONFIG} { // found configuration
- 
-  QCString qcs(vhdlscanYYtext);
-  current->name=VhdlDocGen::getIndexWord(qcs,1);
-  current->type=VhdlDocGen::getIndexWord(qcs,3);
-  current->startLine=yyLineNr;
-  current->bodyLine=yyLineNr;
-  current->section=Entry::VARIABLE_SEC; 
-  current->spec=VhdlDocGen::CONFIG;
-  current->args="configuration";
-  newEntry();
-  BEGIN(Start);
-}
-
-<Start>{SIGTYPES}  { // found type constant|type|attribute and so on..
-    bropen=0;
-    lineCount();
-
-    bufferClear();
-    //pEntry=current;
-    getType(current,yytext);
-    current->bodyLine=yyLineNr;
-    if (current->spec==VhdlDocGen::UNITS)
-    {
-      //addSubEntry(current,pEntry);
-      current->startLine=yyLineNr;
-      current->bodyLine=yyLineNr;
-      newEntry(); // adds the unit to the lastCompound
-      genPort=3;
-      BEGIN(ParseRecord);
-    }
-    else    
-    {
-      BEGIN(FindTypeName);
-    }
-  }
-
-<Start>{ARCHITECTURE} {     //found architecure
-  lineCount();
-  bropen=0;
-  bufferClear();
-  isBody=0;
-  lastCompound = current;
-  QCString curName=VhdlDocGen::getIndexWord(yytext,1);
-  current->section=Entry::CLASS_SEC; //Entry::CLASS_SEC;
-  current->spec=VhdlDocGen::ARCHITECTURE;
-  current->protection=Private;
-  current->name=curName;
-  current->fileName=yyFileName;
-  current->startLine=yyLineNr;
-  current->bodyLine=yyLineNr;      
-  //printf("-> Architecture at line %d\n",yyLineNr);
-  BEGIN(FindName);
-}
-
-
-<Start>{PROCESS} {          //found process
-  lineCount();
-  iFuncLine=yyLineNr;
-  bropen=0;
-  //printf("--> Process: line=%d\n",yyLineNr);
-  bufferClear();
-  addText(yytext,yyleng);
-  QCString qcs(yytext);
-  if (qcs.contains('('))
-  {
-    bropen=1;
-    scantype=2;
-    BEGIN(ParseType);
-  }
-  else 
-  {
-    //                      iFuncLine--;
-    parseProcessProto();  
-    BEGIN(ParseProcess);
-  }
-}                                                                               
-
-<Start>{LIBUSE}{BR}*       {      //  found library or package
-  bropen=0;
-  bufferClear();
-  isBody=0;
-  QCString qcs=QCString(yytext);
-  // lowerString(qcs);
-  qcs=qcs.stripWhiteSpace();
-  if (stricmp(qcs.data(),"use")==0)
-  {
-    current->spec=VhdlDocGen::USE;
-    current->type="package";
-  }
-  else 
-  {
-    current->spec=VhdlDocGen::LIBRARY;
-    current->type="library";
-  }
-  current->section=Entry::VARIABLE_SEC;
-  current->bodyLine=yyLineNr;
-  lineCount();
-  BEGIN(FindName);
-}
-
-<Start>{FUNCPROC}       {   // found a new function|procedure
-  lineCount();
-  iFuncLine=yyLineNr;
-  bropen=0;
-  bufferClear();
-  isFunc=1;
-  addText(yytext,yyleng);
-  BEGIN(FindFuncName);
-}
-
-<Start>{ENTITY}  {     // found entity|component|package
-  lineCount();
-  //printf("--> Entity at line %d\n",yyLineNr);
-
-  bropen=0;  
-  bufferClear();
-  QCString word(yytext);
-  word=word.lower();  
-  word=word.stripWhiteSpace();
-
-  if (strcmp(word.data(),"entity")==0)
-  {
-    isBody=0;
-    scantype=0;                                    
-    lastCompound=0;
-    current->section=Entry::CLASS_SEC;
-    current->spec=VhdlDocGen::ENTITY;
-    current->protection=Public;
-    current->bodyLine=yyLineNr;
-    current->fileName=yyFileName;
-    lastEntity = current;
-  }
-  else if (strcmp(word.data(),"component")==0)
-  {
-    current->section=Entry::VARIABLE_SEC;
-   // current->stat=TRUE;
-    current->spec=VhdlDocGen::COMPONENT;
-    current->bodyLine=yyLineNr;
-    scantype=1;  
-  }
-  else if (strcmp(word,"package")==0)
-  {
-    isBody=0;
-    scantype=0;
-    lastCompound = current;
-    current->section=Entry::CLASS_SEC;
-    current->spec=VhdlDocGen::PACKAGE;
-    current->protection=Package; //VhdlDocGen::PACKAGE;
-    current->bodyLine=yyLineNr;
-    current->fileName=yyFileName;
-  }
-  else
-    err("\n found wrong component at line [%d]",yyLineNr); 
-
-  BEGIN(FindEntityName);
-}
-
-<Start>{MAPCOMPONENT}|{MAPCOMPONENT1}  { // found component instantiation 
-
- // lineCount();
-  QCString type;
-  QCString tt(yytext);
-  QRegExp regg("[\\s:.()-]");
-  QStringList qsl=QStringList::split(regg,tt,false);
-
-  // consider upper/lower-case letters
-  QStringList qsltemp=QStringList::split(regg,tt.lower(),false);
-  int index=qsltemp.findIndex(QCString("entity"))+1;
-  index+=qsltemp.findIndex(QCString("component"))+1;
-  index+=qsltemp.findIndex(QCString("configuration"))+1;
-  int len=qsltemp.count();
-
-  current->spec=VhdlDocGen::COMPONENT_INST;
-  current->section=Entry::VARIABLE_SEC;
-  current->startLine=yyLineNr;
-  current->bodyLine=yyLineNr;
-
-  if (index!=0 && tt.contains(')')==0)     // found component instantiation xxx: configuration/component/entity yyy
-  {
-    current->type=(QCString)qsl[len-3];
-  }
-  else if (index!=0 && tt.contains(')'))   // found component instantiation xxx: entity www.yyy(zzz)
-  {
-    current->type=(QCString)qsl[len-4];
-  }
-  else
-  {
-    current->type=(QCString)qsl[1];          // found component instantiation xxx:yyy
-  }
-
-  current->name=QCString(qsl[0]);
-  if (lastCompound)
-  {
-    if (!VhdlDocGen::foundInsertedComponent(current->type,lastCompound))
-    {   
-      BaseInfo *bb=new BaseInfo(current->type,Public,Normal);
-      lastCompound->extends->append(bb);
-    }
-    lastCompound->addSubEntry(current);
-    current = new Entry;
-    initEntry(current);
-  }
-  else
-  {
-    newEntry();
-  }
- lineCount();
-
-} 
-
-<Start>{CR}*    {
-  lineCount();
-  addText(yytext,yyleng);
-  BEGIN(Start); 
-}
-
-<ParseProcess>[^;()] {
-  // eat process body
-  lineCount();
-  BEGIN(ParseProcess);
-}
-
-<ParseProcess,ParseType>{ENDPROCESS} {  // find end of process
-  lineCount();
-  current->endBodyLine=yyLineNr;
-  //printf("Process: start=%d end=%d\n",current->bodyLine,current->endBodyLine);
-  if (lastCompound)
-  {
-    lastCompound->addSubEntry(current);
-    current = new Entry;
-    initEntry(current);
-  }
-  else
-  {
-    newEntry();
-  }
-  BEGIN(Start);
-}
-
-
-<ParseUnits>{BR}* { 
-  lineCount();
-}
-
-<ParseUnits>{B}*[a-z_][^\n;]* { // parse record|unit body
-  lineCount();
-  QCString zz(yytext);
-  addSignals(zz.data(),yyLineNr,current);
-  BEGIN(ParseUnits);
-}
-
-<FindName>{NAME} {  // found entity|architecture|component name
-  lineCount();
-
-  QCString qcs(yytext);
-  qcs=qcs.stripWhiteSpace();
-  if (current->spec==VhdlDocGen::USE || current->spec==VhdlDocGen::LIBRARY)
-  {
-    int j=qcs.length();
-    int i=qcs.find(".");
-    if (i>0)
-      qcs=qcs.right(j-i-1);
-    i=qcs.find(".");
-    if (i>0)
-      qcs=qcs.left(i);            
-  /*  
-    -- Consider the case we have more than one entity in one file.Each entity has its own package/library
-    -- declaration. In this case package yyy will be added [with newEntry()] to architecture aaa !! instead to entity
-    -- bbb. We must place these constructs to current_root and the function mapLibPackage() will finish the rest.
-    
-    -- package xxx;
-    -- entity aaa
-    --  ....
-    -- end entity aaa;
-    -- architecture aaa
-    --     ...
-    -- end architecture aaa;
-    -- package yyy;
-    -- entity bbb;
-    */
-      
-    current->name=qcs;                 
-    Entry *copy=new Entry(*current);
-    current->reset();
-    addSubEntry(current_root,copy);   //  insert into entry list  with mapLibPackage()           
-  }
-  else if (current->spec==VhdlDocGen::ARCHITECTURE)
-  {
-    //current->name+=qcs.lower();
-    current->name.prepend(qcs+"::");
-
-    //if (lastEntity)
-    //{
-      // inherit private inheritance relation between entity and architecture
-      //if (!VhdlDocGen::foundInsertedComponent(current->name,lastEntity))
-      //{
-	//	BaseInfo *bb=new BaseInfo(current->name,Private,Normal);
-	//	lastEntity->extends->append(bb);    
-      //}
-    //}
-
-  }
-  else if (current->spec==VhdlDocGen::PACKAGE_BODY)
-  {
-    current->name+=qcs;
-  }
-  else
-  {
-    current->name+=qcs;
-  }
-  if (!(current->spec==VhdlDocGen::USE || current->spec==VhdlDocGen::LIBRARY))
-  newEntry();
-
-  BEGIN(Start);
-}
-
-<FindFuncName>{FUNCNAME}    { // found name of a process|function|procedure
-  lineCount();
-
-  addText(yytext,yyleng);
-  BEGIN(ParseType);
-}
-
-<FindTypeName>{NAME}{BR}* {
-  lineCount();                                                            
-  current->name=QCString(yytext);
-  BEGIN(ParseType);
-}
-
-
-<ParseType>("is"){BR}+("protected"){BR}+("body") {lineCount(); BEGIN(Start); }
-
-<ParseType>("is"){BR}+("protected"){BR}+ { 
- lineCount();
- current->section=Entry::VARIABLE_SEC;
- current->spec=VhdlDocGen::TYPE;
- current->type="protected"; 
- newEntry(); 
-  BEGIN(Start);
-}
-
-
-
-
-<ParseType>("is"){BR}*("record") { // find record
-  lineCount();
-  if (isFunc)
-  {
-    BEGIN(Start);
-  }
-
-  genPort=2;
-  current->section=Entry::VARIABLE_SEC;
-  current->spec=VhdlDocGen::RECORD;
-  addText(yytext,yyleng); 
-  newEntry(); // adds the record to the last compound
-  BEGIN(ParseRecord);
-}
-
-<ParseRecord>{BR}* {
-  lineCount();
- }
-
-<ParseRecord>("end"){BR}*("record"){BR}*{LETTER}*{BR}*[;]|("end"){BR}*("units"){BR}*[;]  {
-  lineCount();
-  genPort=0;
-  bufferClear();
-  BEGIN(Start);
-}
-
-<ParseRecord>[a-z_A-Z0-9][^\n;]*";"({B}*{COMMENT})* { // parse record body
-  lineCount();
-  QCString comment;
-  QCString zz(yytext);
-  VhdlDocGen::deleteAllChars(zz,';'); //delete ; in unit construct
-  if (zz.contains("--!"))
-  {
-    QStringList ql=QStringList::split("--!",zz,FALSE);
-    comment = ql[1];
-    zz = ql[0];
-  }
-  else if (zz.contains("--"))
-  {
-    QStringList ql=QStringList::split("--",zz,FALSE);
-    zz = ql[0];
-  }
-  initEntry(current);
-  addSignals(zz,yyLineNr,current,comment);
-  addText(yytext,yyleng); 
-  BEGIN(ParseRecord);
-}
-
-<ParseType>{BR}+("is"){BR}+|{BR}+("is"){B}*"--" { // found a new function  in an architecture ?
-  addText(yytext,yyleng);
-  lineCount();
-  QCString ttt;
-  bool bb=TRUE;
-  getBufText(ttt,0);
-  if (ttt.contains("--"))
-  { 
-    unput('-');unput('-'); 
-    VhdlDocGen::deleteCharRev(ttt,'-');
-    VhdlDocGen::deleteCharRev(ttt,'-');
-  }
-  if (ttt.contains('(') != ttt.contains(')'))
-  {
-    bb=FALSE;
-  }
-  bool ss = VhdlDocGen::isFunctionProto(ttt);
-  //printf("VhdlDocGen::isFunctionProto(%s)=%d\n",ttt.data(),ss);
-  if (ss && bb)
-  {
-    bufferClear();
-    addText(ttt.data(),ttt.length());
-    functionEntry=0;
-    //eFuncBody=new Entry;
-    ::parseFunctionProto();
-  }
-  bufferClear();  
-  BEGIN(ParseType);
-}
-
-
-<ParseType>[^;()\t ] {
-  lineCount();      
-  addText(yytext,yyleng); 
-  BEGIN(ParseType);
-}
-
-<ParseType>{BRACEOPEN} {
-  lineCount();
-  bropen++;
-  addText(yytext,yyleng);
-  BEGIN(ParseType);
-}
-
-<ParseType>{BRACECLOSE} {
-  lineCount();
-  bropen--;
-  addText(yytext,yyleng);
-  if (bropen==0 && scantype==2) // process
-  {
-    ::parseProcessProto();
-    BEGIN(ParseProcess);
-  } // if
-  else
-  {
-    BEGIN(ParseType);
-  }
-}
-
-
-<ParseType>{ENDE}|{ENDFUNC} { // found end of function|process
-  QRegExp regg("[\\s;]");
-  lineCount();
-  QCString tt(yytext);
-  tt=tt.lower();
-  QStringList ql=QStringList::split(regg,tt,FALSE);
-  int index=ql.findIndex(QCString("if"))+1;
-  index+=ql.findIndex(QCString("case"))+1;
-  index+=ql.findIndex(QCString("loop"))+1;
-  index+=ql.findIndex(QCString("generate"))+1;
-  bufferClear();
-  if (index==0)
-  {
-    if (isFunc)
-    {
-      Entry* pFunc=getEntryAtLine(current_root,iFuncLine);
-      if (pFunc && pFunc->section==Entry::FUNCTION_SEC)
-      {
-	pFunc->endBodyLine=yyLineNr;
-      }
-      isFunc=0;
-      BEGIN(Start);
-    }
-  }
-}
-
-<ParseFunc>[^;()] {
-  // eat process body
-  lineCount();
-  BEGIN(ParseFunc);
- }
-
-<ParseFunc>{ENDE3} {
-  QRegExp regg("[\\s;]");
-  lineCount();
-  QCString tt(yytext);
-  tt=tt.lower();
-  QStringList ql=QStringList::split(regg,tt,FALSE);
-  int index=ql.findIndex(QCString("if"))+1;
-  index+=ql.findIndex(QCString("case"))+1;
-  index+=ql.findIndex(QCString("loop"))+1;
-  index+=ql.findIndex(QCString("generate"))+1;
-  bufferClear();
-  if (index==0 && isFunc)
-  {
-    Entry* pFunc=getEntryAtLine(current_root,iFuncLine);
-    if (pFunc && pFunc->section==Entry::FUNCTION_SEC)
-    {
-      pFunc->endBodyLine=yyLineNr;
-    }
-    isFunc=0;
-    BEGIN(Start);
-  }
-}
-
-<ParseType>";" {
-  lineCount();
-  addText(yytext,yyleng);    
-  if (bropen==0 && !(isFunc==1 && isBody==1) )
-  {
-    if (isFunc)
-    {
-      parseFunctionProto();
-      bufferClear();
-      if (lastCompound && lastCompound->spec==VhdlDocGen::PACKAGE) 
-      {
-        isFunc=0;
-        BEGIN(Start);
-      }
-      else
-      {
-        BEGIN(ParseFunc); 
-      }
-    }//if
-    else
-    {
-      QCString qcs;
-      getBufText(qcs,0);
-      qcs=qcs.stripWhiteSpace();
-      current->section=Entry::VARIABLE_SEC;
-      current->type+=qcs.data();  
-
-      if ((current->spec==VhdlDocGen::SIGNAL   || 
-	   current->spec==VhdlDocGen::CONSTANT || 
-	   current->spec==VhdlDocGen::TYPE     || 
-	   current->spec==VhdlDocGen::SUBTYPE  ||
-	   current->spec==VhdlDocGen::SHAREDVARIABLE
-	  ) &&  
-	  qcs.stripPrefix(","))
-      {
-	QList<QCString> ql;
-	ql.setAutoDelete(TRUE);
-	QCString buffer;
-	if (current->spec==VhdlDocGen::SUBTYPE || 
-	    current->spec==VhdlDocGen::TYPE
-	   )
-	{
-	  VhdlDocGen::getSigTypeName(ql,qcs.data(),buffer);
-	}
-	else
-	{
-	  VhdlDocGen::getSigName(ql,qcs.data(),buffer);
-	}
-	QCString doc = current->doc;
-	QCString brief = current->brief;
-	if (ql.count()>0) 
-	{
-	  for (uint j=1;j<ql.count();j++)
+{space_character}  { /* nothing */ }
+\&                 { return(t_Ampersand); }
+\'                 { return(t_Apostrophe); }
+\(                 { return(t_LeftParen); }
+\)                 { return(t_RightParen); }
+"**"               { return(t_DoubleStar); }
+\*                 { return(t_Star); }
+\+                 { return(t_Plus); }
+\,                 { return(t_Comma); }
+\-                 { return(t_Minus); }
+":="               { return(t_VarAsgn); }
+\:                 { return(t_Colon); }
+\;                 { return(t_Semicolon); }
+"<="               { return(t_LESym); }
+">="               { return(t_GESym); }
+\<                 { return(t_LTSym); }
+\>                 { return(t_GTSym); }
+\=                 { return(t_EQSym); }
+\/=                { return(t_NESym); }
+"=>"               { return(t_Arrow); }
+"<>"               { return(t_Box); }
+"<<"               { return(t_SLSL); }
+">>"               { return(t_SRSR); }
+"??"               { return(t_QQ); }
+"?>="              { return(t_QGT); }
+"?<="              { return(t_QLT); }
+"?>"               { return(t_QG); }
+"?<"               { return(t_QL); }
+"?="               { return(t_QEQU); }
+"?/="              { return(t_QNEQU); }
+\?                 { return(t_Q); }
+\|                 { return(t_Bar); }
+\.                 { return(t_Dot); }
+\/                 { return(t_Slash); }
+\@                 { return(t_At); }
+\^                 { return(t_Neg); }
+\[                 { return(t_LEFTBR); }
+\]                 { return(t_RIGHTBR); }
+
+
+{letter}(_?{letter_or_digit})*|{extended_character} 	{
+          int itoken=find_keyword(vhdlScanYYtext);
+        
+          //	fprintf(stderr,"\n <<<< search tok:  %s %d %d>>>\n",vhdlScanYYtext,itoken,yyLineNr);
+        
+          // tokens in vhdlparser.hpp 258..412
+	  if (itoken>200  && itoken<500 && prevToken!=t_END)
 	  {
-	    Entry *ppt = new Entry;
-            initEntry(ppt);
-	    ppt->type     += ql.at(0)->data();  
-	    ppt->section   = Entry::VARIABLE_SEC;
-	    ppt->spec      = current->spec;        
-	    ppt->name     += ql.at(j)->data();
-	    ppt->bodyLine  = yyLineNr;
-	    ppt->startLine = yyLineNr;
-	    ppt->brief     = brief;
-	    ppt->doc       = doc;
-	    if (lastCompound)
-	    {
-	      lastCompound->addSubEntry(ppt);
-	    }
-	    else
-	    {
-	      current->addSubEntry(ppt);
-	    }
+	    //  	printf("\n <<<< insert tok:  %s %d %d>>>\n",vhdlScanYYtext,itoken,yyLineNr);
+	    lineIndex[itoken]=yyLineNr;
 	  }
-	  current->type=ql.at(0)->data(); 
-	  ql.clear();   
-	}
-      }
-      if (lastCompound)
-      {
-	lastCompound->addSubEntry(current);
-	current = new Entry;
-	initEntry(current);
-      }
-      else
-      {
-	newEntry();
-      }
-      isFunc=0;
-      bufferClear();
-      BEGIN(Start);
-    }
-  }
-  else
-  {
-    BEGIN(ParseType);
-  }
-}
-
-<ParseType>{BR}* {
-  lineCount();
-  addText(yytext,yyleng);
-  BEGIN(ParseType);
-}
-
-<FindEntityName>{NAME} {    // found name of an entity/architecture/package
-  lineCount();
-  QCString qcs(yytext);
-  qcs=qcs.stripWhiteSpace();
-  qcs=qcs.lower();
-  if (strcmp(qcs.data(),"body")==0) // found package body
-  {
-    current->spec=VhdlDocGen::PACKAGE_BODY;
-    current->section=Entry::CLASS_SEC;
-    current->protection=Protected;
-    current->name+=QCString("_");
-    isBody=1;
-    BEGIN(FindName);
-  }
-  else if (scantype==1) // found a component
-  {
-    QCString qq(yytext);
-    qq=qq.stripWhiteSpace();
-    //qq=qq.lower();
-
-    current->name=qq;
-    qq=qq.lower();
-    if (lastCompound)
-    {
-      if (lastCompound->spec==VhdlDocGen::PACKAGE)
-      {
-        if (!VhdlDocGen::foundInsertedComponent(qq,lastCompound))
-        {  
-	  BaseInfo *bb=new BaseInfo(qq,Private,Normal);
-	  lastCompound->extends->append(bb);    
+	  prevToken=itoken;
+        
+          yycont->qstr=vhdlScanYYtext;
+          yycont->yyLineNr=yyLineNr;
+          if (itoken== -1)  
+          {
+            yycont->iLine=yyLineNr;
+            return ( t_LETTER );
+          }
+          else 
+          {
+            return ( itoken );
+          }
         }
-      } 
-
-      lastCompound->addSubEntry(current);
-      current = new Entry;
-      initEntry(current);
-    }
-    else
-    {
-      newEntry();
-    }
-    BEGIN(Start);
-  } 
-  else
-  {
-    QCString qq(yytext);
-    qq=qq.stripWhiteSpace();
-    current->name=qq;
-    newEntry();
-    //QCString qreal=QCString(yytext);
-    BEGIN(Start);
-  }
-}
-
-<Start>{B}*("generic"|"port"){BR}*[(]+ { // found generic|port in entity
-    QCString genp(yyleng+1);
-    deleteSpecChars(yytext,genp.data());
-    VhdlDocGen::deleteCharRev(genp,'(');
-
-    if (stricmp(genp.data(),"port" )==0)
-    {
-      genPort=1;
-    }
-    else 
-    {
-      genPort=0;
-    }
-
-    bropen=1;
-    bufferClear();
-    lineCount();
-    BEGIN(FindSigName);
-}
-
-<FindSigName>{BRACECLOSE} { 
-    lineCount();
-    bropen--;
-    addText(yytext,yyleng); 
-    if (bropen==0)
-    {
-      bufferClear();
-      BEGIN(Start);
-    }
-    else
-    {
-      BEGIN(FindSigName);
-    }
-}
-
-<FindSigName>{LABELID} {  // found signals in entity
-  QCString line(yytext);
-
-  // note that line can be something like:
-  // "var1, var2, var3 : in std_logic_vector(8 downto 0); --! Some comment"
-
-  // but also
-  // "var4 --! Some comment
-  // );"
-  // which marks the end of a port
-
-  // and also
-  // "-- Some comment
-  // var1 : in std_logic;"
-
-  //printf("--> labelid='%s'\n",line.data());
-  QStringList ql;
-  QCString comment;
-  int openCount=line.contains('(');
-  int closeCount=line.contains(')');
-  int semi = line.find(';');
-  int pos  = line.find("--");
-  int pos1 = line.find("--!");
-  if (pos!=-1 && pos<pos1) // strip normal comment before special one
-  {
-    line = line.remove(pos,pos1-pos);
-  }
-  //printf("=> signal: line='%s'\n",line.data());
-  if (semi!=-1 && pos!=-1)
-  {
-    int eol = line.findRev('\n');
-    //printf("pos=%d eol=%d\n",pos,eol);
-    if (eol>=pos+2)
-    {
-      QRegExp re("\\n[\\s]*--!"); // comment continuation
-      comment=line.mid(pos+2,eol-pos-2);
-      //printf("Comment: '%s'\n",comment.data());
-      int p,l;
-      while ((p=re.match(comment,0,&l))!=-1)
-      {
-	comment.remove(p,l);
-      }
-      line=line.left(pos)+line.right(line.length()-eol);
-    }
-    else
-    {
-      comment=line.mid(pos+2);
-      line=line.left(pos);
-    }
-    comment.stripWhiteSpace();
-    // must subtract "(" and ")" in comments because they are used for determining the
-    // end of a port/generic construct
-    openCount-=comment.contains('(');
-    closeCount-=comment.contains(')');
-    if (!comment.stripPrefix("!")) // not a special comment
-    {
-      comment.resize(0);
-    }
-  }
-  else
-  {
-    //printf("no ; or --: pos=%d semi=%d\n",pos,semi);
-  }
-  int diff=openCount-closeCount;
-  if (diff<0)
-  {
-    VhdlDocGen::deleteCharRev(line,')');
-  }
-
-  if (scantype!=1) // not a component
-  {  
-    addText(yytext,yyleng);
-    addSignals(line,yyLineNr,lastEntity,comment);
-  } 
-
-  lineCount();
-
-  if ((bropen+openCount-closeCount)==0)
-  {
-    bufferClear();
-    BEGIN(Start);
-  }
-}
-
-
-<FindSigName>{BRACEOPEN} { 
-  lineCount();
-  bropen++;
-  addText(yytext,yyleng);
-}
-
 
-<FindSigName>{CR}        { 
-  lineCount();
-  addText(yytext,yyleng);
-  //BEGIN(FindSigName);
-}
+({decimal_literal})|({base}#{based_integer}(\.{based_integer})?#({exponent})?)|({base}:{based_integer}(\.{based_integer})?:({exponent})?) {
+          yycont->qstr=vhdlScanYYtext;
+          return ( t_ABSTRLIST );
+        }
 
+'({graphic_character}|\"|\%)' 	{
+          QCString q(vhdlScanYYtext);	       
+          yycont->qstr=vhdlScanYYtext; 
+        
+          if (q=="'('") // std_logic'('1') ?
+          {
+            char c=yy_hold_char;
+            if (isalpha(c) || isdigit(c))
+            {
+              unput('\'');
+              unput('(');
+              return(t_Apostrophe);
+            }
+            else
+	    {
+              return ( t_CHARLIST );
+	    }
+          }
+          return ( t_CHARLIST );
+        }
 
-<*>^{B}*("for ")[^;]* {
-  //printf("\n found for[%s] [%d]",yytext,yyLineNr);
-  lineCount();
-}
+(\"({graphic_character}|(\"\")|\%)*\")|(\%({graphic_character}|(\%\%)|\")*\%) {
+          yycont->qstr=vhdlScanYYtext;
+          yycont->iLine=yyLineNr;
+	  return ( t_STRING );
+        } 
 
-<*>{DIGITS}                {   // found digit
-  addText(yytext,yyleng);
-  lineCount();
-}
+{base_specifier}(\"{extended_digit}(_?{extended_digit})*\"|\%{extended_digit}(_?{extended_digit})*\%) 							{
+	  yycont->qstr=vhdlScanYYtext;
+	  yycont->iLine=yyLineNr;
+	  return ( t_DIGIT );
+        }
 
-<*>{STRING_LITERAL} {
-  // Make sure string literals get transfered to the output
-  // We have to match these because the comment characters (--)
-  // can exist inside a string literal.
-  // We shouldn't have to call lineCount because newlines
-  // are not allowed inside string literals
-  addText(yytext,yyleng);
-}
+{vhdl2008tooldir} {
+	  yycont->qstr=vhdlScanYYtext;
+	  yycont->iLine=yyLineNr;
+	  return(t_ToolDir);
+        }	
 
-   /*
-<*>{BR}*"--!"{B}*"@}"    { // end group
-  if (current) 
-  {
-    Entry *pg=new Entry;  
-    addSubEntry(current,pg);
-    pg->startLine=yyLineNr;
-    pg->name="endgroup";
-  }
-  lineCount();
-}
+\n	{
+	  yyLineNr++;
+          yycont->yyLineNr=yyLineNr;
+        }
 
-<*>{BR}*"--!"{B}*"@{"     {  // start group
-  if (current) 
-  {
-    Entry *pg=new Entry;  
-    addSubEntry(current,pg);
-    pg->startLine=yyLineNr;
-    pg->name="startgroup";
-  }
-  lineCount();
-}
-   */
+<*>"--"[^\n]* {
+          /* comment */
+	  QCString qcs(vhdlScanYYtext);
+	  //  vhdl comment ?
+	  if (qcs.stripPrefix("--!"))
+	  {
+	    REJECT;
+	  }
+        }               
+.	{ /* unknown characters */ }
+									
 
 <*>{BR}*"--!"[^{}\n][^\n]*\n/{B}*"--!" { // multi line comment
   if (iDocLine==-1) iDocLine=yyLineNr;
-  // signal clk :in std_logic; --!@brief global clock
-  // --!@brief  global reset
-  // signal reset:in std_logic;
-  // these two comments are detected as a multi line comment
-  QCString qc(yytext);
+  QCString qc(vhdlScanYYtext);
   int len=qc.contains('\n')+yyLineNr-1;
-
   if (YY_START!=Comment) // Start of the comment block
   {
-    bufferClear();
-    iTextCounter=0;
     startComment=yyLineNr;
     g_lastCommentContext=YY_START;
   }
@@ -1560,12 +516,13 @@ ENDPROTECEDBODY         "end"{BR}+"protected"{BR}+"body"{BR}+{NAME}
   if (pTemp)
   { // found one line comment, add it to the entry on this line
     pTemp->briefLine=yyLineNr;
-    pTemp->brief+=yytext;
+    pTemp->brief+=vhdlScanYYtext;
+    pTemp->briefFile=yyFileName;
     VhdlDocGen::prepareComment(pTemp->brief);
   }
   else 
   {
-    addText(yytext,yyleng);
+    strComment+=vhdlScanYYtext;
   }
   lineCount();
   BEGIN(Comment);
@@ -1573,237 +530,260 @@ ENDPROTECEDBODY         "end"{BR}+"protected"{BR}+"body"{BR}+{NAME}
 
 <Comment>^{B}*"--!"[^\n]* {
   if (iDocLine==-1) iDocLine=yyLineNr;
-  addText(yytext,yyleng);
+  strComment+=vhdlScanYYtext;
+      
   lineCount();
 }
 
 <Comment>.|\n {
-  // found end of comment block
-  QCString qcs;
-  getBufText(qcs,iTextCounter);
-  VhdlDocGen::prepareComment(qcs);
-  int ii =qcs.find("\\code");
-  if (ii>0)
-  {
-    iCodeLen=num_chars;
-
-    gBlock.reset();
-    int len=qcs.length();
-    QCString name=qcs.right(len-ii);
-    name=VhdlDocGen::getIndexWord(name.data(),1);
-    if (!name)
-      gBlock.name="misc"+ VhdlDocGen::getRecordNumber(); 
-    else
-      gBlock.name=name;
-    qcs=qcs.left(ii);
-    gBlock.startLine=yyLineNr+1;
-    gBlock.bodyLine=yyLineNr+1;
-    gBlock.brief+=qcs;
-    iTextCounter=0;
-  }
+          // found end of comment block
+          
+          int index =strComment.find("\\code");
+          if (index>0)
+          {
+            int ll=strComment.length();
+            iCodeLen=inputVhdlString.findRev(strComment.data(),num_chars)+ll;
+        
+            gBlock.reset();
+            int len=strComment.length();
+            QCString name=strComment.right(len-index);// 
+            name=VhdlDocGen::getIndexWord(name.data(),1);
+            if (!name)
+              gBlock.name="misc"+ VhdlDocGen::getRecordNumber(); 
+            else
+              gBlock.name=name;
+            strComment=strComment.left(index);
+            gBlock.startLine=yyLineNr+1;
+            gBlock.bodyLine=yyLineNr+1;
+            VhdlDocGen::prepareComment(strComment);
+            gBlock.brief+=strComment;
+          }
+        
+          VhdlDocGen::prepareComment(strComment);
+        
+        
+          if (index==-1) 
+            handleCommentBlock(strComment,FALSE);
+          strComment.resize(0);;
+          unput(*vhdlScanYYtext);
+          BEGIN(g_lastCommentContext);
+        }
+        
+<*>"--!"[^\n]* { // one line comment
+          if (iDocLine==-1) iDocLine=yyLineNr;
+          QCString qcs(vhdlScanYYtext);
+
+	  bool isEndCode=qcs.contains("\\endcode");
 
-  if (ii==-1)
-  {
-    handleCommentBlock(qcs,FALSE);
-  }
-  bufferClear();
-  unput(*yytext);
-  BEGIN(g_lastCommentContext);
-}
+	  if (isEndCode)
+	  {
+	    int end=inputVhdlString.find(qcs.data(),iCodeLen);
+	    makeInlineDoc(end);
+	  }
 
-<*>"--!"[^\n]* { // one line comment
-  if (iDocLine==-1) iDocLine=yyLineNr;
-  QCString qcs(yytext);
-  int j=qcs.find("--!");
-  qcs=qcs.right(qcs.length()-3-j);
-  bool isEndCode=qcs.contains("\\endcode");
+	  //printf("--> handleCommentBlock line %d\n",yyLineNr);
+	  Entry* pTemp=getEntryAtLine(current_root,yyLineNr);
 
-  if (isEndCode)
-    makeInline();
-  //printf("--> handleCommentBlock line %d\n",yyLineNr);
-  Entry* pTemp=getEntryAtLine(current_root,yyLineNr);
+	  if (!isEndCode)
+	  {
+	    int j=qcs.find("--!");
+	    qcs=qcs.right(qcs.length()-3-j);
 
-  if (!isEndCode)
-  {
-    if (pTemp)
-    {
-      pTemp->briefLine=yyLineNr;
-      pTemp->brief+=qcs;
-      iDocLine=-1;
-    }
-    else
-    {
-      handleCommentBlock(qcs,TRUE);
-    }
-  } 
+	    if (pTemp)
+	    {
+	      pTemp->briefLine=yyLineNr;
+	      qcs=qcs.stripWhiteSpace();
+	      pTemp->brief+=qcs;
 
-  bufferClear();
-}// one line
+	      pTemp->briefFile=yyFileName;
+	      iDocLine=-1;
+	    }
+	    else
+	    {
+	      handleCommentBlock(qcs,TRUE);
+	    }
+	  }//endcode
+        }
 
+<*>"/*" {
+	  strComment+=vhdlScanYYtext;
+	  if (yy_hold_char=='!') // found  comment starting with "/*!"
+  	  {
+	    doxComment=TRUE;
+	  }
+	  BEGIN(Vhdl2008Comment); 
+        }
 
-<*>{COMMENT} {
-}
+<Vhdl2008Comment>[^*]*[*]+    {
+    	  QCString tt(vhdlScanYYtext);
+	  int len=tt.length();
+	  yyLineNr+=tt.contains('\n');
 
-<*>\n                    {
-  lineCount();
-  addText(yytext,yyleng);
-  //         printf("\n new-line [%d]",yyLineNr);
-  BEGIN(Start);
-}
+	  // delete * from comments 
+	  // /*! 
+	  // *   see vim !
+	  // */
 
-<*>{NAME} {
-  addText(yytext,yyleng);
-  lineCount();
-}
+	  if (yytext[len-1]=='*' && tt.contains('\n'))
+	  {
+	    QCString ss=tt;
+	    VhdlDocGen::deleteAllChars(ss,' ');
+	    VhdlDocGen::deleteAllChars(ss,'\t');
+	    if (ss.data()  && ss.at(ss.length()-2)=='\n')
+	    {
+	      tt=tt.left(len-1);
+	      len--;
+	    }
+	  }
 
-<*>{B}*	{
-  addText(yytext,yyleng);
-  lineCount();
-}
+	  //	   fprintf(stderr,"\n << %s  >>",tt.data());
+	  strComment+=tt;
+	  char c=yy_hold_char;
+	  if (c =='/')
+	  {
+	    unput('*');
+	    BEGIN(Vhdl2008Comment);
+	  }
+	  else 
+	  {
+	    BEGIN(EndVhdl2008Comment);
+	  }
+        }
 
-<*>.                    {
-  addText(yytext,yyleng);
-  lineCount();
-}
+<EndVhdl2008Comment>"*/" {	 
+          if (doxComment)
+          {  
+            strComment.stripPrefix("/*!");
+            strComment= strComment.left(  strComment.length()-1);
+            handleCommentBlock( strComment,TRUE);
+          }
+          doxComment=FALSE;
+          strComment.resize(0);
+          BEGIN(INITIAL);
+        }
 
 
 %%
 
-static void initEntry(Entry *e)
+static void parserInit()
 {
-  e->fileName = yyFileName;
-  e->lang     = SrcLangExt_VHDL;
-  initGroupInfo(e);
-}
+  num_chars=0;
+  lineIndex=(int*)malloc(500*sizeof(int));
 
-static void newEntry()
-{
-  // Add only enties/architectures/packages to root 
-  // and signals to  classes where they were found
-  // ENTITY dlatch_93 IS -- VHDL'93-Syntax !!!
-  //      PORT (d, clk : IN bit;
-  //      q, qbar : OUT bit);
-  //      GROUP path IS (SIGNAL, SIGNAL);
-  //      GROUP d_to_q : path (d, q);
-  //      ATTRIBUTE propagation : time;
-  //  END dlatch_93;
-
-  if (current->spec==VhdlDocGen::ENTITY || 
-      current->spec==VhdlDocGen::PACKAGE || 
-      current->spec==VhdlDocGen::ARCHITECTURE || 
-      current->spec==VhdlDocGen::PACKAGE_BODY)
-  {
-    current_root->addSubEntry(current);
-  }
-  else
+  if (!g_lexInit) 
   {
-    if (lastCompound) 
-    {
-      lastCompound->addSubEntry(current);
-    }
-    else
+    VhdlDocGen::init();
+    el_mc oop;
+    int p=0;
+    while ((oop=tab_mc[p++]).kval!=-1)
     {
-      if (lastEntity)
-      {
-	lastEntity->addSubEntry(current);
-      }
-      else 
-      {
-	current_root->addSubEntry(current); // should not happen!
-      }
+      QCString q(&oop.nom[0]);
+      keyMap.insert(q,oop.kval);
     }
   }
-  previous = current;
-  current = new Entry ;
-  initEntry(current);
 }
 
-static void handleCommentBlock(const QCString &doc,bool brief)
+void vhdlscanFreeScanner()
 {
-  int position=0;
-  bool needsEntry=FALSE;
-  Protection protection=Public;
-  int lineNr = iDocLine;
-  if (brief) 
-    current->briefLine = iDocLine; 
-  else 
-    current->docLine = iDocLine;
-
-  //printf("parseCommentBlock %p [%s]\n",current,doc.data());
-  while (parseCommentBlock(
-	g_thisParser,
-	current,
-	doc,        // text
-	yyFileName, // file
-	lineNr,     // line of block start
-	brief, 
-	docBlockAutoBrief,
-	FALSE,
-	protection,
-        position,
-        needsEntry
-        )
-     ) 
-  {
-    //printf("parseCommentBlock position=%d [%s]\n",position,doc.data()+position);
-    if (needsEntry) newEntry();
-  }
-  if (needsEntry)
+#if defined(YY_FLEX_SUBMINOR_VERSION)
+  if (g_lexInit)
   {
-    newEntry();
+    vhdlScanYYlex_destroy();
   }
+#endif
+}
 
-  if (docBlockTerm)
-  {
-    unput(docBlockTerm);
-    docBlockTerm=0;
-  }
-  iDocLine=-1;
+void VHDLLanguageScanner::resetCodeParserState()
+{
 }
 
-#if 0
-/*!
- * adds grouping to the entries
- */
-static void mergeGrouping(const Entry* ce,int)
+bool VHDLLanguageScanner::needsPreprocessing(const QCString & /*extension*/)
+{ 
+  return TRUE; 
+}
+
+void VHDLLanguageScanner::parsePrototype(const char * /*text*/)
+{ 
+  assert(FALSE); 
+}
+
+// do parsing
+int MyParserVhdl::doLex()
 {
-  EntryListIterator eli(*ce->children());
-  Entry *rt;
-  for (;(rt=eli.current());++eli)
-  {
-    if (rt->section==Entry::GROUPDOC_SEC)
-    {
-      if (openGroups)
-      {
-	QCString tt=(QCString)qrl.last();
-	if (!tt.isEmpty()) 
-	{
-	  rt->groups->append(new Grouping(tt.data(),Grouping::GROUPING_LOWEST));
-	}
-      }
-      qrl.append(rt->name);    
-    }
+  int token=vhdlScanYYlex();
+  //fprintf(stderr,"\ntoken: %d at line: %d",token,yyLineNr);
+  return token;
+}
 
-    if ((strcmp(rt->name.data(),"endgroup")==0) && !qrl.isEmpty())
-    {
-      qrl.remove((QCString)qrl.last());
-      openGroups--;
-    }
+void VHDLLanguageScanner::parseInput(const char *fileName,const char *fileBuf,Entry *root)
+{
+  yyFileName=QCString(fileName);
 
-    if ((strcmp(rt->name.data(),"startgroup")==0))
-    {
-      openGroups++;
-    }
+  bool xilinx_ucf=isConstraintFile(yyFileName,".ucf");
+  bool altera_qsf=isConstraintFile(yyFileName,".qsf");
 
-    if (rt->section!=Entry::GROUPDOC_SEC && openGroups && !qrl.isEmpty())
-    {
-      rt->groups->append(new Grouping(qrl.last().data(),Grouping::GROUPING_LOWEST));
-    }
+  // support XILINX(ucf) and ALTERA (qsf) file
+
+  if (xilinx_ucf) 
+  { 
+    VhdlDocGen::parseUCF(fileBuf,root,yyFileName,FALSE);  
+    return; 
+  }
+  if (altera_qsf) 
+  { 
+    VhdlDocGen::parseUCF(fileBuf,root,yyFileName,TRUE); 
+    return; 
+  }
+
+  ::parserInit();
+  yycont=getVhdlCont();
+  yycont->root=root;
+  yycont->fileName=fileName;
+  initVhdlParser();
+  QCString pPuffer(" ");
+  pPuffer+=fileBuf;
 
-    mergeGrouping(rt,openGroups);
+  inputFile.setName(fileName);
+  if (g_lexInit)
+  {
+    vhdlScanYYrestart( vhdlScanYYin );
   }
+  g_lexInit=TRUE;
+  g_thisParser=this;
+  inputPosition=0;
+  inputVhdlString=fileBuf;
+  yyLineNr=1;
+  current_root=root;
+  pconv=new MyParserVhdl();
+  groupEnterFile(fileName,yyLineNr);
+  pconv->parse(pconv);
+  //    resetScanner(NULL,pconv);
+  delete pconv;	  	  
+  Entry* curr=getCurrentVhdlEntry(); // delete last current
+  delete curr;
+  curr=0;
+  free(lineIndex);
+  inputFile.close();
+  mapLibPackage(root);
+}
+
+void VHDLLanguageScanner::parseCode(CodeOutputInterface &codeOutIntf,
+    const char *scopeName,
+    const QCString &input,
+    bool isExampleBlock,
+    const char *exampleName,
+    FileDef *fileDef,
+    int startLine,
+    int endLine,
+    bool inlineFragment,
+    MemberDef *memberDef,
+    bool showLineNumbers
+    )
+{
+  ::parseVhdlCode(codeOutIntf,scopeName,input,isExampleBlock,exampleName,
+                  fileDef,startLine,endLine,inlineFragment,memberDef,
+                  showLineNumbers);
 }
-#endif
 
 /*
  * adds the library|use statements to the next class (entity|package|architecture|package body
@@ -1816,7 +796,6 @@ static void mergeGrouping(const Entry* ce,int)
  * .....
  * and so on..
  */
-
 static void mapLibPackage(const Entry* ce)
 {
   Entry *lastComp=0;
@@ -1830,7 +809,7 @@ static void mapLibPackage(const Entry* ce)
     for (;(rt=eli.current()),eli1=eli;++eli)
     {
       if (rt->spec==VhdlDocGen::LIBRARY || rt->spec==VhdlDocGen::USE)
-        // top level library or use statement
+	// top level library or use statement
       {
 	Entry *temp=0;
 	for (;(temp=eli1.current());++eli1) // find next entity
@@ -1863,180 +842,72 @@ static void mapLibPackage(const Entry* ce)
   }//while
 }//MapLib
 
-#if 0
-/*!
- * merges a brief descriptions to the next entry
- */
-void mergeBrief(const Entry* ce)
-{
-  EntryListIterator eli(*ce->children());
-  Entry *rt;
-  for (;(rt=eli.current());++eli)
-  {
-
-    if (found && (!eMerge.brief.isEmpty() || !eMerge.doc.isEmpty()))
-    {
-      rt->doc+=eMerge.doc.data();
-      rt->docLine=eMerge.docLine;
-      rt->brief+=eMerge.brief.data();
-      rt->briefLine=eMerge.briefLine;
-      found=FALSE;
-    }
-
-    if ((strcmp(rt->name.data(),"string")==0))
-    {
-      eMerge.reset();
-      eMerge.doc+=rt->doc.data();
-      eMerge.docLine=rt->docLine;
-      eMerge.brief+=rt->brief.data();
-      eMerge.briefLine=rt->briefLine;
-
-      found=TRUE;
-    }
-    MergeBrief(rt);
-  }
-}
-#endif
-
-
-
-void vhdlscanFreeScanner()
+static void handleCommentBlock(const QCString &doc,bool brief)
 {
-#if defined(YY_FLEX_SUBMINOR_VERSION)
-  if (g_lexInit)
-  {
-    vhdlscanYYlex_destroy();
-  }
-
-  if (g_buf)
-  {
-    free(g_buf);
-  }
+  int position=0;
+  bool needsEntry=FALSE;
+  Protection protection=Public;
+  int lineNr = iDocLine;
 
-  g_buf=0;
-#endif
+  Entry* current=getCurrentVhdlEntry();
 
-}
+  if (brief) 
+    current->briefLine = iDocLine; 
+  else 
+    current->docLine = iDocLine;
 
-void VHDLLanguageScanner::parseInput(const char *fileName,const char *fileBuf,Entry *root)
-{
-  inputFile.setName(fileName);
-  //uint jfile=inputFile.size();
-  ::parserInit(); 
-  yyFileName=QCString(fileName);
-  groupEnterFile(fileName,yyLineNr);
-  g_thisParser = this;
-  g_inputFromFile = FALSE;
-  inputPosition = 0;
-  assert(root!=0);
-
-  inputString=fileBuf;
-  inputLen=strlen(fileBuf);
-  current_root  = root;
-  global_root   = root;
-  current=new Entry;
-  initEntry(current);
-  //current_root->name=QCString("XXX"); // dummy name for root
-  if (!inputFile.open(IO_ReadOnly))
+  //printf("parseCommentBlock %p [%s]\n",current,doc.data());
+  while (parseCommentBlock(
+	g_thisParser,
+	current,
+	doc,        // text
+	yyFileName, // file
+	lineNr,     // line of block start
+	brief, 
+	0,
+	FALSE,
+	protection,
+        position,
+        needsEntry
+        )
+     ) 
   {
-    err("\n\n could not open file: %s !!\n\n",yyFileName.data());
-    return ;
+ //printf("parseCommentBlock position=%d [%s]\n",position,doc.data()+position);
+    if (needsEntry) newVhdlEntry();
   }
-
-  if (g_lexInit)
+  if (needsEntry)
   {
-    vhdlscanYYrestart(vhdlscanYYin);     
-    unput(' ');
-    BEGIN(Start);
+    newVhdlEntry();
   }
-  vhdlscanYYlex();
-  g_lexInit=TRUE;
-
-  free(g_buf);
-  g_buf=0;
-
-  delete current;
-  current=0;
-
-  groupLeaveFile(yyFileName,yyLineNr);
-  inputFile.close();
-
-  //mergeBrief(current_root);
-  //mergeGrouping(current_root,0);
-  mapLibPackage(current_root);
+  iDocLine=-1;
+  strComment.resize(0);
 }
 
-
-void VHDLLanguageScanner::parsePrototype(const char *text)
+// returns the vhdl type parsed at line xxx
+static Entry* getEntryAtLine(const Entry* ce,int line)
 {
-  // will be called when a \fn command is found in a comment block
-
-  QCString ss,ret;
-  bool sem=FALSE;
-  bool func=FALSE;
-  QList<Argument> qs;
-  qs.setAutoDelete(TRUE);
-  VhdlDocGen::parseFuncProto(text,qs,ss,ret,TRUE);
-  int count=qs.count();
-  if (stricmp(ret.data(),"function")==0)
-  {
-    func=TRUE;
-  }
-  if (count<1 && !func)
-  {
-    return;
-  }
-  Entry *pp = new Entry;
-  initEntry(pp);
-  pp->name=ss.stripWhiteSpace();
-  pp->args+='(';
-  for (int j=0;j<count;j++)
+  EntryListIterator eli(*ce->children());
+  Entry *found=0;
+  Entry *rt;
+  for (;(rt=eli.current());++eli)
   {
-    if (sem)
+    if (rt->bodyLine==line)
+    {
+      found=rt;
+    } // if
+    if (!found) 
     {
-      pp->args+=','; 
+      found=getEntryAtLine(rt,line);
     }
-
-    Argument *ars=(Argument*)(qs.at(j));
-    Argument *arg=new Argument;
-    arg->attrib = ars->attrib;
-    arg->name = ars->name;
-    arg->type = ars->type;
-    pp->args+=ars->name.data();
-    pp->args+=" ";
-    pp->args+=ars->type.data();
-    pp->argList->append(arg);
-    sem=TRUE;
   }
-  pp->args+=')';
-
-  if (!ret.isEmpty()) 
-    pp->spec=VhdlDocGen::FUNCTION;
-  else
-    pp->spec=VhdlDocGen::PROCEDURE;
-
-  if (pp->section == Entry::MEMBERDOC_SEC && pp->args.isEmpty())
-    pp->section = Entry::VARIABLEDOC_SEC;
-
-  pp->type=ret;
-  current_root->addSubEntry(pp);
-}
+  return found;
+}// getEntryAtLine
 
-void VHDLLanguageScanner::parseCode(CodeOutputInterface &codeOutIntf,
-    const char *scopeName,
-    const QCString &input,
-    bool isExampleBlock,
-    const char *exampleName,
-    FileDef *fileDef,
-    int startLine,
-    int endLine,
-    bool inlineFragment,
-    MemberDef *memberDef,
-    bool showLineNumbers
-    )
+// token index in vhdlparser.hpp 258..416
+int getParsedLine(int object)
 {
-  ::parseVhdlCode(codeOutIntf,scopeName,input,isExampleBlock,exampleName,
-                  fileDef,startLine,endLine,inlineFragment,memberDef,
-                  showLineNumbers);
+  //assert(object>254 && object <416);
+  return lineIndex [object];
 }
 
+
diff --git a/winbuild/Doxygen.vcproj b/winbuild/Doxygen.vcproj
index 38886b5..0f4be66 100644
--- a/winbuild/Doxygen.vcproj
+++ b/winbuild/Doxygen.vcproj
@@ -1954,6 +1954,28 @@
 				>
 			</File>
 			<File
+                                RelativePath="..\src\vhdlparser.cpp"
+                                >
+                        </File>
+                        <File
+                                RelativePath="..\src\vhdlparser.hpp"
+                                >
+                        </File>
+                        <File
+                                RelativePath="..\src\vhdlparser.y"
+                                >
+                                <FileConfiguration
+                                       Name="Debug|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCustomBuildTool"
+                                               Description="Running bison on vhdlparser.y"
+                                               CommandLine="runbison.bat $(InputDir)&#x0D;&#x0A;"
+                                               Outputs="$(InputDir)\..\src\vhdlparser.cpp"
+                                       />
+                               </FileConfiguration>
+                        </File>
+                        <File
 				RelativePath="..\src\vhdlscanner.l"
 				>
 				<FileConfiguration
diff --git a/winbuild/runbison.bat b/winbuild/runbison.bat
index 7d6ad2c..65f923d 100644
--- a/winbuild/runbison.bat
+++ b/winbuild/runbison.bat
@@ -1,3 +1,7 @@
 bison -l -d -p cppExpYY %1\..\src\constexp.y -o %1\..\src\ce_parse.c
 del %1\..\src\ce_parse.c
 bison -l -p cppExpYY %1\..\src\constexp.y -o %1\..\src\ce_parse.cpp
+
+bison -l -d -p vhdlScanYY %1\..\src\vhdlparser.y -o %1\..\src\vhdlparser.c
+del %1\..\src\vhdlparser.c
+bison -l -p vhdlScanYY %1\..\src\vhdlparser.y -o %1\..\src\vhdlparser.cpp
-- 
cgit v0.12

