
C:\xfree\dox173\doxy>diff -i -u -b -B addon/vhdlscanner.l src/vhdlscanner.l  
--- addon/vhdlscanner.l	2010-10-17 21:49:12.000000000 +0200
+++ src/vhdlscanner.l	2011-02-25 15:46:50.000000000 +0100
@@ -84,17 +84,60 @@
 static bool             docBlockAutoBrief;
 static char             docBlockTerm;
 static int              iDocLine      = -1;
+static Entry   gBlock;
+static int num_chars;
+static QCString sBuf;
 
 //#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 void handleCommentBlock(const QCString &doc,bool brief);
 static void newEntry();
 static void initEntry(Entry *e);
 
+static int iCodeLen;
+
+static void makeInline()
+{
+    int diff=num_chars-iCodeLen;
+    QCString par=sBuf.mid(iCodeLen,diff);
+    int index=par.findRev("\\endcode");
+    int		vv=par.find("\n",index); 
+    int lo=par.length();
+    int tt=lo-vv;
+    par=sBuf.mid(iCodeLen-tt,diff);
+     index=par.findRev("--!");
+    if(index<=0) return;
+    par=par.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);
+   }
+
+ gBlock.reset();
+
+// &input,
+}// makeInline
+
 static void addSubEntry(Entry* root, Entry* e)
 {
   if (e==0 || root==0) return;
@@ -502,17 +547,14 @@
   isFunc=0;
   isBody=0;
   scantype=0;
-  //pEntry=0;
-  //pp=0; 
   lastCompound=0;
   lastEntity=0;
   bropen=0;
   openGroups=0;
   iDocLine=-1;
-  //isPrevDoc=FALSE;
-  //prevDocEntry.reset();
   qrl.clear();
 
+
   if (!g_lexInit) 
   {
     VhdlDocGen::init();
@@ -557,36 +599,15 @@
     while ( c < max_size && inputString[inputPosition] )
     {
       *buf = inputString[inputPosition++] ;
-      c++; buf++;
+       c++; 
+       buf++;
+   
     }
   }
   return c;
 }
 
-#if 0
-/*
- * adds a  text line description [--#] to the the previous type  
- */
 
-static void addOneTextLine(QCString& ss )
-{
-  Entry* pTemp=0;
-  if (current && current->bodyLine==yyLineNr)
-    pTemp=current;
-  //else if (pEntry && pEntry->bodyLine==yyLineNr)
-  //  pTemp=pEntry;
-  else 
-    pTemp=getEntryAtLine(current_root,yyLineNr) ;
-
-  if (pTemp)
-  {
-    ss=ss.stripWhiteSpace();
-    ss.stripPrefix("--!");
-    pTemp->brief=ss;
-    pTemp->briefLine=yyLineNr;
-  }        
-}
-#endif
 
 %}
 
@@ -1042,7 +1061,7 @@
 
 <ParseRecord>{BR}* {
   lineCount();
-}
+ }
 
 <ParseRecord>("end"){BR}*("record"){BR}*{LETTER}*{BR}*[;]|("end"){BR}*("units"){BR}*[;]  {
   lineCount();
@@ -1098,36 +1117,6 @@
     functionEntry=0;
     //eFuncBody=new Entry;
     ::parseFunctionProto();
-#if 0
-
-    EntryListIterator eli(*eFuncBody->children());
-    Entry *rrt=eli.current();
-
-    if (current && (current->spec==VhdlDocGen::ARCHITECTURE && rrt))
-    {
-      Entry *ep=new Entry(*rrt);
-      addSubEntry(current,ep);
-      isBody=1;
-    }
-    if (rrt) 
-    {
-      Entry *ef=VhdlDocGen::findFunction(current_root,rrt);
-      if (ef) 
-      { 
-	ef->bodyLine=iFuncLine;
-	functionEntry=ef;
-      }
-      else if ((current->spec==VhdlDocGen::PACKAGE_BODY))//VhdlDocGen::Package_Body))
-      {
-	Entry *ep=new Entry(*rrt);
-	addSubEntry(current,ep);
-	ep->bodyLine=iFuncLine;
-	functionEntry = ep;
-      }
-    }
-    delete eFuncBody;
-    eFuncBody=0;
-#endif
   }
   bufferClear();  
   BEGIN(ParseType);
@@ -1316,11 +1305,6 @@
   }
 }
 
