00001 /****************************************************************************** 00002 * 00003 * Copyright (C) 1997-2008 by Dimitri van Heesch. 00004 * 00005 * Permission to use, copy, modify, and distribute this software and its 00006 * documentation under the terms of the GNU General Public License is hereby 00007 * granted. No representations are made about the suitability of this software 00008 * for any purpose. It is provided "as is" without express or implied warranty. 00009 * See the GNU General Public License for more details. 00010 * 00011 * Documents produced by Doxygen are derivative works derived from the 00012 * input used in their production; they are not affected by this license. 00013 * 00014 */ 00015 /****************************************************************************** 00016 * Parser for VHDL subset 00017 * written by M. Kreis 00018 * supports VHDL-87 00019 * does not support all keywords of VHDL '93 (impure function/shared variables ..) 00020 * and VHDL-AMS 00021 ******************************************************************************/ 00022 00023 // global includes 00024 #include <stdio.h> 00025 #include <stdlib.h> 00026 #include <assert.h> 00027 #include <string.h> 00028 #include <qcstring.h> 00029 #include <qfileinfo.h> 00030 #include <qstringlist.h> 00031 00032 /* --------------------------------------------------------------- */ 00033 00034 // local includes 00035 #include "vhdldocgen.h" 00036 #include "message.h" 00037 #include "config.h" 00038 #include "doxygen.h" 00039 #include "util.h" 00040 #include "language.h" 00041 #include "commentscan.h" 00042 #include "index.h" 00043 #include "definition.h" 00044 #include "searchindex.h" 00045 #include "outputlist.h" 00046 00047 /* --------------------------------------------------------------- */ 00048 00049 //#define theTranslator_vhdlType theTranslator->trVhdlType 00050 #define theTranslator_vhdlType VhdlDocGen::trVhdlType 00051 00052 static QDict<QCString> g_vhdlKeyDict0(17,FALSE); 00053 static QDict<QCString> g_vhdlKeyDict1(17,FALSE); 00054 static QDict<QCString> g_vhdlKeyDict2(17,FALSE); 00055 00056 static QCString g_vhdlkeyword("vhdlkeyword"); 00057 static QCString g_vhdltype("comment"); 00058 static QCString g_vhdllogic("vhdllogic"); 00059 00060 // keywords 00061 static const char* g_vhdlKeyWordMap0[] = 00062 { 00063 "std","ieee","work","standard","textio","std_logic_1164", 00064 "std_logic_arith","std_logic_misc","std_logic_signed","std_logic_textio", 00065 "std_logic_unsigned","numeric_bit","numeric_std","math_complex","math_real", 00066 "vital_primitives","vital_timing","severity_level","time","delay_length", 00067 "natural", "positive", "bit_vector","file_open_kind","file_open_status", 00068 "line","text","side", "width","event","rising_edge", "falling_edge", 00069 "access","after","alias", "all","architecture","array", "assert","attribute", 00070 "begin","block","body", "buffer", "bus", "case", "component", "configuration", 00071 "constant", "disconnect", "downto", "else", "elsif", "end", "entity", "exit", 00072 "file", "for", "function", "generate", "generic", "group", "guarded", "if", 00073 "impure", "in", "inertial", "inout", "is","label", "library", "linkage", 00074 "literal", "loop","map", "new", "next", "null", "of", "on", "open", "others", 00075 "out", "package", "port", "postponed", "procedure", "process", "pure", 00076 "range", "record", "register", "reject", "report", "return","select", 00077 "severity", "shared", "signal", "subtype", "then", "to", "transport", 00078 "type","unaffected", "units", "until", "use","variable", "wait", "when", 00079 "while", "with",0 00080 }; 00081 00082 // type 00083 static const char* g_vhdlKeyWordMap1[] = 00084 { 00085 "natural","unsigned","signed","string","boolean", "bit","character", 00086 "std_ulogic","std_ulogic_vector","sTd_logic","std_logic_vector","integer", 00087 "real","zzz",0 00088 }; 00089 00090 // logic 00091 static const char* g_vhdlKeyWordMap2[] = 00092 { 00093 "abs","and","or","not","mod", "xor","rem","xnor","ror","rol","sla", 00094 "sll",0 00095 }; 00096 00097 VhdlDocGen::VhdlDocGen() 00098 { 00099 } 00100 00101 VhdlDocGen::~VhdlDocGen() 00102 { 00103 } 00104 00105 void VhdlDocGen::init() 00106 { 00107 int j=0; 00108 g_vhdlKeyDict0.setAutoDelete(TRUE); 00109 g_vhdlKeyDict1.setAutoDelete(TRUE); 00110 g_vhdlKeyDict2.setAutoDelete(TRUE); 00111 00112 j=0; 00113 while (g_vhdlKeyWordMap0[j]) 00114 { 00115 g_vhdlKeyDict0.insert(g_vhdlKeyWordMap0[j], 00116 new QCString(g_vhdlKeyWordMap0[j])); 00117 j++; 00118 } 00119 00120 j=0; 00121 while (g_vhdlKeyWordMap1[j]) 00122 { 00123 g_vhdlKeyDict1.insert(g_vhdlKeyWordMap1[j], 00124 new QCString(g_vhdlKeyWordMap1[j])); 00125 j++; 00126 } 00127 00128 j=0; 00129 while (g_vhdlKeyWordMap2[j]) 00130 { 00131 g_vhdlKeyDict2.insert(g_vhdlKeyWordMap2[j], 00132 new QCString(g_vhdlKeyWordMap2[j])); 00133 j++; 00134 } 00135 00136 }// buildKeyMap 00137 00142 QCString* VhdlDocGen::findKeyWord(const QCString& word) 00143 { 00144 if (word.isEmpty() || word.at(0)=='\0') return 0; 00145 //printf("VhdlDocGen::findKeyWord(%s)\n",word.data()); 00146 00147 if (g_vhdlKeyDict0.find(word.lower())) 00148 return &g_vhdlkeyword; 00149 00150 if (g_vhdlKeyDict1.find(word.lower())) 00151 return &g_vhdltype; 00152 00153 if (g_vhdlKeyDict2.find(word.lower())) 00154 return &g_vhdllogic; 00155 00156 return 0; 00157 } 00158 00163 Entry* VhdlDocGen::getEntryAtLine(const Entry* ce,int line) 00164 { 00165 EntryListIterator eli(*ce->children()); 00166 Entry *found=0; 00167 Entry *rt; 00168 for (;(rt=eli.current());++eli) 00169 { 00170 if (rt->bodyLine==line) 00171 { 00172 found=rt; 00173 } // if 00174 if (!found) 00175 { 00176 found=getEntryAtLine(rt,line); 00177 } 00178 } 00179 return found; 00180 }// getEntryAtLine 00181 00182 void VhdlDocGen::debugClassName(ClassSDict* mDict) 00183 { 00184 // for each class 00185 ClassSDict::Iterator cli(*mDict); 00186 ClassDef *cd; 00187 for ( ; (cd=cli.current()) ; ++cli ) 00188 { 00189 printf("\n -------------------------class----------------------------------------\n"); 00190 00191 QCString nnn=cd->className(); 00192 QCString qref=cd->getReference(); 00193 QCString outBase=cd->getOutputFileBase(); 00194 QCString fileBase=cd->getFileBase(); 00195 QCString compType=cd->compoundTypeString(); 00196 QCString inDoc=cd->documentation();//->inbodyDocumentation(); 00197 printf("\n refernz [%p]",cd); 00198 printf("\n compType [%s]",compType.data()); 00199 printf("\n Name [%s]",nnn.data()); 00200 printf("\n TYPE[%d ",cd->definitionType()); 00201 printf("\n Ref [%s] ",qref.data()); 00202 printf("\n OutBase [%s] fileBase [%s]",outBase.data(),fileBase.data()); 00203 00204 printf("\n -------------------------------------------------------------------\n"); 00205 00206 }// for 00207 }// Debug Class Name 00208 00209 00210 bool found =FALSE; 00211 static Entry eMerge; 00212 00213 ClassDef *VhdlDocGen::getClass(const char *name) 00214 { 00215 if (name==0 || name[0]=='\0') return 0; 00216 00217 ClassDef *cd=0; 00218 QCString temp(name); 00219 //temp=temp.lower(); 00220 temp=temp.stripWhiteSpace(); 00221 cd= Doxygen::classSDict->find(temp.data()); 00222 return cd; 00223 } 00224 00228 void VhdlDocGen::computeVhdlComponentRelations(const QDict<EntryNav>& classEntries,FileStorage* g_storage) 00229 { 00230 ClassSDict::Iterator cli(*Doxygen::classSDict); 00231 for (cli.toFirst();cli.current();++cli) cli.current()->visited=FALSE; 00232 QDictIterator<EntryNav> edi(classEntries); 00233 EntryNav *rootNav; 00234 for (;(rootNav=edi.current());++edi) 00235 { 00236 ClassDef *cd; 00237 rootNav->loadEntry(g_storage); 00238 Entry *root = rootNav->entry(); 00239 QCString bName=stripAnonymousNamespaceScope(rootNav->name()); 00240 if ((cd=getClass(bName))) 00241 { 00242 QListIterator<BaseInfo> bii(*root->extends); 00243 BaseInfo *bi=0; 00244 for (bii.toFirst();(bi=bii.current());++bii) 00245 { 00246 ClassDef* baseDef=getClass(bi->name); 00247 00248 if (baseDef && baseDef != cd) 00249 { 00250 QCString cc=VhdlDocGen::getClassName(cd); 00251 ClassDef *ccdef=getClass(cc); 00252 if (ccdef==0) break; 00253 00254 int ii=ccdef->protection(); 00255 int jj=baseDef->protection(); 00256 00257 if (ii==VhdlDocGen::ENTITYCLASS && jj==VhdlDocGen::ENTITYCLASS && (ccdef !=baseDef)) 00258 { 00259 ccdef->insertBaseClass(baseDef,bi->name,Public,Normal,0); 00260 baseDef->insertSubClass(ccdef,Public,bi->virt,0); 00261 } 00262 } 00263 else 00264 { 00265 if (Config_getBool("WARNINGS")) 00266 warn(rootNav->fileDef()->fileName().data(),root->startLine, "found component without entity: [%s]",bi->name.data()); 00267 } 00268 }//for 00269 }//if 00270 rootNav->releaseEntry(); 00271 }// for 00272 } // computeVhdlComponentRelations 00273 00274 00275 /* 00276 * returns a reference, if one class [package(body),entity or an architecture is found] 00277 */ 00278 00279 ClassDef* VhdlDocGen::findComponent(int type) 00280 { 00281 ClassSDict::Iterator cli(*Doxygen::classSDict); 00282 ClassDef *cd=0; 00283 00284 for ( ; (cd=cli.current()) ; ++cli ) 00285 { 00286 if (cd->protection()==type) 00287 return cd; 00288 } 00289 return cd; 00290 } 00291 00292 ClassDef* VhdlDocGen::getPackageName(const QCString & name) 00293 { 00294 ClassDef* cd=0; 00295 QStringList ql=QStringList::split(".",name,FALSE); 00296 cd=getClass(name); 00297 00298 return cd; 00299 } 00300 00301 MemberDef* VhdlDocGen::findMember(const QCString& className, const QCString& memName) 00302 { 00303 QDict<QCString> packages(17,FALSE); 00304 packages.setAutoDelete(TRUE); 00305 ClassDef* cd; 00306 MemberDef *mdef=0; 00307 00308 cd=getClass(className); 00309 //printf("VhdlDocGen::findMember(%s,%s)=%p\n",className.data(),memName.data(),cd); 00310 if (cd==0) return 0; 00311 00312 mdef=VhdlDocGen::findMemberDef(cd,memName,MemberList::variableMembers); 00313 if (mdef) return mdef; 00314 mdef=VhdlDocGen::findMemberDef(cd,memName,MemberList::pubMethods); 00315 if (mdef) return mdef; 00316 00317 // nothing found so far 00318 // if we are an architecture or package body search in entitiy 00319 00320 if ((VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::ARCHITECTURECLASS || 00321 (VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::PACKBODYCLASS) 00322 { 00323 Definition *d = cd->getOuterScope(); 00324 if (d && d->definitionType()==Definition::TypeClass) 00325 { 00326 ClassDef *ecd = (ClassDef*)d; 00327 mdef=VhdlDocGen::findMemberDef(ecd,memName,MemberList::variableMembers); 00328 if (mdef) return mdef; 00329 } 00330 //cd=getClass(getClassName(cd)); 00331 //if (!cd) return 0; 00332 } 00333 // nothing found , so we are now searching all included packages 00334 VhdlDocGen::findAllPackages(className,packages); 00335 //cd=getClass(className.data()); 00336 if ((VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::ARCHITECTURECLASS || 00337 (VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::PACKBODYCLASS) 00338 { 00339 //QCString tempClass=getClassName(cd); 00340 Definition *d = cd->getOuterScope(); 00341 if (d && d->definitionType()==Definition::TypeClass) 00342 { 00343 ClassDef *ecd = (ClassDef*)d; 00344 VhdlDocGen::findAllPackages(ecd->className(),packages); 00345 } 00346 } 00347 00348 QDictIterator<QCString> packli(packages); 00349 QCString *curString; 00350 for (packli.toFirst();(curString=packli.current());++packli) 00351 { 00352 if (curString) 00353 { 00354 cd=VhdlDocGen::getPackageName(*curString); 00355 } 00356 if (cd) 00357 { 00358 mdef=VhdlDocGen::findMemberDef(cd,memName,MemberList::variableMembers); 00359 if (mdef) return mdef; 00360 mdef=VhdlDocGen::findMemberDef(cd,memName,MemberList::pubMethods); 00361 if (mdef) return mdef; 00362 } 00363 } // for 00364 return 0; 00365 }//findMember 00366 00372 MemberDef* VhdlDocGen::findMemberDef(ClassDef* cd,const QCString& key,MemberList::ListType type) 00373 { 00374 // return cd->getMemberByName(key);//does not work 00375 MemberDef *md=0; 00376 00377 MemberList *ml= cd->getMemberList(type); 00378 if (ml==0) return 0; 00379 00380 MemberListIterator fmni(*ml); 00381 00382 for (fmni.toFirst();(md=fmni.current());++fmni) 00383 { 00384 if (stricmp(key.data(),md->name().data())==0) 00385 return md; 00386 } 00387 return 0; 00388 }//findMemberDef 00389 00394 void VhdlDocGen::findAllPackages(const QCString& className,QDict<QCString>& qdict) 00395 { 00396 ClassDef *cdef=getClass(className); 00397 if (cdef) 00398 { 00399 MemberList *mem=cdef->getMemberList(MemberList::variableMembers); 00400 MemberDef *md; 00401 00402 if (mem) 00403 { 00404 MemberListIterator fmni(*mem); 00405 for (fmni.toFirst();(md=fmni.current());++fmni) 00406 { 00407 if (VhdlDocGen::isPackage(md)) 00408 { 00409 QCString *temp1=new QCString(md->name().data()); 00410 //*temp1=temp1->lower(); 00411 QCString p(md->name().data()); 00412 //p=p.lower(); 00413 ClassDef* cd=VhdlDocGen::getPackageName(*temp1); 00414 if (cd) 00415 { 00416 QCString *ss=qdict.find(*temp1); 00417 if (ss==0) 00418 { 00419 qdict.insert(p,temp1); 00420 QCString tmp=cd->className(); 00421 VhdlDocGen::findAllPackages(tmp,qdict); 00422 } 00423 else delete temp1; 00424 } 00425 else delete temp1; 00426 } 00427 }//for 00428 }//if 00429 }//cdef 00430 }// findAllPackages 00431 00437 MemberDef* VhdlDocGen::findFunction(const QList<Argument> &ql, 00438 const QCString& funcname, 00439 const QCString& package, bool type) 00440 { 00441 MemberDef* mdef=0; 00442 int funcType; 00443 ClassDef *cdef=getClass(package.data()); 00444 if (cdef==0) return 0; 00445 00446 if (type) 00447 funcType=VhdlDocGen::PROCEDURE; 00448 else 00449 funcType=VhdlDocGen::FUNCTION; 00450 00451 MemberList *mem=cdef->getMemberList(MemberList::pubMethods); 00452 00453 if (mem) 00454 { 00455 MemberListIterator fmni(*mem); 00456 for (fmni.toFirst();(mdef=fmni.current());++fmni) 00457 { 00458 QCString mname=mdef->name(); 00459 if ((VhdlDocGen::isProcedure(mdef) || VhdlDocGen::isVhdlFunction(mdef)) && (VhdlDocGen::compareString(funcname,mname)==0)) 00460 { 00461 LockingPtr<ArgumentList> alp = mdef->argumentList(); 00462 00463 // ArgumentList* arg2=mdef->getArgumentList(); 00464 if (alp==0) break; 00465 ArgumentListIterator ali(*alp.pointer()); 00466 ArgumentListIterator ali1(ql); 00467 00468 if (ali.count() != ali1.count()) break; 00469 00470 Argument *arg,*arg1; 00471 int equ=0; 00472 00473 for (;(arg=ali.current());++ali) 00474 { 00475 arg1=ali1.current(); ++ali1; 00476 equ+=abs(VhdlDocGen::compareString(arg->type,arg1->type)); 00477 00478 QCString s1=arg->type; 00479 QCString s2=arg1->type; 00480 VhdlDocGen::deleteAllChars(s1,' '); 00481 VhdlDocGen::deleteAllChars(s2,' '); 00482 equ+=abs(VhdlDocGen::compareString(s1,s2)); 00483 s1=arg->attrib; 00484 s2=arg1->attrib; 00485 VhdlDocGen::deleteAllChars(s1,' '); 00486 VhdlDocGen::deleteAllChars(s2,' '); 00487 equ+=abs(VhdlDocGen::compareString(s1,s2)); 00488 // printf("\n 1. type [%s] name [%s] attrib [%s]",arg->type,arg->name,arg->attrib); 00489 // printf("\n 2. type [%s] name [%s] attrib [%s]",arg1->type,arg1->name,arg1->attrib); 00490 } // for 00491 if (equ==0) return mdef; 00492 }//if 00493 }//for 00494 }//if 00495 return mdef; 00496 } //findFunction 00497 00503 Entry* VhdlDocGen::findFunction( Entry* root, Entry* func) 00504 { 00505 //bool found=FALSE; 00506 Entry *found=0; 00507 int functype=func->spec; 00508 EntryListIterator eli(*root->children()); 00509 Entry *rt; 00510 for (;(rt=eli.current());++eli) 00511 { 00512 if (rt->spec==functype && VhdlDocGen::compareString(rt->name,func->name)==0 && rt!=func ) 00513 { 00514 if (VhdlDocGen::compareArgList(func->argList,rt->argList)) 00515 { 00516 found=rt; 00517 return found; 00518 } 00519 }//if1 00520 if (!found) 00521 { 00522 found = VhdlDocGen::findFunction(rt,func); 00523 } 00524 } // for 00525 return found; 00526 }// findFunction 00527 00528 /* 00529 * compares two argument list of a fuction|procedure 00530 */ 00531 00532 bool VhdlDocGen::compareArgList(ArgumentList* l1,ArgumentList* l2) 00533 { 00534 if (l1== 0 || l2== 0) return FALSE; 00535 00536 ArgumentListIterator ali(*l1); 00537 ArgumentListIterator ali1(*l2); 00538 00539 if (ali.count() != ali1.count()) return FALSE; 00540 00541 Argument *arg,*arg1; 00542 int equ=0; 00543 00544 for (;(arg=ali.current());++ali) 00545 { 00546 bool found = FALSE; 00547 for (ali1.toFirst();(arg1=ali1.current());++ali1) 00548 { 00549 equ=0; 00550 QCString s1=arg->type; 00551 QCString s2=arg1->type; 00552 VhdlDocGen::deleteAllChars(s1,' '); // remove whitespaces 00553 VhdlDocGen::deleteAllChars(s2,' '); 00554 equ+=abs(VhdlDocGen::compareString(s1,s2)); 00555 s1=arg->attrib; 00556 s2=arg1->attrib; 00557 VhdlDocGen::deleteAllChars(s1,' '); 00558 VhdlDocGen::deleteAllChars(s2,' '); 00559 equ+=abs(VhdlDocGen::compareString(s1,s2)); 00560 if (equ==0) found=TRUE; 00561 } 00562 if (!found) return FALSE; 00563 } 00564 return TRUE; 00565 }// compareArgList 00566 00567 /* 00568 * finds a matching prototype for a function description 00569 */ 00570 00571 Entry* VhdlDocGen::findFunction(Entry* func) 00572 { 00573 ClassSDict::Iterator cli(*Doxygen::classSDict); 00574 ClassDef *cd; 00575 for (;(cd=cli.current());++cli) 00576 { 00577 MemberList *mf = cd->getMemberList (MemberList::pubMethods); 00578 if (mf) 00579 { 00580 MemberListIterator fmni(*mf); 00581 MemberDef *mdd; 00582 for (fmni.toFirst();(mdd=fmni.current());++fmni) 00583 { 00584 int type=mdd->getMemberSpecifiers(); 00585 if (type==VhdlDocGen::PROCEDURE || type==VhdlDocGen::FUNCTION) 00586 { 00587 QCString nnk=mdd->name(); 00588 QCString ff=func->name; 00589 00590 if (stricmp(mdd->name(),ff.data())==0) 00591 { 00592 LockingPtr< ArgumentList > lp=mdd->argumentList(); 00593 ArgumentList *l=lp.pointer(); 00594 if (VhdlDocGen::compareArgList(l,func->argList)) 00595 { 00596 mdd->setDocumentation(func->doc.data(),func->docFile.data(),func->docLine,TRUE); 00597 mdd->setBriefDescription(func->brief,func->briefFile,func->briefLine); 00598 addMemberToGroups(func,mdd);// do not forget grouping! 00599 return func; 00600 } 00601 } 00602 } 00603 } 00604 }// if 00605 }//for 00606 return 0; 00607 }// findFunction 00608 00609 /* 00610 * adds the documentation for a function|procedure 00611 */ 00612 00613 void VhdlDocGen::addFuncDoc(EntryNav* rootNav) 00614 { 00615 Entry *root = rootNav->entry(); 00616 if (root && root->spec==VhdlDocGen::DOCUMENT) 00617 { 00618 Entry *func=VhdlDocGen::findFunction(root); 00619 if (!func && Config_getBool("WARNINGS")) 00620 { 00621 warn(root->fileName,root->docLine, 00622 "Warning: documentation for unknown function %s found.\n", 00623 root->name.data() 00624 ); 00625 } 00626 } 00627 }// AddFuncDoc 00628 00633 QCString VhdlDocGen::getClassTitle(const ClassDef *cd) 00634 { 00635 QCString pageTitle; 00636 if (cd==0) return ""; 00637 pageTitle+=cd->displayName(); 00638 pageTitle=VhdlDocGen::getClassName(cd); 00639 int ii=cd->protection(); 00640 pageTitle+=" "; 00641 pageTitle+=theTranslator_vhdlType(ii+2,TRUE); 00642 pageTitle+=" "; 00643 return pageTitle; 00644 } // getClassTitle 00645 00646 /* returns the class name without their prefixes */ 00647 00648 QCString VhdlDocGen::getClassName(const ClassDef* cd) 00649 { 00650 QCString temp; 00651 if (cd==0) return ""; 00652 00653 if ((VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::PACKBODYCLASS) 00654 { 00655 temp=cd->name(); 00656 temp.stripPrefix("_"); 00657 return temp; 00658 } 00659 //if ((VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::ARCHITECTURECLASS) 00660 //{ 00661 // QStringList qlist=QStringList::split("-",cd->className(),FALSE); 00662 // if (qlist.count()>1) 00663 // return (QCString)qlist[1]; 00664 // return ""; 00665 //} 00666 return substitute(cd->className(),"::","."); 00667 } 00668 00673 void VhdlDocGen::writeInlineClassLink(const ClassDef* cd ,OutputList& ol) 00674 { 00675 QList<QCString> ql; 00676 ql.setAutoDelete(TRUE); 00677 QCString nn=cd->className(); 00678 int ii=(int)cd->protection()+2; 00679 00680 QCString type; 00681 if (ii==VhdlDocGen::ENTITY) 00682 type+=theTranslator_vhdlType(VhdlDocGen::ARCHITECTURE,TRUE); 00683 else if (ii==VhdlDocGen::ARCHITECTURE) 00684 type+=theTranslator_vhdlType(VhdlDocGen::ENTITY,TRUE); 00685 else if (ii==VhdlDocGen::PACKAGE_BODY) 00686 type+=theTranslator_vhdlType(VhdlDocGen::PACKAGE,TRUE); 00687 else if (ii==VhdlDocGen::PACKAGE) 00688 type+=theTranslator_vhdlType(VhdlDocGen::PACKAGE_BODY,TRUE); 00689 else 00690 type+=""; 00691 00692 //type=type.lower(); 00693 type+=" >> "; 00694 ol.disable(OutputGenerator::RTF); 00695 ol.disable(OutputGenerator::Man); 00696 ol.lineBreak(); 00697 ol.lineBreak(); 00698 00699 if (ii==VhdlDocGen::PACKAGE_BODY) 00700 { 00701 nn.stripPrefix("_"); 00702 cd=getClass(nn.data()); 00703 } 00704 else if (ii==VhdlDocGen::PACKAGE) 00705 { 00706 nn.prepend("_"); 00707 cd=getClass(nn.data()); 00708 } 00709 else if (ii==VhdlDocGen::ARCHITECTURE) 00710 { 00711 QStringList qlist=QStringList::split("-",nn,FALSE); 00712 nn=qlist[1]; 00713 cd=VhdlDocGen::getClass(nn.data()); 00714 } 00715 00716 QCString opp; 00717 if (ii==VhdlDocGen::ENTITY) 00718 { 00719 VhdlDocGen::findAllArchitectures(ql,cd); 00720 int j=ql.count(); 00721 for (int i=0;i<j;i++) 00722 { 00723 QCString *temp=ql.at(i); 00724 QStringList qlist=QStringList::split("-",*temp,FALSE); 00725 QCString s1=(QCString)qlist[0]; 00726 QCString s2=(QCString)qlist[1]; 00727 s1.stripPrefix("_"); 00728 if (j==1) s1.resize(0); 00729 ClassDef*cc = getClass(temp->data()); 00730 if (cc) 00731 { 00732 VhdlDocGen::writeVhdlLink(cc,ol,type,s2,s1); 00733 } 00734 } 00735 } 00736 else 00737 { 00738 VhdlDocGen::writeVhdlLink(cd,ol,type,nn,opp); 00739 } 00740 00741 ol.enable(OutputGenerator::Man); 00742 ol.enable(OutputGenerator::RTF); 00743 00744 }// write 00745 00746 /* 00747 * finds all architectures which belongs to an entiy 00748 */ 00749 void VhdlDocGen::findAllArchitectures(QList<QCString>& qll,const ClassDef *cd) 00750 { 00751 ClassDef *citer; 00752 ClassSDict::Iterator cli(*Doxygen::classSDict); 00753 for ( ; (citer=cli.current()) ; ++cli ) 00754 { 00755 QCString jj=citer->className(); 00756 if (cd != citer && jj.contains('-')!=-1) 00757 { 00758 QStringList ql=QStringList::split("-",jj,FALSE); 00759 QCString temp=(QCString)ql[1]; 00760 if (stricmp(cd->className().data(),temp.data())==0) 00761 { 00762 QCString *cl=new QCString(jj.data()); 00763 qll.insert(0,cl); 00764 } 00765 } 00766 }// for 00767 }//findAllArchitectures 00768 00769 /* 00770 * writes the link entity >> .... or architecture >> ... 00771 */ 00772 00773 void VhdlDocGen::writeVhdlLink(const ClassDef* ccd ,OutputList& ol,QCString& type,QCString& nn,QCString& behav) 00774 { 00775 if (ccd==0) return; 00776 QCString temp=ccd->getOutputFileBase(); 00777 ol.startBold(); 00778 ol.docify(type.data()); 00779 ol.endBold(); 00780 nn.stripPrefix("_"); 00781 ol.writeObjectLink(ccd->getReference(),ccd->getOutputFileBase(),0,nn.data()); 00782 00783 if (!behav.isEmpty()) 00784 { 00785 behav.prepend(" "); 00786 ol.startBold(); 00787 ol.docify(behav.data()); 00788 ol.endBold(); 00789 } 00790 /* 00791 if (Config_getBool("SOURCE_BROWSER")) { // writes a source link for latex docu 00792 ol.pushGeneratorState(); 00793 ol.disableAllBut(OutputGenerator::Latex); 00794 ol.docify(" | "); 00795 ol.startEmphasis(); 00796 FileDef* fd=ccd->getFileDef(); 00797 if (fd) 00798 ol.writeObjectLink(0,fd->getSourceFileBase(),0,theTranslator->trGotoSourceCode().data()); 00799 ol.endEmphasis(); 00800 ol.popGeneratorState(); 00801 } 00802 */ 00803 ol.lineBreak(); 00804 } 00805 00806 bool VhdlDocGen::compareString(const QCString& s1,const QCString& s2) 00807 { 00808 QCString str1=s1.stripWhiteSpace(); 00809 QCString str2=s2.stripWhiteSpace(); 00810 00811 return stricmp(str1.data(),str2.data()); 00812 } 00813 00814 bool VhdlDocGen::getSigTypeName(QList<QCString>& ql, const char* str,QCString& buffer) 00815 { 00816 QCString temp(str); 00817 QStringList qlist=QStringList::split(" is ",temp,FALSE); 00818 if (qlist.count()!=2) return FALSE; 00819 temp.resize(0); 00820 temp+=(QCString)qlist[0]+":"+(QCString)qlist[1]; 00821 return VhdlDocGen::getSigName(ql,temp.data(),buffer); 00822 } 00823 00832 bool VhdlDocGen::getSigName(QList<QCString>& ql, 00833 const char* str,QCString& buffer) 00834 { 00835 int j,ll,index; 00836 char *signal = "signal "; 00837 QCString qmem; 00838 QCString temp(str); 00839 QCString st(str); 00840 00841 //QRegExp semi(","); 00842 //QRegExp r(":"); 00843 00844 // colon position 00845 j = temp.find(':'); 00846 if (j < 0) return FALSE; // no input definition 00847 st=st.left(j); // name only 00848 index=st.find(signal,0,FALSE); 00849 if (index > -1) // found "signal " 00850 { 00851 qmem=st.remove(index,strlen(signal)); // strip it 00852 temp=qmem; 00853 st=qmem; 00854 } 00855 else 00856 { 00857 qmem=temp; 00858 } 00859 00860 ll=st.find(','); 00861 00862 if (ll>0) // multiple names 00863 { 00864 while (TRUE) 00865 { 00866 st=st.left(ll).stripWhiteSpace(); // one name 00867 00868 QCString *sig =new QCString(st); 00869 ql.insert(0,sig); 00870 qmem=qmem.right(qmem.length()-ll-1); // strip from list 00871 st=qmem; // remainder 00872 ll=st.find(','); 00873 if (ll<0) // last name 00874 { 00875 ll = st.find(':'); 00876 st=st.left(ll).stripWhiteSpace(); 00877 ql.insert(0,new QCString(st)); 00878 break; 00879 } 00880 } 00881 } 00882 else // single name 00883 { 00884 st=st.stripWhiteSpace(); 00885 ql.insert(0,new QCString(st)); 00886 } 00887 QCString *qdir=new QCString(str); 00888 st=qdir->mid(j+1); // part after : 00889 st=st.lower().stripWhiteSpace(); 00890 *qdir=st; 00891 ql.insert(0,qdir); 00892 00893 if (st.stripPrefix("inout")) 00894 { 00895 buffer+="inout"; 00896 return TRUE; 00897 } 00898 if (st.stripPrefix("INOUT")) 00899 { 00900 buffer+="inout"; 00901 return TRUE; 00902 } 00903 00904 if (st.stripPrefix("out")) 00905 { 00906 buffer+="out"; 00907 return TRUE; 00908 } 00909 if (st.stripPrefix("OUT")) 00910 { 00911 buffer+="out"; 00912 return TRUE; 00913 } 00914 00915 if (st.stripPrefix("in")) 00916 { 00917 buffer+="in"; 00918 return TRUE; 00919 } 00920 if (st.stripPrefix("IN")) 00921 { 00922 buffer+="in"; 00923 return TRUE; 00924 } 00925 return FALSE; 00926 } 00927 00935 void VhdlDocGen::parseProcessProto(const char* text, 00936 QCString& name,QStringList& ql) 00937 { 00938 int index,end; 00939 const char *s=":"; 00940 QCString temp; 00941 QCString s1(text); 00942 index=s1.find(s,0,FALSE); 00943 if (index >=0) 00944 { 00945 name=s1.left(index); 00946 // strcpy(name,tt.data()); 00947 } 00948 00949 index=s1.find("(",0,FALSE); 00950 end=s1.findRev(")",s1.length(),FALSE); 00951 // end=s1.find(")",0,FALSE); 00952 00953 if ((end-index)>1) 00954 { 00955 temp=s1.mid(index+1,(end-index-1)); 00956 ql=QStringList::split(",",temp,FALSE); 00957 } 00958 }//parseProcessProto 00959 00963 void VhdlDocGen::prepareComment(QCString& qcs) 00964 { 00965 QCString temp; 00966 const char* s="--!"; 00967 //const char *start="--!{"; 00968 //const char *end="--!}"; 00969 int index=0; 00970 00971 #if 0 00972 index=qcs.find(start,0,TRUE); 00973 if (index>0) 00974 temp=qcs.remove(index,strlen(start)); 00975 qcs=temp; 00976 00977 index=qcs.find(end,0,TRUE); 00978 if (index>0) 00979 temp=qcs.remove(index,strlen(end)); 00980 qcs=temp; 00981 #endif 00982 while (TRUE) 00983 { 00984 index=qcs.find(s,0,TRUE); 00985 if (index<0) break; 00986 temp=qcs.remove(index,strlen(s)); 00987 qcs=temp; 00988 } 00989 qcs=qcs.stripWhiteSpace(); 00990 } 00991 00992 01001 void VhdlDocGen::parseFuncProto(const char* text,QList<Argument>& qlist, 01002 QCString& name,QCString& ret,bool doc) 01003 { 01004 int index,end; 01005 QCString s1(text); 01006 QCString temp; 01007 01008 index=s1.find("("); 01009 end=s1.findRev(")"); 01010 01011 if ((end-index)>0) 01012 { 01013 QCString tt=s1.mid(index,(end-index+1)); 01014 temp=s1.mid(index+1,(end-index-1)); 01015 getFuncParams(qlist,temp); 01016 } 01017 if (doc) 01018 { 01019 name=s1.left(index); 01020 name=name.stripWhiteSpace(); 01021 if ((end-index)>0) 01022 { 01023 ret="function"; 01024 } 01025 return; 01026 } 01027 else 01028 { 01029 QCString s1(text); 01030 s1=s1.stripWhiteSpace(); 01031 int i=s1.find("(",0,FALSE); 01032 int s=s1.find(" ",0,FALSE); 01033 if (i==-1) 01034 s1=VhdlDocGen::getIndexWord(s1.data(),1); 01035 else 01036 s1=s1.mid(s,(i-s)); 01037 01038 name=s1.stripWhiteSpace(); 01039 } 01040 index=s1.findRev("return",-1,FALSE); 01041 if (index !=-1) 01042 { 01043 ret=s1.mid(index+6,s1.length()); 01044 ret=ret.stripWhiteSpace(); 01045 VhdlDocGen::deleteCharRev(ret,';'); 01046 } 01047 } 01048 01049 /* 01050 * returns the n'th word of a string 01051 */ 01052 01053 QCString VhdlDocGen::getIndexWord(const char* c,int index) 01054 { 01055 QStringList ql; 01056 QCString temp(c); 01057 QRegExp reg("[\\s]"); 01058 01059 ql=QStringList::split(reg,temp,FALSE); 01060 01061 if (ql.count() > (unsigned int)index) 01062 { 01063 return (QCString)ql[index]; 01064 } 01065 01066 return ""; 01067 } 01068 01069 01076 void VhdlDocGen::getFuncParams(QList<Argument>& ql, const char* str) 01077 { 01078 01079 int len; 01080 QCString qmem,s1,s2,ttype; 01081 QCString temp(str); 01082 temp=temp.stripWhiteSpace(); 01083 if (temp.isEmpty()) return; 01084 01085 QCString st(str); 01086 QStringList strList; 01087 01088 strList=QStringList::split(";",temp,FALSE); 01089 int kk=strList.count(); 01090 int j=kk; 01091 while (kk>=1) 01092 { 01093 temp=strList[j-kk]; 01094 QStringList tempList,tt; 01095 tempList=QStringList::split(":",temp,FALSE); 01096 if (tempList.count()>2) 01097 ttype=tempList[1]; 01098 else 01099 ttype=tempList.last(); 01100 01101 ttype=ttype.stripWhiteSpace(); 01102 01103 uint zui=ttype.contains('(',FALSE); 01104 if (zui == 0) 01105 tt=QStringList::split(" ",ttype,FALSE); 01106 else 01107 { 01108 if (ttype.stripPrefix("in")) 01109 tt.append("in"); 01110 else if (ttype.stripPrefix("out")) 01111 tt.append("out"); 01112 else if (ttype.stripPrefix("inout")) 01113 tt.append("inout"); 01114 if (ttype.stripPrefix("IN")) 01115 tt.append("in"); 01116 else if (ttype.stripPrefix("OUT")) 01117 tt.append("out"); 01118 else if (ttype.stripPrefix("INOUT")) 01119 tt.append("inout"); 01120 01121 ttype=ttype.stripWhiteSpace(); 01122 tt.append(ttype); 01123 } 01124 01125 s1=tt.first(); 01126 //s1=s1.lower(); 01127 01128 if (tempList.count()>2) 01129 s2=tt.last()+":"+tempList[2]; 01130 else 01131 s2=tt.last(); 01132 01133 QCString first=(QCString)tempList.first(); 01134 01135 tempList.clear(); 01136 tt.clear(); 01137 01138 tempList=QStringList::split(",",first,FALSE); 01139 len=tempList.count(); 01140 ttype.resize(0); 01141 for (int j=0;j<len;j++) 01142 { 01143 Argument *arg=new Argument; 01144 QCString name=(QCString)tempList[j]; 01145 name=name.stripWhiteSpace(); 01146 01147 tt=QStringList::split(" ",name,FALSE); 01148 if (tt.count() > 1) 01149 ttype=(tt.first()).stripWhiteSpace(); 01150 01151 arg->defval=ttype.copy(); 01152 arg->type=s2.stripWhiteSpace(); 01153 arg->attrib=s1.stripWhiteSpace(); 01154 arg->name=(tt.last()).stripWhiteSpace(); 01155 01156 // printf("--proto \n [%s] [%s] [%s] [%s] [%s]",ttype.data(),arg->type.data(),arg->attrib.data(),arg->name.data(),s1.data()); 01157 ql.append(arg); 01158 } 01159 kk--; 01160 }//while 01161 } // getFuncName 01162 01163 01164 QCString VhdlDocGen::trTypeString(int type) 01165 { 01166 switch(type) 01167 { 01168 case VhdlDocGen::LIBRARY: return "Library"; 01169 case VhdlDocGen::ENTITY: return "Entity"; 01170 case VhdlDocGen::PACKAGE_BODY: return "Package Body"; 01171 case VhdlDocGen::ATTRIBUTE: return "Attribute"; 01172 case VhdlDocGen::PACKAGE: return "Package"; 01173 case VhdlDocGen::SIGNAL: return "Signal"; 01174 case VhdlDocGen::COMPONENT: return "Component"; 01175 case VhdlDocGen::CONSTANT: return "Constant"; 01176 case VhdlDocGen::TYPE: return "Type"; 01177 case VhdlDocGen::SUBTYPE: return "Subtype"; 01178 case VhdlDocGen::FUNCTION: return "Function"; 01179 case VhdlDocGen::RECORD: return "Record"; 01180 case VhdlDocGen::PROCEDURE: return "Procedure"; 01181 case VhdlDocGen::ARCHITECTURE: return "Architecture"; 01182 case VhdlDocGen::USE: return "Package"; 01183 case VhdlDocGen::PROCESS: return "Process"; 01184 case VhdlDocGen::PORT: return "Port"; 01185 case VhdlDocGen::GENERIC: return "Generic"; 01186 case VhdlDocGen::DOCUMENT: return "Doc"; 01187 case VhdlDocGen::UNITS: return "Units"; 01188 case VhdlDocGen::PORTMAP: return "Port Map"; 01189 default: return ""; 01190 } 01191 } // convertType 01192 01197 bool VhdlDocGen::deleteCharRev(QCString &s,char c) 01198 { 01199 int index=s.findRev(c,-1,FALSE); 01200 if (index > -1) 01201 { 01202 QString qcs=s.remove(index,1); 01203 s=qcs; 01204 return TRUE; 01205 } 01206 return FALSE; 01207 } 01208 01209 void VhdlDocGen::deleteAllChars(QCString &s,char c) 01210 { 01211 int index=s.findRev(c,-1,FALSE); 01212 while (index > -1) 01213 { 01214 QString qcs=s.remove(index,1); 01215 s=qcs; 01216 index=s.findRev(c,-1,FALSE); 01217 } 01218 } 01219 01220 01221 static int recordCounter=0; 01222 01227 QCString VhdlDocGen::getRecordNumber() 01228 { 01229 char buf[12]; 01230 sprintf(buf,"%d",recordCounter++); 01231 QCString qcs(&buf[0]); 01232 return qcs; 01233 } 01234 01239 QCString VhdlDocGen::getProcessNumber() 01240 { 01241 static int stringCounter; 01242 char buf[8]; 01243 QCString qcs("PROCESS_"); 01244 sprintf(buf,"%d",stringCounter++); 01245 qcs.append(&buf[0]); 01246 return qcs; 01247 } 01248 01253 void VhdlDocGen::writeFormatString(QCString& qcs,OutputList&ol,const MemberDef* mdef) 01254 { 01255 QRegExp reg("[\\/\\:\\<\\>\\:\\s\\,\\;\\'\\+\\-\\*\\|\\&\\=\\(\\)\"]"); 01256 qcs+=QCString(" ");// parsing the last sign 01257 QCString *ss; 01258 QCString find=qcs; 01259 QCString temp=qcs; 01260 char buf[2]; 01261 buf[1]='\0'; 01262 01263 int j; 01264 int len; 01265 j = reg.match(temp.data(),0,&len); 01266 01267 ol.startBold(); 01268 if (j>=0) 01269 { 01270 while (j>=0) 01271 { 01272 find=find.left(j); 01273 buf[0]=temp[j]; 01274 ss=VhdlDocGen::findKeyWord(find); 01275 bool k=VhdlDocGen::isNumber(find); // is this a number 01276 if (k) 01277 { 01278 VhdlDocGen::startFonts(find,"vhdldigit",ol); 01279 } 01280 else if (j != 0 && ss) 01281 { 01282 VhdlDocGen::startFonts(find,ss->data(),ol); 01283 } 01284 else 01285 { 01286 if (j>0) 01287 { 01288 VhdlDocGen::writeStringLink(mdef,find,ol); 01289 } 01290 } 01291 VhdlDocGen::startFonts(&buf[0],"vhdlchar",ol); 01292 01293 QCString st=temp.remove(0,j+1); 01294 find=st; 01295 temp=st; 01296 j = reg.match(temp.data(),0,&len); 01297 }//while 01298 }//if 01299 else 01300 { 01301 VhdlDocGen::startFonts(find,"vhdlchar",ol); 01302 } 01303 ol.endBold(); 01304 }// writeFormatString 01305 01310 bool VhdlDocGen::isNumber(const QCString& s) 01311 { 01312 int len=s.length(); 01313 if (len==0) return FALSE; 01314 for (int j=0;j<len;j++) 01315 { 01316 if (isdigit((int)(s.at(j) & 0xff))==0) 01317 return FALSE; 01318 } 01319 return TRUE; 01320 }// isNumber 01321 01322 01323 void VhdlDocGen::startFonts(const QCString& q, char *keyword,OutputList& ol) 01324 { 01325 ol.startFontClass(keyword); 01326 ol.docify(q.data()); 01327 ol.endFontClass(); 01328 } 01329 01335 void VhdlDocGen::formatString(QCString & qcs, OutputList& ol,const MemberDef* mdef) 01336 { 01337 QCString temp(qcs.length()); 01338 qcs.stripPrefix(":"); 01339 qcs.stripPrefix("is"); 01340 qcs.stripPrefix("IS"); 01341 qcs.stripPrefix("of"); 01342 qcs.stripPrefix("OF"); 01343 01344 VhdlDocGen::deleteCharRev(qcs,';'); 01345 //char white='\t'; 01346 int len = qcs.length(); 01347 unsigned int index=1;//temp.length(); 01348 01349 for (int j=0;j<len;j++) 01350 { 01351 char c=qcs[j]; 01352 char b=c; 01353 if (j>0) b=qcs[j-1]; 01354 if (c=='"' || c==',' || c==';' || c=='\''|| c=='(' || c==')' || c==':' ) // || (c==':' && b!='=')) // || (c=='=' && b!='>')) 01355 { 01356 if (temp.at(index-1) != ' ') 01357 { 01358 temp+=" "; 01359 } 01360 temp+=QCString(&c,1); 01361 temp+=" "; 01362 } 01363 else if (c=='=') 01364 { 01365 if (b==':') // := operator 01366 { 01367 temp.replace(index-1,1,"="); 01368 temp+=" "; 01369 } 01370 else // = operator 01371 { 01372 temp+=" "; 01373 temp+=QCString(&c,1); 01374 temp+=" "; 01375 } 01376 } 01377 else 01378 { 01379 temp+=QCString(&c,1); 01380 } 01381 01382 index=temp.length(); 01383 }// for 01384 temp=temp.stripWhiteSpace(); 01385 // printf("\n [%s]",qcs.data()); 01386 VhdlDocGen::writeFormatString(temp,ol,mdef); 01387 } 01388 01393 void VhdlDocGen::writeProcedureProto(OutputList& ol,const ArgumentList* al,const MemberDef* mdef) 01394 { 01395 ArgumentListIterator ali(*al); 01396 Argument *arg; 01397 bool sem=FALSE; 01398 int len=al->count(); 01399 ol.docify("( "); 01400 if (len > 2) 01401 { 01402 ol.lineBreak(); 01403 } 01404 for (;(arg=ali.current());++ali) 01405 { 01406 ol.startBold(); 01407 if (sem && len <3) 01408 ol.writeChar(','); 01409 01410 QCString nn=arg->name; 01411 nn+=": "; 01412 01413 QCString *str=VhdlDocGen::findKeyWord(arg->defval); 01414 arg->defval+=" "; 01415 if (str) 01416 { 01417 VhdlDocGen::startFonts(arg->defval,str->data(),ol); 01418 } 01419 else 01420 { 01421 VhdlDocGen::startFonts(arg->defval,"vhdlchar",ol); // write type (variable,constant etc.) 01422 } 01423 01424 VhdlDocGen::startFonts(nn,"vhdlchar",ol); // write name 01425 if (stricmp(arg->attrib.data(),arg->type.data()) != 0) 01426 VhdlDocGen::startFonts(arg->attrib.lower(),"stringliteral",ol); // write in|out 01427 ol.docify(" "); 01428 VhdlDocGen::formatString(arg->type,ol,mdef); 01429 sem=TRUE; 01430 ol.endBold(); 01431 if (len > 2) 01432 { 01433 ol.lineBreak(); 01434 ol.docify(" "); 01435 } 01436 }//for 01437 01438 ol.docify(" )"); 01439 01440 01441 }// writePorcedure 01442 01447 void VhdlDocGen::writeFunctionProto(OutputList& ol,const ArgumentList* al,const MemberDef* mdef) 01448 { 01449 if (al==0) return; 01450 ArgumentListIterator ali(*al); 01451 Argument *arg; 01452 bool sem=FALSE; 01453 int len=al->count(); 01454 ol.startBold(); 01455 ol.docify(" ( "); 01456 ol.endBold(); 01457 if (len>2) 01458 { 01459 ol.lineBreak(); 01460 } 01461 for (;(arg=ali.current());++ali) 01462 { 01463 ol.startBold(); 01464 if (sem && len < 3) 01465 { 01466 ol.docify(" , "); 01467 } 01468 QCString att=arg->defval; 01469 if (!att.isEmpty()) 01470 { 01471 QCString *str=VhdlDocGen::findKeyWord(att); 01472 att+=" "; 01473 if (str) 01474 VhdlDocGen::formatString(att,ol,mdef); 01475 else 01476 VhdlDocGen::startFonts(att,"vhdlchar",ol); 01477 } 01478 01479 QCString nn=arg->name; 01480 nn+=": "; 01481 QCString ss=arg->type; //.lower(); 01482 QCString w=ss;//.upper(); 01483 VhdlDocGen::startFonts(nn,"vhdlchar",ol); 01484 VhdlDocGen::startFonts("in ","stringliteral",ol); 01485 QCString *str=VhdlDocGen::findKeyWord(ss); 01486 if (str) 01487 VhdlDocGen::formatString(w,ol,mdef); 01488 else 01489 VhdlDocGen::startFonts(w,"vhdlchar",ol); 01490 01491 sem=TRUE; 01492 ol.endBold(); 01493 if (len > 2) 01494 { 01495 ol.lineBreak(); 01496 } 01497 } 01498 ol.startBold(); 01499 ol.docify(" )"); 01500 ol.endBold(); 01501 } 01502 01507 void VhdlDocGen::writeProcessProto(OutputList& ol,const ArgumentList* al,const MemberDef* mdef) 01508 { 01509 if (al==0) return; 01510 ArgumentListIterator ali(*al); 01511 Argument *arg; 01512 bool sem=FALSE; 01513 ol.startBold(); 01514 ol.docify(" ( "); 01515 for (;(arg=ali.current());++ali) 01516 { 01517 if (sem) 01518 ol.docify(" , "); 01519 QCString nn=arg->name; 01520 // VhdlDocGen::startFonts(nn,"vhdlchar",ol); 01521 VhdlDocGen::writeFormatString(nn,ol,mdef); 01522 sem=TRUE; 01523 } 01524 ol.docify(" )"); 01525 ol.endBold(); 01526 } 01527 01528 01533 void VhdlDocGen::writeFuncProcDocu( 01534 const MemberDef *md, 01535 OutputList& ol, 01536 const ArgumentList* al, 01537 bool /*type*/) 01538 { 01539 if (al==0) return; 01540 bool sem=FALSE; 01541 ol.enableAll(); 01542 01543 ArgumentListIterator ali(*al); 01544 int index=ali.count(); 01545 if (index==0){ 01546 ol.docify(" ( ) "); 01547 return; 01548 } 01549 ol.startParameterList(TRUE); 01550 Argument *arg; 01551 bool first=TRUE; 01552 for (;(arg=ali.current());++ali) 01553 { 01554 ol.startParameterType(first,""); 01555 if (!VhdlDocGen::isProcess(md)) 01556 { 01557 if (TRUE) //VhdlDocGen::isProcedure(md)) 01558 { 01559 startFonts(arg->defval,"keywordtype",ol); 01560 ol.docify(" "); 01561 } 01562 // linkifyText(TextGeneratorOLImpl(ol),md->getClassDef(),md->getBodyDef(),md->name(),arg->type); 01563 VhdlDocGen::writeFormatString(arg->name,ol,md); 01564 ol.docify(" "); 01565 01566 if (VhdlDocGen::isProcedure(md)) 01567 startFonts(arg->attrib,"stringliteral",ol); 01568 else 01569 startFonts(QCString("in"),"stringliteral",ol); 01570 } 01571 ol.docify(" "); 01572 ol.disable(OutputGenerator::Man); 01573 ol.startEmphasis(); 01574 ol.enable(OutputGenerator::Man); 01575 if (!VhdlDocGen::isProcess(md)) 01576 startFonts(arg->type,"vhdlkeyword",ol); 01577 else 01578 startFonts(arg->name,"vhdlkeyword",ol); 01579 ol.disable(OutputGenerator::Man); 01580 ol.endEmphasis(); 01581 ol.enable(OutputGenerator::Man); 01582 01583 if (--index) 01584 ol.docify(" , "); 01585 else 01586 ol.docify(" ) "); 01587 01588 ol.endParameterName(FALSE,FALSE,FALSE); 01589 01590 sem=TRUE; 01591 first=FALSE; 01592 } 01593 01594 } // writeDocFunProc 01595 01601 bool VhdlDocGen::isFunctionProto(QCString& ss) 01602 { 01603 QCString name=ss; 01604 QCString proc("procedure"); 01605 QCString func("function"); 01606 name=name.stripWhiteSpace(); 01607 QStringList ql=QStringList::split(" ",name,FALSE); 01608 int j=ql.count(); 01609 if (j<2) return FALSE; 01610 QCString tt=(QCString)ql[0]; 01611 01612 if (VhdlDocGen::compareString(tt,proc)!=0 && VhdlDocGen::compareString(tt,func)!=0) 01613 return FALSE; 01614 01615 QCString temp=(QCString)ql[j-1]; 01616 temp=temp.stripWhiteSpace(); 01617 if (stricmp(temp.data(),"is")==0) 01618 { 01619 VhdlDocGen::deleteCharRev(name,'s'); 01620 VhdlDocGen::deleteCharRev(name,'i'); 01621 ss=name; 01622 return TRUE; 01623 } 01624 return FALSE; 01625 } 01626 01627 QCString VhdlDocGen::convertArgumentListToString(const ArgumentList* al,bool func) 01628 { 01629 QCString argString; 01630 bool sem=FALSE; 01631 ArgumentListIterator ali(*al); 01632 Argument *arg; 01633 01634 for (;(arg=ali.current());++ali) 01635 { 01636 if (sem) argString.append(", "); 01637 if (func) 01638 { 01639 argString+=arg->name; 01640 argString+=":"; 01641 argString+=arg->type; 01642 } 01643 else 01644 { 01645 argString+=arg->defval+" "; 01646 argString+=arg->name+" :"; 01647 argString+=arg->attrib+" "; 01648 argString+=arg->type; 01649 } 01650 sem=TRUE; 01651 } 01652 return argString; 01653 } 01654 01655 01656 void VhdlDocGen::writeVhdlDeclarations(MemberList* ml, 01657 OutputList& ol,GroupDef* gd,ClassDef* cd) 01658 { 01659 static ClassDef *cdef; 01660 static GroupDef* gdef; 01661 if (cd && cdef!=cd) 01662 { // only one inline link 01663 VhdlDocGen::writeInlineClassLink(cd,ol); 01664 cdef=cd; 01665 } 01666 01667 if (gd && gdef==gd) return; 01668 if (gd && gdef!=gd) 01669 { 01670 gdef=gd; 01671 } 01672 01673 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::LIBRARY,FALSE),0,FALSE,VhdlDocGen::LIBRARY); 01674 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::USE,FALSE),0,FALSE,VhdlDocGen::USE); 01675 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::FUNCTION,FALSE),0,FALSE,VhdlDocGen::FUNCTION); 01676 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::COMPONENT,FALSE),0,FALSE,VhdlDocGen::COMPONENT); 01677 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::CONSTANT,FALSE),0,FALSE,VhdlDocGen::CONSTANT); 01678 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::TYPE,FALSE),0,FALSE,VhdlDocGen::TYPE); 01679 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::SUBTYPE,FALSE),0,FALSE,VhdlDocGen::SUBTYPE); 01680 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::GENERIC,FALSE),0,FALSE,VhdlDocGen::GENERIC); 01681 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::PORT,FALSE),0,FALSE,VhdlDocGen::PORT); 01682 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::PROCESS,FALSE),0,FALSE,VhdlDocGen::PROCESS); 01683 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::SIGNAL,FALSE),0,FALSE,VhdlDocGen::SIGNAL); 01684 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::ATTRIBUTE,FALSE),0,FALSE,VhdlDocGen::ATTRIBUTE); 01685 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::PROCEDURE,FALSE),0,FALSE,VhdlDocGen::PROCEDURE); 01686 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::RECORD,FALSE),0,FALSE,VhdlDocGen::RECORD); 01687 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::UNITS,FALSE),0,FALSE,VhdlDocGen::UNITS); 01688 01689 01690 } 01691 01692 /* writes a vhdl type documentation */ 01693 void VhdlDocGen::writeVHDLTypeDocumentation(const MemberDef* mdef, const Definition *d, OutputList &ol) 01694 { 01695 ClassDef *cd=(ClassDef*)d; 01696 if (cd==0) return; 01697 if ((VhdlDocGen::isVhdlFunction(mdef) || VhdlDocGen::isProcedure(mdef) || VhdlDocGen::isProcess(mdef))) 01698 { 01699 QCString nn=mdef->typeString(); 01700 nn=nn.stripWhiteSpace(); 01701 QCString na=cd->name(); 01702 MemberDef* memdef=VhdlDocGen::findMember(na,nn); 01703 if (memdef && memdef->isLinkable()) 01704 { 01705 ol.startBold(); 01706 ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),0,mdef->typeString()); 01707 ol.endBold(); 01708 ol.docify(" "); 01709 } 01710 else 01711 { 01712 QCString ttype=mdef->typeString(); 01713 VhdlDocGen::formatString(ttype,ol,mdef); 01714 } 01715 ol.docify(mdef->name()); 01716 VhdlDocGen::writeFuncProcDocu(mdef,ol, mdef->argumentList().pointer()); 01717 } 01718 01719 if (mdef->isVariable()) 01720 { 01721 ol.docify(mdef->name().data()); 01722 ol.docify(" "); 01723 QCString ttype=mdef->typeString(); 01724 VhdlDocGen::formatString(ttype,ol,mdef); 01725 ol.docify(" "); 01726 if (VhdlDocGen::isPort(mdef)) 01727 { 01728 QCString largs=mdef->argsString(); 01729 VhdlDocGen::formatString(largs,ol,mdef); 01730 ol.docify(" "); 01731 } 01732 } 01733 } 01734 01735 /* writes a vhdl type declaration */ 01736 01737 void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol, 01738 ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd, 01739 bool /*inGroup*/) 01740 { 01741 01742 LockingPtr<MemberDef> lock(mdef,mdef); 01743 01744 Definition *d=0; 01745 ASSERT (cd!=0 || nd!=0 || fd!=0 || gd!=0); // member should belong to something 01746 if (cd) d=cd; else if (nd) d=nd; else if (fd) d=fd; else d=gd; 01747 01748 // write tag file information of this member 01749 if (!Config_getString("GENERATE_TAGFILE").isEmpty()) 01750 { 01751 Doxygen::tagFile << " <member kind=\""; 01752 if (VhdlDocGen::isGeneric(mdef)) Doxygen::tagFile << "generic"; 01753 if (VhdlDocGen::isPort(mdef)) Doxygen::tagFile << "port"; 01754 if (VhdlDocGen::isEntity(mdef)) Doxygen::tagFile << "entity"; 01755 if (VhdlDocGen::isComponent(mdef)) Doxygen::tagFile << "component"; 01756 if (VhdlDocGen::isVType(mdef)) Doxygen::tagFile << "type"; 01757 if (VhdlDocGen::isConstant(mdef)) Doxygen::tagFile << "constant"; 01758 if (VhdlDocGen::isSubType(mdef)) Doxygen::tagFile << "subtype"; 01759 if (VhdlDocGen::isVhdlFunction(mdef)) Doxygen::tagFile << "function"; 01760 if (VhdlDocGen::isProcedure(mdef)) Doxygen::tagFile << "procedure"; 01761 if (VhdlDocGen::isProcess(mdef)) Doxygen::tagFile << "process"; 01762 if (VhdlDocGen::isSignals(mdef)) Doxygen::tagFile << "signal"; 01763 if (VhdlDocGen::isAttribute(mdef)) Doxygen::tagFile << "attribute"; 01764 if (VhdlDocGen::isRecord(mdef)) Doxygen::tagFile << "record"; 01765 if (VhdlDocGen::isLibrary(mdef)) Doxygen::tagFile << "library"; 01766 if (VhdlDocGen::isPackage(mdef)) Doxygen::tagFile << "package"; 01767 01768 Doxygen::tagFile << "\">" << endl; 01769 Doxygen::tagFile << " <type>" << convertToXML(mdef->typeString()) << "</type>" << endl; 01770 Doxygen::tagFile << " <name>" << convertToXML(mdef->name()) << "</name>" << endl; 01771 Doxygen::tagFile << " <anchorfile>" << convertToXML(mdef->getOutputFileBase()+Doxygen::htmlFileExtension) << "</anchorfile>" << endl; 01772 Doxygen::tagFile << " <anchor>" << convertToXML(mdef->anchor()) << "</anchor>" << endl; 01773 01774 if (VhdlDocGen::isVhdlFunction(mdef)) 01775 Doxygen::tagFile << " <arglist>" << convertToXML(VhdlDocGen::convertArgumentListToString(mdef->argumentList().pointer(),TRUE)) << "</arglist>" << endl; 01776 else if (VhdlDocGen::isProcedure(mdef)) 01777 Doxygen::tagFile << " <arglist>" << convertToXML(VhdlDocGen::convertArgumentListToString(mdef->argumentList().pointer(),FALSE)) << "</arglist>" << endl; 01778 else 01779 Doxygen::tagFile << " <arglist>" << convertToXML(mdef->argsString()) << "</arglist>" << endl; 01780 01781 mdef->writeDocAnchorsToTagFile(); 01782 Doxygen::tagFile << " </member>" << endl; 01783 01784 } 01785 01786 // write search index info 01787 if (Config_getBool("SEARCHENGINE")) 01788 { 01789 Doxygen::searchIndex->setCurrentDoc(mdef->qualifiedName(),mdef->getOutputFileBase(),mdef->anchor()); 01790 Doxygen::searchIndex->addWord(mdef->localName(),TRUE); 01791 Doxygen::searchIndex->addWord(mdef->qualifiedName(),FALSE); 01792 } 01793 01794 QCString cname = d->name(); 01795 QCString cfname = mdef->getOutputFileBase(); 01796 01797 //HtmlHelp *htmlHelp=0; 01798 // bool hasHtmlHelp = Config_getBool("GENERATE_HTML") && Config_getBool("GENERATE_HTMLHELP"); 01799 // if (hasHtmlHelp) htmlHelp = HtmlHelp::getInstance(); 01800 01801 // search for the last anonymous scope in the member type 01802 ClassDef *annoClassDef=mdef->getClassDefOfAnonymousType(); 01803 01804 // start a new member declaration 01805 bool isAnonymous = annoClassDef; // || m_impl->annMemb || m_impl->annEnumType; 01807 ol.startMemberItem( isAnonymous ); //? 1 : m_impl->tArgList ? 3 : 0); 01808 01809 // If there is no detailed description we need to write the anchor here. 01810 bool detailsVisible = mdef->isDetailedSectionLinkable(); 01811 if (!detailsVisible) // && !m_impl->annMemb) 01812 { 01813 QCString doxyName=mdef->name().copy(); 01814 if (!cname.isEmpty()) doxyName.prepend(cname+"::"); 01815 QCString doxyArgs=mdef->argsString(); 01816 ol.startDoxyAnchor(cfname,cname,mdef->anchor(),doxyName,doxyArgs); 01817 01818 ol.pushGeneratorState(); 01819 ol.disable(OutputGenerator::Man); 01820 ol.disable(OutputGenerator::Latex); 01821 ol.docify("\n"); 01822 ol.popGeneratorState(); 01823 01824 } 01825 // *** write type 01826 /*VHDL CHANGE */ 01827 QCString ltype(mdef->typeString()); 01828 QCString largs(mdef->argsString()); 01829 int mm=mdef->getMemberSpecifiers(); 01830 //printf(":: ltype=%s largs=%s name=%s mm=%d\n", 01831 // ltype.data(),largs.data(),mdef->name().data(),mm); 01832 01833 ClassDef *kl=0; 01834 //FileDef *fdd=0; 01835 LockingPtr<ArgumentList> alp = mdef->argumentList(); 01836 QCString nn; 01837 if (gd) gd=0; 01838 switch(mm) 01839 { 01840 case VhdlDocGen::PROCEDURE: 01841 case VhdlDocGen::FUNCTION: 01842 ol.startBold(); 01843 VhdlDocGen::formatString(ltype,ol,mdef); 01844 ol.endBold(); 01845 ol.insertMemberAlign(); 01846 writeLink(mdef,ol); 01847 if (alp!=0 && mm==VhdlDocGen::FUNCTION) 01848 VhdlDocGen::writeFunctionProto(ol,alp.pointer(),mdef); 01849 01850 if (alp!=0 && mm==VhdlDocGen::PROCEDURE) 01851 VhdlDocGen::writeProcedureProto(ol,alp.pointer(),mdef); 01852 01853 break; 01854 case VhdlDocGen::GENERIC: 01855 case VhdlDocGen::PORT: 01856 writeLink(mdef,ol); 01857 ol.insertMemberAlign(); 01858 if (mm==VhdlDocGen::GENERIC) 01859 { 01860 ol.startBold(); 01861 ol.docify(" "); 01862 VhdlDocGen::formatString(ltype,ol,mdef); 01863 ol.endBold(); 01864 } 01865 else 01866 { 01867 ol.docify(" "); 01868 ol.startBold(); 01869 ol.docify(mdef->typeString()); 01870 ol.endBold(); 01871 ol.docify(" "); 01872 VhdlDocGen::formatString(largs,ol,mdef); 01873 } 01874 break; 01875 case VhdlDocGen::PROCESS: 01876 writeLink(mdef,ol); 01877 ol.insertMemberAlign(); 01878 VhdlDocGen::writeProcessProto(ol,alp.pointer(),mdef); 01879 break; 01880 case VhdlDocGen::PACKAGE: 01881 case VhdlDocGen::ENTITY: 01882 case VhdlDocGen::COMPONENT: 01883 writeLink(mdef,ol); 01884 ol.insertMemberAlign(); 01885 ol.docify(ltype); 01886 ol.docify(" "); 01887 if (VhdlDocGen::isComponent(mdef)) 01888 { 01889 nn=mdef->name(); 01890 kl=getClass(nn.data()); 01891 if (kl) 01892 { 01893 nn=kl->getOutputFileBase(); 01894 ol.pushGeneratorState(); 01895 ol.disableAllBut(OutputGenerator::Html); 01896 ol.docify(" "); 01897 QCString name=theTranslator_vhdlType(VhdlDocGen::ENTITY,TRUE); 01898 ol.startBold(); 01899 ol.docify(name.data()); 01900 ol.endBold(); 01901 ol.startEmphasis(); 01902 name.resize(0); 01903 name+=" <"+mdef->name()+"> "; 01904 ol.writeObjectLink(kl->getReference(),kl->getOutputFileBase(),0,name.data()); 01905 ol.endEmphasis(); 01906 ol.popGeneratorState(); 01907 } 01908 } 01909 break; 01910 case VhdlDocGen::USE: 01911 kl=VhdlDocGen::getClass(mdef->name()); 01912 if (kl && ((VhdlDocGen::VhdlClasses)kl->protection()==VhdlDocGen::ENTITYCLASS)) break; 01913 writeLink(mdef,ol); 01914 ol.insertMemberAlign(); 01915 ol.docify(" "); 01916 01917 if (kl) 01918 { 01919 nn=kl->getOutputFileBase(); 01920 ol.pushGeneratorState(); 01921 ol.disableAllBut(OutputGenerator::Html); 01922 ol.docify(" "); 01923 QCString name=theTranslator_vhdlType(VhdlDocGen::PACKAGE,TRUE); 01924 ol.startBold(); 01925 ol.docify(name.data()); 01926 name.resize(0); 01927 ol.endBold(); 01928 name+=" <"+mdef->name()+">"; 01929 ol.startEmphasis(); 01930 ol.writeObjectLink(kl->getReference(),kl->getOutputFileBase(),0,name.data()); 01931 ol.popGeneratorState(); 01932 } 01933 break; 01934 case VhdlDocGen::LIBRARY: 01935 writeLink(mdef,ol); 01936 ol.insertMemberAlign(); 01937 break; 01938 case VhdlDocGen::SIGNAL: 01939 case VhdlDocGen::ATTRIBUTE: 01940 case VhdlDocGen::TYPE: 01941 case VhdlDocGen::SUBTYPE: 01942 case VhdlDocGen::CONSTANT: 01943 writeLink(mdef,ol); 01944 ol.docify(" "); 01945 ol.insertMemberAlign(); 01946 VhdlDocGen::formatString(ltype,ol,mdef); 01947 break; 01948 case VhdlDocGen::RECORD: 01949 writeLink(mdef,ol); 01950 ol.startBold(); 01951 if (ltype.isEmpty()) ol.docify(" : record"); 01952 ol.insertMemberAlign(); 01953 if (!ltype.isEmpty()) 01954 VhdlDocGen::formatString(ltype,ol,mdef); 01955 ol.endBold(); 01956 break; 01957 case VhdlDocGen::UNITS: 01958 ol.startBold(); 01959 writeLink(mdef,ol); 01960 if (ltype.isEmpty()) ol.docify(" : unit"); 01961 ol.insertMemberAlign(); 01962 if (!ltype.isEmpty()) 01963 VhdlDocGen::formatString(ltype,ol,mdef); 01964 ol.endBold(); 01965 break; 01966 default: break; 01967 } 01968 01969 bool htmlOn = ol.isEnabled(OutputGenerator::Html); 01970 if (htmlOn && Config_getBool("HTML_ALIGN_MEMBERS") && !ltype.isEmpty()) 01971 { 01972 ol.disable(OutputGenerator::Html); 01973 } 01974 if (!ltype.isEmpty()) ol.docify(" "); 01975 01976 if (htmlOn) 01977 { 01978 ol.enable(OutputGenerator::Html); 01979 } 01980 01981 if (!detailsVisible)// && !m_impl->annMemb) 01982 { 01983 ol.endDoxyAnchor(cfname,mdef->anchor()); 01984 } 01985 01986 //printf("endMember %s annoClassDef=%p annEnumType=%p\n", 01987 // name().data(),annoClassDef,annEnumType); 01988 ol.endMemberItem(); 01989 if (!mdef->briefDescription().isEmpty() && Config_getBool("BRIEF_MEMBER_DESC") /* && !annMemb */) 01990 { 01991 ol.startMemberDescription(); 01992 ol.parseDoc(mdef->briefFile(),mdef->briefLine(),mdef->getOuterScope()?mdef->getOuterScope():d,mdef,mdef->briefDescription(),TRUE,FALSE); 01993 if (detailsVisible) 01994 { 01995 ol.pushGeneratorState(); 01996 ol.disableAllBut(OutputGenerator::Html); 01997 //ol.endEmphasis(); 01998 ol.docify(" "); 01999 if (mdef->getGroupDef()!=0 && gd==0) // forward link to the group 02000 { 02001 ol.startTextLink(mdef->getOutputFileBase(),mdef->anchor()); 02002 } 02003 else // local link 02004 { 02005 ol.startTextLink(0,mdef->anchor()); 02006 } 02007 ol.endTextLink(); 02008 //ol.startEmphasis(); 02009 ol.popGeneratorState(); 02010 } 02011 //ol.newParagraph(); 02012 ol.endMemberDescription(); 02013 } 02014 mdef->warnIfUndocumented(); 02015 02016 }// end writeVhdlDeclaration 02017 02018 02019 void VhdlDocGen::writeLink(const MemberDef* mdef,OutputList &ol) 02020 { 02021 ol.writeObjectLink(mdef->getReference(), 02022 mdef->getOutputFileBase(), 02023 mdef->anchor(), 02024 mdef->name()); 02025 } 02026 02027 void VhdlDocGen::writePlainVHDLDeclarations( 02028 MemberList* mlist,OutputList &ol, 02029 ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,int specifier) 02030 { 02031 02032 SDict<QCString> pack(1009); 02033 02034 ol.pushGeneratorState(); 02035 02036 bool first=TRUE; 02037 MemberDef *md; 02038 MemberListIterator mli(*mlist); 02039 for ( ; (md=mli.current()); ++mli ) 02040 { 02041 int mems=md->getMemberSpecifiers(); 02042 if (md->isBriefSectionVisible() && (mems==specifier) && (mems!=VhdlDocGen::LIBRARY) ) 02043 { 02044 if (first) {ol.startMemberList();first=FALSE;} 02045 VhdlDocGen::writeVHDLDeclaration(md,ol,cd,nd,fd,gd,FALSE); 02046 } //if 02047 else if (md->isBriefSectionVisible() && (mems==specifier)) 02048 { 02049 if (!pack.find(md->name().data())) 02050 { 02051 if (first) ol.startMemberList(),first=FALSE; 02052 VhdlDocGen::writeVHDLDeclaration(md,ol,cd,nd,fd,gd,FALSE); 02053 pack.append(md->name().data(),new QCString(md->name().data())); 02054 } 02055 } //if 02056 } //for 02057 if (!first) ol.endMemberList(); 02058 pack.clear(); 02059 }//plainDeclaration 02060 02061 static bool membersHaveSpecificType(MemberList *ml,int type) 02062 { 02063 if (ml==0) return FALSE; 02064 MemberDef *mdd=0; 02065 MemberListIterator mmli(*ml); 02066 for ( ; (mdd=mmli.current()); ++mmli ) 02067 { 02068 if (mdd->getMemberSpecifiers()==type) //is type in class 02069 { 02070 return TRUE; 02071 } 02072 } 02073 if (ml->getMemberGroupList()) 02074 { 02075 MemberGroupListIterator mgli(*ml->getMemberGroupList()); 02076 MemberGroup *mg; 02077 while ((mg=mgli.current())) 02078 { 02079 if (mg->members()) 02080 { 02081 if (membersHaveSpecificType(mg->members(),type)) return TRUE; 02082 } 02083 ++mgli; 02084 } 02085 } 02086 return FALSE; 02087 } 02088 02089 void VhdlDocGen::writeVHDLDeclarations(MemberList* ml,OutputList &ol, 02090 ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd, 02091 const char *title,const char *subtitle,bool /*showEnumValues*/,int type) 02092 { 02093 02094 if (!membersHaveSpecificType(ml,type)) return; 02095 02096 if (title) 02097 { 02098 ol.startMemberHeader(); 02099 ol.parseText(title); 02100 ol.endMemberHeader(); 02101 ol.docify(" "); 02102 } 02103 if (subtitle && subtitle[0]!=0) 02104 { 02105 ol.startMemberSubtitle(); 02106 ol.parseDoc("[generated]",-1,0,0,subtitle,FALSE,FALSE); 02107 ol.endMemberSubtitle(); 02108 } //printf("memberGroupList=%p\n",memberGroupList); 02109 02110 VhdlDocGen::writePlainVHDLDeclarations(ml,ol,cd,nd,fd,gd,type); 02111 02112 if (ml->getMemberGroupList()) 02113 { 02114 MemberGroupListIterator mgli(*ml->getMemberGroupList()); 02115 MemberGroup *mg; 02116 while ((mg=mgli.current())) 02117 { 02118 if (membersHaveSpecificType(mg->members(),type)) 02119 { 02120 //printf("mg->header=%s\n",mg->header().data()); 02121 bool hasHeader=mg->header()!="[NOHEADER]"; 02122 ol.startMemberGroupHeader(hasHeader); 02123 if (hasHeader) 02124 { 02125 ol.parseText(mg->header()); 02126 } 02127 ol.endMemberGroupHeader(); 02128 if (!mg->documentation().isEmpty()) 02129 { 02130 //printf("Member group has docs!\n"); 02131 ol.startMemberGroupDocs(); 02132 ol.parseDoc("[generated]",-1,0,0,mg->documentation()+"\n",FALSE,FALSE); 02133 ol.endMemberGroupDocs(); 02134 } 02135 ol.startMemberGroup(); 02136 //printf("--- mg->writePlainDeclarations ---\n"); 02137 VhdlDocGen::writePlainVHDLDeclarations(mg->members(),ol,cd,nd,fd,gd,type); 02138 ol.endMemberGroup(hasHeader); 02139 } 02140 ++mgli; 02141 } 02142 } 02143 }// writeVHDLDeclarations 02144 02145 /* strips the prefix for record and unit members*/ 02146 void VhdlDocGen::adjustRecordMember(MemberDef *mdef) 02147 { //,OutputList & ol) { 02148 QRegExp regg("[_a-zA-Z]"); 02149 QCString nn=mdef->name(); 02150 int j=nn.find(regg,0); 02151 if (j>0) 02152 { 02153 nn=nn.mid(j,nn.length()); 02154 mdef->setName(nn.data()); 02155 } 02156 }//adjustRecordMember 02157 02158 /* strips the prefix for package and package body */ 02159 02160 bool VhdlDocGen::writeClassType( ClassDef *& cd, 02161 OutputList &ol ,QCString & cname) 02162 { 02163 //static ClassDef *prev = 0; 02164 //if (prev == cd) return TRUE; 02165 //if (cd != prev) prev=cd; 02166 02167 int id=cd->protection(); 02168 QCString qcs = VhdlDocGen::trTypeString(id+2); 02169 cname=VhdlDocGen::getClassName(cd); 02170 ol.startBold(); 02171 ol.writeString(qcs.data()); 02172 ol.writeString(" "); 02173 ol.endBold(); 02174 //ol.insertMemberAlign(); 02175 return FALSE; 02176 }// writeClassLink 02177 02178 QCString VhdlDocGen::trVhdlType(int type,bool sing) 02179 { 02180 switch(type) 02181 { 02182 case VhdlDocGen::LIBRARY: 02183 if (sing) return "Library"; 02184 else return "Libraries"; 02185 case VhdlDocGen::PACKAGE: 02186 if (sing) return "Package"; 02187 else return "Packages"; 02188 case VhdlDocGen::SIGNAL: 02189 if (sing) return "Signal"; 02190 else return "Signals"; 02191 case VhdlDocGen::COMPONENT: 02192 if (sing) return "Component"; 02193 else return "Components"; 02194 case VhdlDocGen::CONSTANT: 02195 if (sing) return "Constant"; 02196 else return "Constants"; 02197 case VhdlDocGen::ENTITY: 02198 if (sing) return "Entity"; 02199 else return "Entities"; 02200 case VhdlDocGen::TYPE: 02201 if (sing) return "Type"; 02202 else return "Types"; 02203 case VhdlDocGen::SUBTYPE: 02204 if (sing) return "Subtype"; 02205 else return "Subtypes"; 02206 case VhdlDocGen::FUNCTION: 02207 if (sing) return "Function"; 02208 else return "Functions"; 02209 case VhdlDocGen::RECORD: 02210 if (sing) return "Record"; 02211 else return "Records"; 02212 case VhdlDocGen::PROCEDURE: 02213 if (sing) return "Procedure"; 02214 else return "Procedures"; 02215 case VhdlDocGen::ARCHITECTURE: 02216 if (sing) return "Architecture"; 02217 else return "Architectures"; 02218 case VhdlDocGen::ATTRIBUTE: 02219 if (sing) return "Attribute"; 02220 else return "Attributes"; 02221 case VhdlDocGen::PROCESS: 02222 if (sing) return "Process"; 02223 else return "Processes"; 02224 case VhdlDocGen::PORT: 02225 if (sing) return "Port"; 02226 else return "Ports"; 02227 case VhdlDocGen::USE: 02228 if (sing) return "Package"; 02229 else return "Packages"; 02230 case VhdlDocGen::GENERIC: 02231 if (sing) return "Generic"; 02232 else return "Generics"; 02233 case VhdlDocGen::PACKAGE_BODY: 02234 return "Package Body"; 02235 case VhdlDocGen::DOCUMENT: 02236 return "Doc"; 02237 case VhdlDocGen::UNITS: 02238 return "Units"; 02239 default: 02240 return "Class"; 02241 } 02242 } 02243 02244 QCString VhdlDocGen::trDesignUnitHierarchy() 02245 { 02246 return "Design Unit Hierarchy"; 02247 } 02248 02249 QCString VhdlDocGen::trDesignUnitList() 02250 { 02251 return "Design Unit List"; 02252 } 02253 02254 QCString VhdlDocGen::trDesignUnitMembers() 02255 { 02256 return "Design Unit Members"; 02257 } 02258 02259 QCString VhdlDocGen::trDesignUnitListDescription() 02260 { 02261 return "Here is a list of all design unit members with links to " 02262 "the Entities and Packages they belong to:"; 02263 } 02264 02265 QCString VhdlDocGen::trDesignUnitIndex() 02266 { 02267 return "Design Unit Index"; 02268 } 02269 02270 QCString VhdlDocGen::trDesignUnits() 02271 { 02272 return "Design Units"; 02273 } 02274 02275 QCString VhdlDocGen::trFunctionAndProc() 02276 { 02277 return "Functions/Procedures/Processes"; 02278 } 02279 02280 02281 02283 bool VhdlDocGen::writeDoc(EntryNav* rootNav) 02284 { 02285 Entry *e=rootNav->entry(); 02286 //if (e->section==Entry::Entry::OVERLOADDOC_SEC) 02287 if (stricmp(e->type.data(),"function")==0) 02288 { 02289 VhdlDocGen::addFuncDoc(rootNav); 02290 } 02291 02292 return FALSE; 02293 }// writeDoc 02294 02295 02296 /* do not insert the same component twice */ 02297 02298 bool VhdlDocGen::foundInsertedComponent(const QCString & name,Entry* root) 02299 { 02300 QListIterator<BaseInfo> bii(*root->extends); 02301 BaseInfo *bi=0; 02302 for (bii.toFirst();(bi=bii.current());++bii) 02303 { 02304 if (bi->name==name) 02305 { 02306 return TRUE; // 02307 } 02308 } 02309 02310 return FALSE; 02311 }// found component 02312 02315 void VhdlDocGen::writeStringLink(const MemberDef *mdef,QCString mem, OutputList& ol) 02316 { 02317 if (mdef) 02318 { 02319 ClassDef *cd=mdef->getClassDef(); 02320 if (cd) 02321 { 02322 QCString n=cd->name(); 02323 MemberDef* memdef=VhdlDocGen::findMember(n,mem); 02324 if (memdef && memdef->isLinkable()) 02325 { 02326 ol.startBold(); 02327 writeLink(memdef,ol); 02328 ol.endBold(); 02329 ol.docify(" "); 02330 return; 02331 } 02332 } 02333 } 02334 VhdlDocGen::startFonts(mem,"vhdlchar",ol); 02335 }// found component 02336