-<ParseType>{TEXTT} {
-  lineCount();
-  BEGIN(ParseType);
-}
-
 <ParseType>{BR}* {
   lineCount();
   addText(yytext,yyleng);
@@ -1348,6 +1332,7 @@
     //qq=qq.lower();
 
     current->name=qq;
+    qq=qq.lower();
     if (lastCompound)
     {
       if (lastCompound->spec==VhdlDocGen::PACKAGE)
@@ -1600,6 +1586,29 @@
   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);
+  // qcs=qcs.stripWhiteSpace();
+   gBlock.startLine=yyLineNr+1;
+   gBlock.bodyLine=yyLineNr+1;
+   gBlock.brief+=qcs;
+    iTextCounter=0;
+   }
+ 
+
+if(ii==-1)
   handleCommentBlock(qcs,FALSE);
   bufferClear();
   unput(*yytext);
@@ -1611,8 +1620,14 @@
   QCString qcs(yytext);
   int j=qcs.find("--!");
   qcs=qcs.right(qcs.length()-3-j);
+   bool isEndCode=qcs.contains("\\endcode");
+  
+   if(isEndCode)
+    makeInline();
   //printf("--> handleCommentBlock line %d\n",yyLineNr);
   Entry* pTemp=getEntryAtLine(current_root,yyLineNr);
+ 
+ if(!isEndCode){
   if (pTemp)
   {
     pTemp->briefLine=yyLineNr;
@@ -1623,10 +1638,12 @@
   {
     handleCommentBlock(qcs,TRUE);
   }
-  //printf("--> end: handleCommentBlock line %d\n",yyLineNr);
-  bufferClear();
 } 
 
+bufferClear();
+}// one line
+
+
 <*>{COMMENT} {
 }
 
@@ -1914,6 +1931,7 @@
   g_inputFromFile = FALSE;
   inputPosition = 0;
   assert(root!=0);
+   sBuf+=fileBuf;
   inputString=fileBuf;
   current_root  = root;
   global_root   = root;

C:\xfree\dox173\doxy>diff -i -u -b -B addon/vhdldocgen.h src/vhdldocgen.h  
--- addon/vhdldocgen.h	2010-02-19 21:09:48.000000000 +0100
+++ src/vhdldocgen.h	2011-02-24 15:37:32.000000000 +0100
@@ -75,7 +75,8 @@
       VFILE,   
       SHAREDVARIABLE,
       CONFIG,
-      ALIAS
+      ALIAS,
+      MISCELLANEOUS
     };
 
     VhdlDocGen();
@@ -137,7 +138,8 @@
                                      OutputList &ol);
 
     //static void writeVhdlComponentList(OutputList &ol,int type);
-
+     static bool isMisc(const MemberDef *mdef) 
+    { return mdef->getMemberSpecifiers()==VhdlDocGen::MISCELLANEOUS; }   
     static bool isConfig(const MemberDef *mdef) 
     { return mdef->getMemberSpecifiers()==VhdlDocGen::CONFIG; }
     static bool isAlias(const MemberDef *mdef) 
@@ -265,12 +267,15 @@
     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 &);
   private:
     static void getFuncParams(QList<Argument>&, const char* str);
     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);
+
 };
 
 #endif

C:\xfree\dox173\doxy>diff -i -u -b -B addon/vhdldocgen.cpp src/vhdldocgen.cpp  
--- addon/vhdldocgen.cpp	2010-09-11 17:10:38.000000000 +0200
+++ src/vhdldocgen.cpp	2011-02-25 15:48:24.000000000 +0100
@@ -42,7 +42,7 @@
 #include "definition.h"
 #include "searchindex.h"
 #include "outputlist.h"
-
+#include "parserintf.h"
 /* --------------------------------------------------------------- */
 
 //#define theTranslator_vhdlType theTranslator->trVhdlType
@@ -1211,6 +1211,7 @@
     case VhdlDocGen::COMPONENT_INST: return "Component Instantiation"; 
     case VhdlDocGen::ALIAS:          return "Alias";
     case VhdlDocGen::CONFIG:         return "Configuration";                                     
+    case VhdlDocGen::MISCELLANEOUS: return "Miscellanous";                                 
     default:                         return "";
   }
 } // convertType
@@ -1300,7 +1301,9 @@
       bool k=VhdlDocGen::isNumber(find); // is this a number
       if (k)
       {
+	   ol.docify(" ");
 	VhdlDocGen::startFonts(find,"vhdldigit",ol);
+         ol.docify(" ");
       }
       else if (j != 0 && ss)
       {
@@ -1334,7 +1337,6 @@
 
 bool VhdlDocGen::isNumber(const QCString& s)
 {
- // static bool veriOpt=Config_getBool("OPTIMIZE_OUTPUT_VERILOG");
   static QRegExp regg("[0-9][0-9eEfFbBcCdDaA_.#-]*");
  
   if (s.isEmpty()) return false;
@@ -1591,36 +1593,36 @@
     return;
   }
   ol.startParameterList(FALSE); 
+  //ol.startParameterName(false);
   Argument *arg;
   bool first=TRUE;
   for (;(arg=ali.current());++ali)
   { 
     ol.startParameterType(first,"");  
     if (first) ol.writeChar('(');
-    if (!VhdlDocGen::isProcess(md))
-    {
-      if (TRUE) //VhdlDocGen::isProcedure(md))
+      if (VhdlDocGen::isProcedure(md))
       {
 	startFonts(arg->defval,"keywordtype",ol);
 	ol.docify(" ");
       } 
-      // linkifyText(TextGeneratorOLImpl(ol),md->getClassDef(),md->getBodyDef(),md->name(),arg->type);
+      ol.endParameterType();
+     
+     ol.startParameterName(true);
       VhdlDocGen::writeFormatString(arg->name,ol,md);
       ol.docify(" ");
 
       if (VhdlDocGen::isProcedure(md))
 	startFonts(arg->attrib,"stringliteral",ol);
-      else
+	  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);
-    else
-      startFonts(arg->name,"vhdlkeyword",ol);
     ol.disable(OutputGenerator::Man);
     ol.endEmphasis();
     ol.enable(OutputGenerator::Man);
@@ -1629,12 +1631,12 @@
       ol.docify(" , ");    
     else
       ol.docify(" ) ");
-
-    ol.endParameterName(FALSE,FALSE,FALSE); 
+  ol.endParameterName(TRUE,FALSE,FALSE);
 
     sem=TRUE;        
     first=FALSE;
   }
+  ol.endParameterList(); 
 
 } // writeDocFunProc
 
@@ -1738,6 +1741,7 @@
   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);
   
   // 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);
@@ -1762,6 +1766,10 @@
     {
       mdd->setMemberSpecifiers(VhdlDocGen::USE);        
     } 
+    else if (stricmp(mdd->typeString(),"misc")==0)
+    {
+		mdd->setMemberSpecifiers(VhdlDocGen::MISCELLANEOUS);        
+    } 
   }
 }
 
@@ -1778,6 +1786,8 @@
     MemberDef* memdef=VhdlDocGen::findMember(na,nn);
     if (memdef && memdef->isLinkable()) 
     { 
+        ol.docify(" ");
+      
       ol.startBold();
       //ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),0,mdef->typeString());                
        writeLink(memdef,ol);
@@ -1786,13 +1796,20 @@
     }
     else
     {
+     ol.docify(" ");
       QCString ttype=mdef->typeString();
       VhdlDocGen::formatString(ttype,ol,mdef);
+     ol.docify(" "); 
     }
     ol.docify(mdef->name());
     VhdlDocGen::writeFuncProcDocu(mdef,ol, mdef->argumentList().pointer());
   }
 
+  if(VhdlDocGen::isMisc(mdef))
+ {
+  writeLink(mdef,ol);
+ 	 return;
+ }
   if (mdef->isVariable())
   { 
     //ol.docify(mdef->name().data());
@@ -1941,12 +1958,18 @@
   if (gd) gd=0;
   switch(mm)
   {
+     case VhdlDocGen::MISCELLANEOUS:
+		 //  writeLink(mdef,ol);
+		   VhdlDocGen::writeCodeFragment(mdef,ol);
+		break;
     case VhdlDocGen::PROCEDURE:
     case VhdlDocGen::FUNCTION: 
       ol.startBold();
       VhdlDocGen::formatString(ltype,ol,mdef);
       ol.endBold();
       ol.insertMemberAlign();
+      ol.docify(" ");
+	
       writeLink(mdef,ol);
       if (alp!=0 && mm==VhdlDocGen::FUNCTION)
 	VhdlDocGen::writeFunctionProto(ol,alp.pointer(),mdef);
@@ -1986,11 +2009,11 @@
     case VhdlDocGen::GENERIC:
     case VhdlDocGen::PORT:
       writeLink(mdef,ol);
+     ol.docify(" ");
       ol.insertMemberAlign();
       if (mm==VhdlDocGen::GENERIC)
       {
 	ol.startBold();
-	ol.docify(" ");
 	VhdlDocGen::formatString(ltype,ol,mdef);
 	ol.endBold();
       }
@@ -2016,6 +2039,8 @@
     case VhdlDocGen::CONFIG:
       writeLink(mdef,ol);
       ol.insertMemberAlign();
+      ol.docify("  ");
+       
       ol.startBold();
       ol.docify(ltype);
       ol.endBold();
@@ -2070,6 +2095,7 @@
       break;
     case VhdlDocGen::RECORD:    
       writeLink(mdef,ol);
+	  ol.docify(" ");
       ol.startBold();
       if (ltype.isEmpty()) ol.docify("     : record");    
       ol.insertMemberAlign();
@@ -2080,6 +2106,7 @@
     case VhdlDocGen::UNITS:
       ol.startBold();
       writeLink(mdef,ol);
+	  ol.docify(" ");
       if (ltype.isEmpty()) ol.docify("     : unit");    
       ol.insertMemberAlign();
       if (!ltype.isEmpty())
@@ -2220,7 +2247,7 @@
 
   if (title) 
   {
-    ol.startMemberHeader(ml->listTypeAsString());
+    ol.startMemberHeader(title);
     ol.parseText(title);
     ol.endMemberHeader();
     ol.docify(" ");
@@ -2379,7 +2406,8 @@
     case VhdlDocGen::CONFIG:        
       if (sing) return "Configuration";       
       return "Configurations";
-      
+     case VhdlDocGen::MISCELLANEOUS:
+	  return "Miscellaneous";  
     default:                       
       return "Class";
   }
@@ -2478,3 +2506,71 @@
   VhdlDocGen::startFonts(mem,"vhdlchar",ol);    
 }// found component
 
+void VhdlDocGen::writeCodeFragment( MemberDef *mdef,OutputList& ol)
+{
+  //  Definition d=(Definition)mdef;
+//	QCString fdd=mdef->getDefFileExtension();
+//	QCString scope=mdef->getScopeString();
+	QCString codeFragment=mdef->documentation();
+	//FileDef *fd=mdef->getFileDef();
+	
+	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();	
+  	 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 = "...";
+            VhdlDocGen::writeFormatString(q,ol,mdef);
+	        break;
+		  }
+	 }
+
+}
+
+ void VhdlDocGen::writeSource(MemberDef *mdef,OutputList& ol,QCString & cname)
+ {
+//  Definition d=(Definition)mdef;
+	QCString fdd=mdef->getDefFileExtension();
+	QCString scope=mdef->getScopeString();
+	QCString codeFragment=mdef->documentation();
+	FileDef *fd=mdef->getFileDef();
+	int start=mdef->getStartBodyLine();
+	int end=mdef->getEndBodyLine();
+	QStringList qsl=QStringList::split("\n",codeFragment);
+
+	ParserInterface *pIntf = Doxygen::parserManager->getParser(fdd.data());
+    pIntf->resetCodeParserState();
+
+	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
+                      );
+      ol.endCodeFragment();
+     ol.endParagraph();
+
+	 	 mdef->writeSourceDef(ol,cname);
+          mdef->writeSourceRefs(ol,cname);
+          mdef->writeSourceReffedBy(ol,cname);
+
+ 
+ }
\ No newline at end of file

C:\xfree\dox173\doxy>diff -i -u -b -B addon/memberdef.cpp src/memberdef.cpp  
--- addon/memberdef.cpp	2011-01-02 14:17:46.000000000 +0100
+++ src/memberdef.cpp	2011-02-24 16:19:36.000000000 +0100
@@ -2059,7 +2059,14 @@
   if (!detailed.isEmpty() || 
       !inbodyDocumentation().isEmpty())
   { 
+	  // write vhdl inline code with or without option INLINE_SOURCE
+	  if(optVhdl && VhdlDocGen::isMisc(this)) {
+		VhdlDocGen::writeSource(this,ol,cname);
+		return;
+	  }
+	else
     ol.parseDoc(docFile(),docLine(),getOuterScope()?getOuterScope():container,this,detailed+"\n",TRUE,FALSE);
+   
     if (!inbodyDocumentation().isEmpty())
     {
       ol.startParagraph();
