|
1 /****************************************************************************** |
|
2 * |
|
3 * Copyright (C) 1997-2008 by Dimitri van Heesch. |
|
4 * |
|
5 * Permission to use, copy, modify, and distribute this software and its |
|
6 * documentation under the terms of the GNU General Public License is hereby |
|
7 * granted. No representations are made about the suitability of this software |
|
8 * for any purpose. It is provided "as is" without express or implied warranty. |
|
9 * See the GNU General Public License for more details. |
|
10 * |
|
11 * Documents produced by Doxygen are derivative works derived from the |
|
12 * input used in their production; they are not affected by this license. |
|
13 * |
|
14 */ |
|
15 /****************************************************************************** |
|
16 * Parser for VHDL subset |
|
17 * written by M. Kreis |
|
18 * supports VHDL-87 |
|
19 * does not support VHDL-AMS |
|
20 ******************************************************************************/ |
|
21 |
|
22 // global includes |
|
23 #include <stdio.h> |
|
24 #include <stdlib.h> |
|
25 #include <assert.h> |
|
26 #include <string.h> |
|
27 #include <qcstring.h> |
|
28 #include <qfileinfo.h> |
|
29 #include <qstringlist.h> |
|
30 |
|
31 /* --------------------------------------------------------------- */ |
|
32 |
|
33 // local includes |
|
34 #include "vhdldocgen.h" |
|
35 #include "message.h" |
|
36 #include "config.h" |
|
37 #include "doxygen.h" |
|
38 #include "util.h" |
|
39 #include "language.h" |
|
40 #include "commentscan.h" |
|
41 #include "index.h" |
|
42 #include "definition.h" |
|
43 #include "searchindex.h" |
|
44 #include "outputlist.h" |
|
45 |
|
46 /* --------------------------------------------------------------- */ |
|
47 |
|
48 //#define theTranslator_vhdlType theTranslator->trVhdlType |
|
49 #define theTranslator_vhdlType VhdlDocGen::trVhdlType |
|
50 |
|
51 static QDict<QCString> g_vhdlKeyDict0(17,FALSE); |
|
52 static QDict<QCString> g_vhdlKeyDict1(17,FALSE); |
|
53 static QDict<QCString> g_vhdlKeyDict2(17,FALSE); |
|
54 |
|
55 static QCString g_vhdlkeyword("vhdlkeyword"); |
|
56 static QCString g_vhdltype("comment"); |
|
57 static QCString g_vhdllogic("vhdllogic"); |
|
58 |
|
59 // keywords |
|
60 static const char* g_vhdlKeyWordMap0[] = |
|
61 { |
|
62 "std","ieee","work","standard","textio","std_logic_1164", |
|
63 "std_logic_arith","std_logic_misc","std_logic_signed","std_logic_textio", |
|
64 "std_logic_unsigned","numeric_bit","numeric_std","math_complex","math_real", |
|
65 "vital_primitives","vital_timing","severity_level","time","delay_length", |
|
66 "natural", "positive", "bit_vector","file_open_kind","file_open_status", |
|
67 "line","text","side", "width","event","rising_edge", "falling_edge", |
|
68 "access","after","alias", "all","architecture","array", "assert","attribute", |
|
69 "begin","block","body", "buffer", "bus", "case", "component", "configuration", |
|
70 "constant", "disconnect", "downto", "else", "elsif", "end", "entity", "exit", |
|
71 "file", "for", "function", "generate", "generic", "group", "guarded", "if", |
|
72 "impure", "in", "inertial", "inout", "is","label", "library", "linkage", |
|
73 "literal", "loop","map", "new", "next", "null", "of", "on", "open", "others", |
|
74 "out", "package", "port", "postponed", "procedure", "process", "pure", |
|
75 "range", "record", "register", "reject", "report", "return","select", |
|
76 "severity", "shared", "signal", "subtype", "then", "to", "transport", |
|
77 "type","unaffected", "units", "until", "use","variable", "wait", "when", |
|
78 "while", "with","true","false","protected",0 |
|
79 }; |
|
80 |
|
81 // type |
|
82 static const char* g_vhdlKeyWordMap1[] = |
|
83 { |
|
84 "natural","unsigned","signed","string","boolean", "bit","character", |
|
85 "std_ulogic","std_ulogic_vector","sTd_logic","std_logic_vector","integer", |
|
86 "real","zzz",0 |
|
87 }; |
|
88 |
|
89 // logic |
|
90 static const char* g_vhdlKeyWordMap2[] = |
|
91 { |
|
92 "abs","and","or","not","mod", "xor","rem","xnor","ror","rol","sla", |
|
93 "sll",0 |
|
94 }; |
|
95 |
|
96 VhdlDocGen::VhdlDocGen() |
|
97 { |
|
98 } |
|
99 |
|
100 VhdlDocGen::~VhdlDocGen() |
|
101 { |
|
102 } |
|
103 |
|
104 void VhdlDocGen::init() |
|
105 { |
|
106 int j=0; |
|
107 g_vhdlKeyDict0.setAutoDelete(TRUE); |
|
108 g_vhdlKeyDict1.setAutoDelete(TRUE); |
|
109 g_vhdlKeyDict2.setAutoDelete(TRUE); |
|
110 |
|
111 j=0; |
|
112 while (g_vhdlKeyWordMap0[j]) |
|
113 { |
|
114 g_vhdlKeyDict0.insert(g_vhdlKeyWordMap0[j], |
|
115 new QCString(g_vhdlKeyWordMap0[j])); |
|
116 j++; |
|
117 } |
|
118 |
|
119 j=0; |
|
120 while (g_vhdlKeyWordMap1[j]) |
|
121 { |
|
122 g_vhdlKeyDict1.insert(g_vhdlKeyWordMap1[j], |
|
123 new QCString(g_vhdlKeyWordMap1[j])); |
|
124 j++; |
|
125 } |
|
126 |
|
127 j=0; |
|
128 while (g_vhdlKeyWordMap2[j]) |
|
129 { |
|
130 g_vhdlKeyDict2.insert(g_vhdlKeyWordMap2[j], |
|
131 new QCString(g_vhdlKeyWordMap2[j])); |
|
132 j++; |
|
133 } |
|
134 |
|
135 }// buildKeyMap |
|
136 |
|
137 /*! |
|
138 * returns the color of a keyword |
|
139 */ |
|
140 |
|
141 QCString* VhdlDocGen::findKeyWord(const QCString& word) |
|
142 { |
|
143 if (word.isEmpty() || word.at(0)=='\0') return 0; |
|
144 //printf("VhdlDocGen::findKeyWord(%s)\n",word.data()); |
|
145 |
|
146 if (g_vhdlKeyDict0.find(word.lower())) |
|
147 return &g_vhdlkeyword; |
|
148 |
|
149 if (g_vhdlKeyDict1.find(word.lower())) |
|
150 return &g_vhdltype; |
|
151 |
|
152 if (g_vhdlKeyDict2.find(word.lower())) |
|
153 return &g_vhdllogic; |
|
154 |
|
155 return 0; |
|
156 } |
|
157 |
|
158 /*! |
|
159 * returns the parsed entry at line xxx |
|
160 */ |
|
161 |
|
162 |
|
163 void VhdlDocGen::debugClassName(ClassSDict* mDict) |
|
164 { |
|
165 // for each class |
|
166 ClassSDict::Iterator cli(*mDict); |
|
167 ClassDef *cd; |
|
168 for ( ; (cd=cli.current()) ; ++cli ) |
|
169 { |
|
170 printf("\n -------------------------class----------------------------------------\n"); |
|
171 |
|
172 QCString nnn=cd->className(); |
|
173 QCString qref=cd->getReference(); |
|
174 QCString outBase=cd->getOutputFileBase(); |
|
175 QCString fileBase=cd->getFileBase(); |
|
176 QCString compType=cd->compoundTypeString(); |
|
177 QCString inDoc=cd->documentation();//->inbodyDocumentation(); |
|
178 printf("\n refernz [%p]",cd); |
|
179 printf("\n compType [%s]",compType.data()); |
|
180 printf("\n Name [%s]",nnn.data()); |
|
181 printf("\n TYPE[%d ",cd->definitionType()); |
|
182 printf("\n Ref [%s] ",qref.data()); |
|
183 printf("\n OutBase [%s] fileBase [%s]",outBase.data(),fileBase.data()); |
|
184 |
|
185 printf("\n -------------------------------------------------------------------\n"); |
|
186 |
|
187 }// for |
|
188 }// Debug Class Name |
|
189 |
|
190 |
|
191 bool found =FALSE; |
|
192 static Entry eMerge; |
|
193 |
|
194 ClassDef *VhdlDocGen::getClass(const char *name) |
|
195 { |
|
196 if (name==0 || name[0]=='\0') return 0; |
|
197 |
|
198 ClassDef *cd=0; |
|
199 QCString temp(name); |
|
200 //temp=temp.lower(); |
|
201 temp=temp.stripWhiteSpace(); |
|
202 cd= Doxygen::classSDict->find(temp.data()); |
|
203 return cd; |
|
204 } |
|
205 |
|
206 /*! |
|
207 * adds architectures to their entity |
|
208 */ |
|
209 void VhdlDocGen::computeVhdlComponentRelations() |
|
210 { |
|
211 ClassSDict::Iterator cli(*Doxygen::classSDict); |
|
212 for (cli.toFirst();cli.current();++cli) |
|
213 { |
|
214 cli.current()->visited=FALSE; |
|
215 ClassDef * cd = cli.current(); |
|
216 if ((VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::ARCHITECTURECLASS) |
|
217 { |
|
218 QCString bName=cd->name(); |
|
219 int i=bName.find("::"); |
|
220 if (i>0) |
|
221 { |
|
222 QCString entityName=bName.left(i); |
|
223 ClassDef *classEntity=Doxygen::classSDict->find(entityName); |
|
224 // entity for architecutre ? |
|
225 if (classEntity) |
|
226 { |
|
227 classEntity->insertBaseClass(cd,bName,Public,Normal,0); |
|
228 cd->insertSubClass(classEntity,Public,Normal,0); |
|
229 } |
|
230 } |
|
231 } |
|
232 } |
|
233 } // computeVhdlComponentRelations |
|
234 |
|
235 |
|
236 /* |
|
237 * returns a reference, if one class [package(body),entity or an architecture is found] |
|
238 */ |
|
239 |
|
240 ClassDef* VhdlDocGen::findComponent(int type) |
|
241 { |
|
242 ClassSDict::Iterator cli(*Doxygen::classSDict); |
|
243 ClassDef *cd=0; |
|
244 |
|
245 for ( ; (cd=cli.current()) ; ++cli ) |
|
246 { |
|
247 if (cd->protection()==type) |
|
248 return cd; |
|
249 } |
|
250 return cd; |
|
251 } |
|
252 |
|
253 ClassDef* VhdlDocGen::getPackageName(const QCString & name) |
|
254 { |
|
255 ClassDef* cd=0; |
|
256 QStringList ql=QStringList::split(".",name,FALSE); |
|
257 cd=getClass(name); |
|
258 |
|
259 return cd; |
|
260 } |
|
261 |
|
262 MemberDef* VhdlDocGen::findMember(const QCString& className, const QCString& memName) |
|
263 { |
|
264 QDict<QCString> packages(17,FALSE); |
|
265 packages.setAutoDelete(TRUE); |
|
266 ClassDef* cd; |
|
267 MemberDef *mdef=0; |
|
268 |
|
269 cd=getClass(className); |
|
270 //printf("VhdlDocGen::findMember(%s,%s)=%p\n",className.data(),memName.data(),cd); |
|
271 if (cd==0) return 0; |
|
272 |
|
273 mdef=VhdlDocGen::findMemberDef(cd,memName,MemberList::variableMembers); |
|
274 if (mdef) return mdef; |
|
275 mdef=VhdlDocGen::findMemberDef(cd,memName,MemberList::pubMethods); |
|
276 if (mdef) return mdef; |
|
277 |
|
278 // nothing found so far |
|
279 // if we are an architecture or package body search in entitiy |
|
280 |
|
281 if ((VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::ARCHITECTURECLASS || |
|
282 (VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::PACKBODYCLASS) |
|
283 { |
|
284 Definition *d = cd->getOuterScope(); |
|
285 // searching upper/lower case names |
|
286 |
|
287 QCString tt=d->name(); |
|
288 ClassDef *ecd =getClass(tt); |
|
289 if (!ecd) |
|
290 { |
|
291 tt=tt.upper(); |
|
292 ecd =getClass(tt); |
|
293 } |
|
294 else if (!ecd) |
|
295 { |
|
296 tt=tt.lower(); |
|
297 ecd =getClass(tt); |
|
298 } |
|
299 |
|
300 if (ecd) //d && d->definitionType()==Definition::TypeClass) |
|
301 { |
|
302 //ClassDef *ecd = (ClassDef*)d; |
|
303 mdef=VhdlDocGen::findMemberDef(ecd,memName,MemberList::variableMembers); |
|
304 if (mdef) return mdef; |
|
305 mdef=VhdlDocGen::findMemberDef(cd,memName,MemberList::pubMethods); |
|
306 if (mdef) return mdef; |
|
307 } |
|
308 //cd=getClass(getClassName(cd)); |
|
309 //if (!cd) return 0; |
|
310 } |
|
311 // nothing found , so we are now searching all included packages |
|
312 VhdlDocGen::findAllPackages(className,packages); |
|
313 //cd=getClass(className.data()); |
|
314 if ((VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::ARCHITECTURECLASS || |
|
315 (VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::PACKBODYCLASS) |
|
316 { |
|
317 Definition *d = cd->getOuterScope(); |
|
318 |
|
319 QCString tt=d->name(); |
|
320 ClassDef *ecd =getClass(tt); |
|
321 if (!ecd) |
|
322 { |
|
323 tt=tt.upper(); |
|
324 ecd =getClass(tt); |
|
325 } |
|
326 if (!ecd) |
|
327 { |
|
328 tt=tt.lower(); |
|
329 ecd =getClass(tt); |
|
330 } |
|
331 |
|
332 if (ecd) //d && d->definitionType()==Definition::TypeClass) |
|
333 { |
|
334 VhdlDocGen::findAllPackages(ecd->className(),packages); |
|
335 } |
|
336 } |
|
337 |
|
338 QDictIterator<QCString> packli(packages); |
|
339 QCString *curString; |
|
340 for (packli.toFirst();(curString=packli.current());++packli) |
|
341 { |
|
342 if (curString) |
|
343 { |
|
344 cd=VhdlDocGen::getPackageName(*curString); |
|
345 if (!cd) |
|
346 { |
|
347 *curString=curString->upper(); |
|
348 cd=VhdlDocGen::getPackageName(*curString); |
|
349 } |
|
350 if (!cd) |
|
351 { |
|
352 *curString=curString->lower(); |
|
353 cd=VhdlDocGen::getPackageName(*curString); |
|
354 } |
|
355 } |
|
356 if (cd) |
|
357 { |
|
358 mdef=VhdlDocGen::findMemberDef(cd,memName,MemberList::variableMembers); |
|
359 if (mdef) return mdef; |
|
360 mdef=VhdlDocGen::findMemberDef(cd,memName,MemberList::pubMethods); |
|
361 if (mdef) return mdef; |
|
362 } |
|
363 } // for |
|
364 return 0; |
|
365 }//findMember |
|
366 |
|
367 /** |
|
368 * This function returns the entity|package |
|
369 * in which the key (type) is found |
|
370 */ |
|
371 |
|
372 MemberDef* VhdlDocGen::findMemberDef(ClassDef* cd,const QCString& key,MemberList::ListType type) |
|
373 { |
|
374 // return cd->getMemberByName(key);//does not work |
|
375 MemberDef *md=0; |
|
376 |
|
377 MemberList *ml= cd->getMemberList(type); |
|
378 if (ml==0) return 0; |
|
379 |
|
380 MemberListIterator fmni(*ml); |
|
381 |
|
382 for (fmni.toFirst();(md=fmni.current());++fmni) |
|
383 { |
|
384 if (stricmp(key.data(),md->name().data())==0) |
|
385 return md; |
|
386 } |
|
387 return 0; |
|
388 }//findMemberDef |
|
389 |
|
390 /*! |
|
391 * finds all included packages of an Entity or Package |
|
392 */ |
|
393 |
|
394 void VhdlDocGen::findAllPackages(const QCString& className,QDict<QCString>& qdict) |
|
395 { |
|
396 ClassDef *cdef=getClass(className); |
|
397 if (cdef) |
|
398 { |
|
399 MemberList *mem=cdef->getMemberList(MemberList::variableMembers); |
|
400 MemberDef *md; |
|
401 |
|
402 if (mem) |
|
403 { |
|
404 MemberListIterator fmni(*mem); |
|
405 for (fmni.toFirst();(md=fmni.current());++fmni) |
|
406 { |
|
407 if (VhdlDocGen::isPackage(md)) |
|
408 { |
|
409 QCString *temp1=new QCString(md->name().data()); |
|
410 //*temp1=temp1->lower(); |
|
411 QCString p(md->name().data()); |
|
412 //p=p.lower(); |
|
413 ClassDef* cd=VhdlDocGen::getPackageName(*temp1); |
|
414 if (cd) |
|
415 { |
|
416 QCString *ss=qdict.find(*temp1); |
|
417 if (ss==0) |
|
418 { |
|
419 qdict.insert(p,temp1); |
|
420 QCString tmp=cd->className(); |
|
421 VhdlDocGen::findAllPackages(tmp,qdict); |
|
422 } |
|
423 else delete temp1; |
|
424 } |
|
425 else delete temp1; |
|
426 } |
|
427 }//for |
|
428 }//if |
|
429 }//cdef |
|
430 }// findAllPackages |
|
431 |
|
432 /*! |
|
433 * returns the function with the matching argument list |
|
434 * is called in vhdlcode.l |
|
435 */ |
|
436 |
|
437 MemberDef* VhdlDocGen::findFunction(const QList<Argument> &ql, |
|
438 const QCString& funcname, |
|
439 const QCString& package, bool type) |
|
440 { |
|
441 MemberDef* mdef=0; |
|
442 int funcType; |
|
443 ClassDef *cdef=getClass(package.data()); |
|
444 if (cdef==0) return 0; |
|
445 |
|
446 if (type) |
|
447 funcType=VhdlDocGen::PROCEDURE; |
|
448 else |
|
449 funcType=VhdlDocGen::FUNCTION; |
|
450 |
|
451 MemberList *mem=cdef->getMemberList(MemberList::pubMethods); |
|
452 |
|
453 if (mem) |
|
454 { |
|
455 MemberListIterator fmni(*mem); |
|
456 for (fmni.toFirst();(mdef=fmni.current());++fmni) |
|
457 { |
|
458 QCString mname=mdef->name(); |
|
459 if ((VhdlDocGen::isProcedure(mdef) || VhdlDocGen::isVhdlFunction(mdef)) && (VhdlDocGen::compareString(funcname,mname)==0)) |
|
460 { |
|
461 LockingPtr<ArgumentList> alp = mdef->argumentList(); |
|
462 |
|
463 // ArgumentList* arg2=mdef->getArgumentList(); |
|
464 if (alp==0) break; |
|
465 ArgumentListIterator ali(*alp.pointer()); |
|
466 ArgumentListIterator ali1(ql); |
|
467 |
|
468 if (ali.count() != ali1.count()) break; |
|
469 |
|
470 Argument *arg,*arg1; |
|
471 int equ=0; |
|
472 |
|
473 for (;(arg=ali.current());++ali) |
|
474 { |
|
475 arg1=ali1.current(); ++ali1; |
|
476 equ+=abs(VhdlDocGen::compareString(arg->type,arg1->type)); |
|
477 |
|
478 QCString s1=arg->type; |
|
479 QCString s2=arg1->type; |
|
480 VhdlDocGen::deleteAllChars(s1,' '); |
|
481 VhdlDocGen::deleteAllChars(s2,' '); |
|
482 equ+=abs(VhdlDocGen::compareString(s1,s2)); |
|
483 s1=arg->attrib; |
|
484 s2=arg1->attrib; |
|
485 VhdlDocGen::deleteAllChars(s1,' '); |
|
486 VhdlDocGen::deleteAllChars(s2,' '); |
|
487 equ+=abs(VhdlDocGen::compareString(s1,s2)); |
|
488 // printf("\n 1. type [%s] name [%s] attrib [%s]",arg->type,arg->name,arg->attrib); |
|
489 // printf("\n 2. type [%s] name [%s] attrib [%s]",arg1->type,arg1->name,arg1->attrib); |
|
490 } // for |
|
491 if (equ==0) return mdef; |
|
492 }//if |
|
493 }//for |
|
494 }//if |
|
495 return mdef; |
|
496 } //findFunction |
|
497 |
|
498 /*! |
|
499 * returns the function with the matching argument list |
|
500 * is called in vhdscan.l |
|
501 */ |
|
502 |
|
503 Entry* VhdlDocGen::findFunction( Entry* root, Entry* func) |
|
504 { |
|
505 //bool found=FALSE; |
|
506 Entry *found=0; |
|
507 int functype=func->spec; |
|
508 EntryListIterator eli(*root->children()); |
|
509 Entry *rt; |
|
510 for (;(rt=eli.current());++eli) |
|
511 { |
|
512 if (rt->spec==functype && VhdlDocGen::compareString(rt->name,func->name)==0 && rt!=func ) |
|
513 { |
|
514 if (VhdlDocGen::compareArgList(func->argList,rt->argList)) |
|
515 { |
|
516 found=rt; |
|
517 return found; |
|
518 } |
|
519 }//if1 |
|
520 if (!found) |
|
521 { |
|
522 found = VhdlDocGen::findFunction(rt,func); |
|
523 } |
|
524 } // for |
|
525 return found; |
|
526 }// findFunction |
|
527 |
|
528 /* |
|
529 * compares two argument list of a fuction|procedure |
|
530 */ |
|
531 |
|
532 bool VhdlDocGen::compareArgList(ArgumentList* l1,ArgumentList* l2) |
|
533 { |
|
534 if (l1== 0 || l2== 0) return FALSE; |
|
535 |
|
536 ArgumentListIterator ali(*l1); |
|
537 ArgumentListIterator ali1(*l2); |
|
538 |
|
539 if (ali.count() != ali1.count()) return FALSE; |
|
540 |
|
541 Argument *arg,*arg1; |
|
542 int equ=0; |
|
543 |
|
544 for (;(arg=ali.current());++ali) |
|
545 { |
|
546 bool found = FALSE; |
|
547 for (ali1.toFirst();(arg1=ali1.current());++ali1) |
|
548 { |
|
549 equ=0; |
|
550 QCString s1=arg->type; |
|
551 QCString s2=arg1->type; |
|
552 VhdlDocGen::deleteAllChars(s1,' '); // remove whitespaces |
|
553 VhdlDocGen::deleteAllChars(s2,' '); |
|
554 equ+=abs(VhdlDocGen::compareString(s1,s2)); |
|
555 s1=arg->attrib; |
|
556 s2=arg1->attrib; |
|
557 VhdlDocGen::deleteAllChars(s1,' '); |
|
558 VhdlDocGen::deleteAllChars(s2,' '); |
|
559 equ+=abs(VhdlDocGen::compareString(s1,s2)); |
|
560 if (equ==0) found=TRUE; |
|
561 } |
|
562 if (!found) return FALSE; |
|
563 } |
|
564 return TRUE; |
|
565 }// compareArgList |
|
566 |
|
567 /* |
|
568 * finds a matching prototype for a function description |
|
569 */ |
|
570 |
|
571 Entry* VhdlDocGen::findFunction(Entry* func) |
|
572 { |
|
573 ClassSDict::Iterator cli(*Doxygen::classSDict); |
|
574 ClassDef *cd; |
|
575 for (;(cd=cli.current());++cli) |
|
576 { |
|
577 MemberList *mf = cd->getMemberList (MemberList::pubMethods); |
|
578 if (mf) |
|
579 { |
|
580 MemberListIterator fmni(*mf); |
|
581 MemberDef *mdd; |
|
582 for (fmni.toFirst();(mdd=fmni.current());++fmni) |
|
583 { |
|
584 int type=mdd->getMemberSpecifiers(); |
|
585 if (type==VhdlDocGen::PROCEDURE || type==VhdlDocGen::FUNCTION) |
|
586 { |
|
587 QCString nnk=mdd->name(); |
|
588 QCString ff=func->name; |
|
589 |
|
590 if (stricmp(mdd->name(),ff.data())==0) |
|
591 { |
|
592 LockingPtr< ArgumentList > lp=mdd->argumentList(); |
|
593 ArgumentList *l=lp.pointer(); |
|
594 if (VhdlDocGen::compareArgList(l,func->argList)) |
|
595 { |
|
596 mdd->setDocumentation(func->doc.data(),func->docFile.data(),func->docLine,TRUE); |
|
597 mdd->setBriefDescription(func->brief,func->briefFile,func->briefLine); |
|
598 addMemberToGroups(func,mdd);// do not forget grouping! |
|
599 return func; |
|
600 } |
|
601 } |
|
602 } |
|
603 } |
|
604 }// if |
|
605 }//for |
|
606 return 0; |
|
607 }// findFunction |
|
608 |
|
609 /* |
|
610 * adds the documentation for a function|procedure |
|
611 */ |
|
612 |
|
613 void VhdlDocGen::addFuncDoc(EntryNav* rootNav) |
|
614 { |
|
615 Entry *root = rootNav->entry(); |
|
616 if (root && root->spec==VhdlDocGen::DOCUMENT) |
|
617 { |
|
618 Entry *func=VhdlDocGen::findFunction(root); |
|
619 if (!func && Config_getBool("WARNINGS")) |
|
620 { |
|
621 warn(root->fileName,root->docLine, |
|
622 "Warning: documentation for unknown function %s found.\n", |
|
623 root->name.data() |
|
624 ); |
|
625 } |
|
626 } |
|
627 }// AddFuncDoc |
|
628 |
|
629 /*! |
|
630 * returns the class title+ref |
|
631 */ |
|
632 |
|
633 QCString VhdlDocGen::getClassTitle(const ClassDef *cd) |
|
634 { |
|
635 QCString pageTitle; |
|
636 if (cd==0) return ""; |
|
637 pageTitle+=cd->displayName(); |
|
638 pageTitle=VhdlDocGen::getClassName(cd); |
|
639 int ii=cd->protection(); |
|
640 pageTitle+=" "; |
|
641 pageTitle+=theTranslator_vhdlType(ii+2,TRUE); |
|
642 pageTitle+=" "; |
|
643 return pageTitle; |
|
644 } // getClassTitle |
|
645 |
|
646 /* returns the class name without their prefixes */ |
|
647 |
|
648 QCString VhdlDocGen::getClassName(const ClassDef* cd) |
|
649 { |
|
650 QCString temp; |
|
651 if (cd==0) return ""; |
|
652 |
|
653 if ((VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::PACKBODYCLASS) |
|
654 { |
|
655 temp=cd->name(); |
|
656 temp.stripPrefix("_"); |
|
657 return temp; |
|
658 } |
|
659 //if ((VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::ARCHITECTURECLASS) |
|
660 //{ |
|
661 // QStringList qlist=QStringList::split("-",cd->className(),FALSE); |
|
662 // if (qlist.count()>1) |
|
663 // return (QCString)qlist[1]; |
|
664 // return ""; |
|
665 //} |
|
666 return substitute(cd->className(),"::","."); |
|
667 } |
|
668 |
|
669 /*! |
|
670 * writes an inline link form entity|package to architecture|package body and vice verca |
|
671 */ |
|
672 |
|
673 void VhdlDocGen::writeInlineClassLink(const ClassDef* cd ,OutputList& ol) |
|
674 { |
|
675 QList<QCString> ql; |
|
676 ql.setAutoDelete(TRUE); |
|
677 QCString nn=cd->className(); |
|
678 int ii=(int)cd->protection()+2; |
|
679 |
|
680 QCString type; |
|
681 if (ii==VhdlDocGen::ENTITY) |
|
682 type+=theTranslator_vhdlType(VhdlDocGen::ARCHITECTURE,TRUE); |
|
683 else if (ii==VhdlDocGen::ARCHITECTURE) |
|
684 type+=theTranslator_vhdlType(VhdlDocGen::ENTITY,TRUE); |
|
685 else if (ii==VhdlDocGen::PACKAGE_BODY) |
|
686 type+=theTranslator_vhdlType(VhdlDocGen::PACKAGE,TRUE); |
|
687 else if (ii==VhdlDocGen::PACKAGE) |
|
688 type+=theTranslator_vhdlType(VhdlDocGen::PACKAGE_BODY,TRUE); |
|
689 else |
|
690 type+=""; |
|
691 |
|
692 //type=type.lower(); |
|
693 type+=" >> "; |
|
694 ol.disable(OutputGenerator::RTF); |
|
695 ol.disable(OutputGenerator::Man); |
|
696 ol.lineBreak(); |
|
697 ol.lineBreak(); |
|
698 |
|
699 if (ii==VhdlDocGen::PACKAGE_BODY) |
|
700 { |
|
701 nn.stripPrefix("_"); |
|
702 cd=getClass(nn.data()); |
|
703 } |
|
704 else if (ii==VhdlDocGen::PACKAGE) |
|
705 { |
|
706 nn.prepend("_"); |
|
707 cd=getClass(nn.data()); |
|
708 } |
|
709 else if (ii==VhdlDocGen::ARCHITECTURE) |
|
710 { |
|
711 QStringList qlist=QStringList::split("-",nn,FALSE); |
|
712 nn=qlist[1]; |
|
713 cd=VhdlDocGen::getClass(nn.data()); |
|
714 } |
|
715 |
|
716 QCString opp; |
|
717 if (ii==VhdlDocGen::ENTITY) |
|
718 { |
|
719 VhdlDocGen::findAllArchitectures(ql,cd); |
|
720 int j=ql.count(); |
|
721 for (int i=0;i<j;i++) |
|
722 { |
|
723 QCString *temp=ql.at(i); |
|
724 QStringList qlist=QStringList::split("-",*temp,FALSE); |
|
725 QCString s1=(QCString)qlist[0]; |
|
726 QCString s2=(QCString)qlist[1]; |
|
727 s1.stripPrefix("_"); |
|
728 if (j==1) s1.resize(0); |
|
729 ClassDef*cc = getClass(temp->data()); |
|
730 if (cc) |
|
731 { |
|
732 VhdlDocGen::writeVhdlLink(cc,ol,type,s2,s1); |
|
733 } |
|
734 } |
|
735 } |
|
736 else |
|
737 { |
|
738 VhdlDocGen::writeVhdlLink(cd,ol,type,nn,opp); |
|
739 } |
|
740 |
|
741 ol.enable(OutputGenerator::Man); |
|
742 ol.enable(OutputGenerator::RTF); |
|
743 |
|
744 }// write |
|
745 |
|
746 /* |
|
747 * finds all architectures which belongs to an entiy |
|
748 */ |
|
749 void VhdlDocGen::findAllArchitectures(QList<QCString>& qll,const ClassDef *cd) |
|
750 { |
|
751 ClassDef *citer; |
|
752 ClassSDict::Iterator cli(*Doxygen::classSDict); |
|
753 for ( ; (citer=cli.current()) ; ++cli ) |
|
754 { |
|
755 QCString jj=citer->className(); |
|
756 if (cd != citer && jj.contains('-')!=-1) |
|
757 { |
|
758 QStringList ql=QStringList::split("-",jj,FALSE); |
|
759 QCString temp=(QCString)ql[1]; |
|
760 if (stricmp(cd->className().data(),temp.data())==0) |
|
761 { |
|
762 QCString *cl=new QCString(jj.data()); |
|
763 qll.insert(0,cl); |
|
764 } |
|
765 } |
|
766 }// for |
|
767 }//findAllArchitectures |
|
768 |
|
769 /* |
|
770 * writes the link entity >> .... or architecture >> ... |
|
771 */ |
|
772 |
|
773 void VhdlDocGen::writeVhdlLink(const ClassDef* ccd ,OutputList& ol,QCString& type,QCString& nn,QCString& behav) |
|
774 { |
|
775 if (ccd==0) return; |
|
776 QCString temp=ccd->getOutputFileBase(); |
|
777 ol.startBold(); |
|
778 ol.docify(type.data()); |
|
779 ol.endBold(); |
|
780 nn.stripPrefix("_"); |
|
781 ol.writeObjectLink(ccd->getReference(),ccd->getOutputFileBase(),0,nn.data()); |
|
782 |
|
783 if (!behav.isEmpty()) |
|
784 { |
|
785 behav.prepend(" "); |
|
786 ol.startBold(); |
|
787 ol.docify(behav.data()); |
|
788 ol.endBold(); |
|
789 } |
|
790 /* |
|
791 if (Config_getBool("SOURCE_BROWSER")) { // writes a source link for latex docu |
|
792 ol.pushGeneratorState(); |
|
793 ol.disableAllBut(OutputGenerator::Latex); |
|
794 ol.docify(" | "); |
|
795 ol.startEmphasis(); |
|
796 FileDef* fd=ccd->getFileDef(); |
|
797 if (fd) |
|
798 ol.writeObjectLink(0,fd->getSourceFileBase(),0,theTranslator->trGotoSourceCode().data()); |
|
799 ol.endEmphasis(); |
|
800 ol.popGeneratorState(); |
|
801 } |
|
802 */ |
|
803 ol.lineBreak(); |
|
804 } |
|
805 |
|
806 bool VhdlDocGen::compareString(const QCString& s1,const QCString& s2) |
|
807 { |
|
808 QCString str1=s1.stripWhiteSpace(); |
|
809 QCString str2=s2.stripWhiteSpace(); |
|
810 |
|
811 return stricmp(str1.data(),str2.data()); |
|
812 } |
|
813 |
|
814 bool VhdlDocGen::getSigTypeName(QList<QCString>& ql, const char* str,QCString& buffer) |
|
815 { |
|
816 //QCString temp(str); |
|
817 //QStringList qlist=QStringList::split(" is ",temp,FALSE); |
|
818 //if (qlist.count()!=2) return FALSE; |
|
819 //temp.resize(0); |
|
820 //temp+=(QCString)qlist[0]+":"+(QCString)qlist[1]; |
|
821 //return VhdlDocGen::getSigName(ql,temp.data(),buffer); |
|
822 return VhdlDocGen::getSigName(ql,str,buffer); |
|
823 } |
|
824 |
|
825 /*! |
|
826 * divides a port input in its name,direction and type |
|
827 * @param ql stores the input name(s) |
|
828 * @param str input string |
|
829 * @param buffer stores the input direction |
|
830 * @returns FALSE if it is a port |
|
831 */ |
|
832 |
|
833 bool VhdlDocGen::getSigName(QList<QCString>& ql, |
|
834 const char* str,QCString& buffer) |
|
835 { |
|
836 int j,ll,index; |
|
837 const char *signal = "signal "; |
|
838 QCString qmem; |
|
839 QCString temp(str); |
|
840 QCString st(str); |
|
841 |
|
842 //QRegExp semi(","); |
|
843 //QRegExp r(":"); |
|
844 |
|
845 // colon position |
|
846 j = temp.find(':'); |
|
847 if (j < 0) return FALSE; // no input definition |
|
848 st=st.left(j); // name only |
|
849 index=st.find(signal,0,FALSE); |
|
850 if (index > -1) // found "signal " |
|
851 { |
|
852 qmem=st.remove(index,strlen(signal)); // strip it |
|
853 temp=qmem; |
|
854 st=qmem; |
|
855 } |
|
856 else |
|
857 { |
|
858 qmem=temp; |
|
859 } |
|
860 |
|
861 ll=st.find(','); |
|
862 |
|
863 if (ll>0) // multiple names |
|
864 { |
|
865 while (TRUE) |
|
866 { |
|
867 st=st.left(ll).stripWhiteSpace(); // one name |
|
868 |
|
869 QCString *sig =new QCString(st); |
|
870 ql.insert(0,sig); |
|
871 qmem=qmem.right(qmem.length()-ll-1); // strip from list |
|
872 st=qmem; // remainder |
|
873 ll=st.find(','); |
|
874 if (ll<0) // last name |
|
875 { |
|
876 ll = st.find(':'); |
|
877 st=st.left(ll).stripWhiteSpace(); |
|
878 ql.insert(0,new QCString(st)); |
|
879 break; |
|
880 } |
|
881 } |
|
882 } |
|
883 else // single name |
|
884 { |
|
885 st=st.stripWhiteSpace(); |
|
886 ql.insert(0,new QCString(st)); |
|
887 } |
|
888 QCString *qdir=new QCString(str); |
|
889 st=qdir->mid(j+1); // part after : |
|
890 st=st.lower().stripWhiteSpace(); |
|
891 *qdir=st; |
|
892 ql.insert(0,qdir); |
|
893 |
|
894 if (st.stripPrefix("inout")) |
|
895 { |
|
896 buffer+="inout"; |
|
897 return TRUE; |
|
898 } |
|
899 if (st.stripPrefix("INOUT")) |
|
900 { |
|
901 buffer+="inout"; |
|
902 return TRUE; |
|
903 } |
|
904 |
|
905 if (st.stripPrefix("out")) |
|
906 { |
|
907 buffer+="out"; |
|
908 return TRUE; |
|
909 } |
|
910 if (st.stripPrefix("OUT")) |
|
911 { |
|
912 buffer+="out"; |
|
913 return TRUE; |
|
914 } |
|
915 |
|
916 if (st.stripPrefix("in")) |
|
917 { |
|
918 buffer+="in"; |
|
919 return TRUE; |
|
920 } |
|
921 if (st.stripPrefix("IN")) |
|
922 { |
|
923 buffer+="in"; |
|
924 return TRUE; |
|
925 } |
|
926 return FALSE; |
|
927 } |
|
928 |
|
929 /*! |
|
930 * divides a process string in its name and types |
|
931 * @param text process text |
|
932 * @param name points to the process name |
|
933 * @param ql stores the process types |
|
934 */ |
|
935 |
|
936 void VhdlDocGen::parseProcessProto(const char* text, |
|
937 QCString& name,QStringList& ql) |
|
938 { |
|
939 int index,end; |
|
940 const char *s=":"; |
|
941 QCString temp; |
|
942 QCString s1(text); |
|
943 index=s1.find(s,0,FALSE); |
|
944 if (index >=0) |
|
945 { |
|
946 name=s1.left(index); |
|
947 // strcpy(name,tt.data()); |
|
948 } |
|
949 |
|
950 index=s1.find("(",0,FALSE); |
|
951 end=s1.findRev(")",s1.length(),FALSE); |
|
952 // end=s1.find(")",0,FALSE); |
|
953 |
|
954 if ((end-index)>1) |
|
955 { |
|
956 temp=s1.mid(index+1,(end-index-1)); |
|
957 ql=QStringList::split(",",temp,FALSE); |
|
958 } |
|
959 }//parseProcessProto |
|
960 |
|
961 /*! |
|
962 * strips the "--" prefixes of vhdl comments |
|
963 */ |
|
964 void VhdlDocGen::prepareComment(QCString& qcs) |
|
965 { |
|
966 QCString temp; |
|
967 const char* s="--!"; |
|
968 //const char *start="--!{"; |
|
969 //const char *end="--!}"; |
|
970 int index=0; |
|
971 |
|
972 #if 0 |
|
973 index=qcs.find(start,0,TRUE); |
|
974 if (index>0) |
|
975 temp=qcs.remove(index,strlen(start)); |
|
976 qcs=temp; |
|
977 |
|
978 index=qcs.find(end,0,TRUE); |
|
979 if (index>0) |
|
980 temp=qcs.remove(index,strlen(end)); |
|
981 qcs=temp; |
|
982 #endif |
|
983 while (TRUE) |
|
984 { |
|
985 index=qcs.find(s,0,TRUE); |
|
986 if (index<0) break; |
|
987 temp=qcs.remove(index,strlen(s)); |
|
988 qcs=temp; |
|
989 } |
|
990 qcs=qcs.stripWhiteSpace(); |
|
991 } |
|
992 |
|
993 |
|
994 /*! |
|
995 * parses a function proto |
|
996 * @param text function string |
|
997 * @param qlist stores the function types |
|
998 * @param name points to the function name |
|
999 * @param ret Stores the return type |
|
1000 * @param doc ??? |
|
1001 */ |
|
1002 void VhdlDocGen::parseFuncProto(const char* text,QList<Argument>& qlist, |
|
1003 QCString& name,QCString& ret,bool doc) |
|
1004 { |
|
1005 int index,end; |
|
1006 QCString s1(text); |
|
1007 QCString temp; |
|
1008 |
|
1009 index=s1.find("("); |
|
1010 end=s1.findRev(")"); |
|
1011 |
|
1012 if ((end-index)>0) |
|
1013 { |
|
1014 QCString tt=s1.mid(index,(end-index+1)); |
|
1015 temp=s1.mid(index+1,(end-index-1)); |
|
1016 getFuncParams(qlist,temp); |
|
1017 } |
|
1018 if (doc) |
|
1019 { |
|
1020 name=s1.left(index); |
|
1021 name=name.stripWhiteSpace(); |
|
1022 if ((end-index)>0) |
|
1023 { |
|
1024 ret="function"; |
|
1025 } |
|
1026 return; |
|
1027 } |
|
1028 else |
|
1029 { |
|
1030 QCString s1(text); |
|
1031 s1=s1.stripWhiteSpace(); |
|
1032 int i=s1.find("(",0,FALSE); |
|
1033 int s=s1.find(QRegExp("[ \\t]")); |
|
1034 if (i==-1 || i<s) |
|
1035 s1=VhdlDocGen::getIndexWord(s1.data(),1); |
|
1036 else // s<i, s=start of name, i=end of name |
|
1037 s1=s1.mid(s,(i-s)); |
|
1038 |
|
1039 name=s1.stripWhiteSpace(); |
|
1040 } |
|
1041 index=s1.findRev("return",-1,FALSE); |
|
1042 if (index !=-1) |
|
1043 { |
|
1044 ret=s1.mid(index+6,s1.length()); |
|
1045 ret=ret.stripWhiteSpace(); |
|
1046 VhdlDocGen::deleteCharRev(ret,';'); |
|
1047 } |
|
1048 } |
|
1049 |
|
1050 /* |
|
1051 * returns the n'th word of a string |
|
1052 */ |
|
1053 |
|
1054 QCString VhdlDocGen::getIndexWord(const char* c,int index) |
|
1055 { |
|
1056 QStringList ql; |
|
1057 QCString temp(c); |
|
1058 QRegExp reg("[\\s]"); |
|
1059 |
|
1060 ql=QStringList::split(reg,temp,FALSE); |
|
1061 |
|
1062 if (ql.count() > (unsigned int)index) |
|
1063 { |
|
1064 return (QCString)ql[index]; |
|
1065 } |
|
1066 |
|
1067 return ""; |
|
1068 } |
|
1069 |
|
1070 |
|
1071 /*! |
|
1072 * \brief returns the arguments of a function or procedure prototype |
|
1073 * @param ql list ql stores the arguments |
|
1074 * @param str prototype |
|
1075 */ |
|
1076 |
|
1077 void VhdlDocGen::getFuncParams(QList<Argument>& ql, const char* str) |
|
1078 { |
|
1079 |
|
1080 int len; |
|
1081 QCString qmem,s1,s2,ttype; |
|
1082 QCString temp(str); |
|
1083 temp=temp.stripWhiteSpace(); |
|
1084 if (temp.isEmpty()) return; |
|
1085 |
|
1086 QCString st(str); |
|
1087 QStringList strList; |
|
1088 |
|
1089 strList=QStringList::split(";",temp,FALSE); |
|
1090 int kk=strList.count(); |
|
1091 int j=kk; |
|
1092 while (kk>=1) |
|
1093 { |
|
1094 temp=strList[j-kk]; |
|
1095 QStringList tempList,tt; |
|
1096 tempList=QStringList::split(":",temp,FALSE); |
|
1097 if (tempList.count()>2) |
|
1098 ttype=tempList[1]; |
|
1099 else |
|
1100 ttype=tempList.last(); |
|
1101 |
|
1102 ttype=ttype.stripWhiteSpace(); |
|
1103 |
|
1104 uint zui=ttype.contains('(',FALSE); |
|
1105 if (zui == 0) |
|
1106 { |
|
1107 tt=QStringList::split(QRegExp("[\\s]"),ttype,FALSE); |
|
1108 } |
|
1109 else |
|
1110 { |
|
1111 if (ttype.stripPrefix("in")) |
|
1112 tt.append("in"); |
|
1113 else if (ttype.stripPrefix("out")) |
|
1114 tt.append("out"); |
|
1115 else if (ttype.stripPrefix("inout")) |
|
1116 tt.append("inout"); |
|
1117 if (ttype.stripPrefix("IN")) |
|
1118 tt.append("in"); |
|
1119 else if (ttype.stripPrefix("OUT")) |
|
1120 tt.append("out"); |
|
1121 else if (ttype.stripPrefix("INOUT")) |
|
1122 tt.append("inout"); |
|
1123 |
|
1124 ttype=ttype.stripWhiteSpace(); |
|
1125 tt.append(ttype); |
|
1126 } |
|
1127 |
|
1128 s1=tt.first(); |
|
1129 //s1=s1.lower(); |
|
1130 |
|
1131 if (tempList.count()>2) |
|
1132 s2=tt.last()+":"+tempList[2]; |
|
1133 else |
|
1134 s2=tt.last(); |
|
1135 |
|
1136 QCString first=(QCString)tempList.first(); |
|
1137 |
|
1138 tempList.clear(); |
|
1139 tt.clear(); |
|
1140 |
|
1141 tempList=QStringList::split(",",first,FALSE); |
|
1142 len=tempList.count(); |
|
1143 ttype.resize(0); |
|
1144 for (int j=0;j<len;j++) |
|
1145 { |
|
1146 Argument *arg=new Argument; |
|
1147 QCString name=(QCString)tempList[j]; |
|
1148 name=name.stripWhiteSpace(); |
|
1149 |
|
1150 tt=QStringList::split(QRegExp("[\\s]"),name,FALSE); |
|
1151 if (tt.count() > 1) |
|
1152 ttype=(tt.first()).stripWhiteSpace(); |
|
1153 |
|
1154 arg->defval=ttype.copy(); |
|
1155 arg->type=s2.stripWhiteSpace(); |
|
1156 arg->attrib=s1.stripWhiteSpace(); |
|
1157 arg->name=(tt.last()).stripWhiteSpace(); |
|
1158 |
|
1159 // printf("--proto \n [%s] [%s] [%s] [%s] [%s]",ttype.data(),arg->type.data(),arg->attrib.data(),arg->name.data(),s1.data()); |
|
1160 ql.append(arg); |
|
1161 } |
|
1162 kk--; |
|
1163 }//while |
|
1164 } // getFuncName |
|
1165 |
|
1166 |
|
1167 QCString VhdlDocGen::trTypeString(int type) |
|
1168 { |
|
1169 switch(type) |
|
1170 { |
|
1171 case VhdlDocGen::LIBRARY: return "Library"; |
|
1172 case VhdlDocGen::ENTITY: return "Entity"; |
|
1173 case VhdlDocGen::PACKAGE_BODY: return "Package Body"; |
|
1174 case VhdlDocGen::ATTRIBUTE: return "Attribute"; |
|
1175 case VhdlDocGen::PACKAGE: return "Package"; |
|
1176 case VhdlDocGen::SIGNAL: return "Signal"; |
|
1177 case VhdlDocGen::COMPONENT: return "Component"; |
|
1178 case VhdlDocGen::CONSTANT: return "Constant"; |
|
1179 case VhdlDocGen::TYPE: return "Type"; |
|
1180 case VhdlDocGen::SUBTYPE: return "Subtype"; |
|
1181 case VhdlDocGen::FUNCTION: return "Function"; |
|
1182 case VhdlDocGen::RECORD: return "Record"; |
|
1183 case VhdlDocGen::PROCEDURE: return "Procedure"; |
|
1184 case VhdlDocGen::ARCHITECTURE: return "Architecture"; |
|
1185 case VhdlDocGen::USE: return "Package"; |
|
1186 case VhdlDocGen::PROCESS: return "Process"; |
|
1187 case VhdlDocGen::PORT: return "Port"; |
|
1188 case VhdlDocGen::GENERIC: return "Generic"; |
|
1189 case VhdlDocGen::DOCUMENT: return "Doc"; |
|
1190 case VhdlDocGen::UNITS: return "Units"; |
|
1191 //case VhdlDocGen::PORTMAP: return "Port Map"; |
|
1192 case VhdlDocGen::SHAREDVARIABLE: return "Shared Variable"; |
|
1193 case VhdlDocGen::GROUP: return "Group"; |
|
1194 case VhdlDocGen::VFILE: return "File"; |
|
1195 case VhdlDocGen::COMPONENT_INST: return "Component Instantiation"; |
|
1196 case VhdlDocGen::ALIAS: return "Alias"; |
|
1197 case VhdlDocGen::CONFIG: return "Configuration"; |
|
1198 default: return ""; |
|
1199 } |
|
1200 } // convertType |
|
1201 |
|
1202 /*! |
|
1203 * deletes a char backwards in a string |
|
1204 */ |
|
1205 |
|
1206 bool VhdlDocGen::deleteCharRev(QCString &s,char c) |
|
1207 { |
|
1208 int index=s.findRev(c,-1,FALSE); |
|
1209 if (index > -1) |
|
1210 { |
|
1211 QString qcs=s.remove(index,1); |
|
1212 s=qcs; |
|
1213 return TRUE; |
|
1214 } |
|
1215 return FALSE; |
|
1216 } |
|
1217 |
|
1218 void VhdlDocGen::deleteAllChars(QCString &s,char c) |
|
1219 { |
|
1220 int index=s.findRev(c,-1,FALSE); |
|
1221 while (index > -1) |
|
1222 { |
|
1223 QString qcs=s.remove(index,1); |
|
1224 s=qcs; |
|
1225 index=s.findRev(c,-1,FALSE); |
|
1226 } |
|
1227 } |
|
1228 |
|
1229 |
|
1230 static int recordCounter=0; |
|
1231 |
|
1232 /*! |
|
1233 * returns the next number of a record|unit member |
|
1234 */ |
|
1235 |
|
1236 QCString VhdlDocGen::getRecordNumber() |
|
1237 { |
|
1238 char buf[12]; |
|
1239 sprintf(buf,"%d",recordCounter++); |
|
1240 QCString qcs(&buf[0]); |
|
1241 return qcs; |
|
1242 } |
|
1243 |
|
1244 /*! |
|
1245 * returns the next number of an anonymous process |
|
1246 */ |
|
1247 |
|
1248 QCString VhdlDocGen::getProcessNumber() |
|
1249 { |
|
1250 static int stringCounter; |
|
1251 char buf[8]; |
|
1252 QCString qcs("PROCESS_"); |
|
1253 sprintf(buf,"%d",stringCounter++); |
|
1254 qcs.append(&buf[0]); |
|
1255 return qcs; |
|
1256 } |
|
1257 |
|
1258 /*! |
|
1259 * writes a colored and formatted string |
|
1260 */ |
|
1261 |
|
1262 void VhdlDocGen::writeFormatString(QCString& qcs,OutputList&ol,const MemberDef* mdef) |
|
1263 { |
|
1264 QRegExp reg("[\\/\\:\\<\\>\\:\\s\\,\\;\\'\\+\\-\\*\\|\\&\\=\\(\\)\"]"); |
|
1265 qcs+=QCString(" ");// parsing the last sign |
|
1266 QCString *ss; |
|
1267 QCString find=qcs; |
|
1268 QCString temp=qcs; |
|
1269 char buf[2]; |
|
1270 buf[1]='\0'; |
|
1271 |
|
1272 int j; |
|
1273 int len; |
|
1274 j = reg.match(temp.data(),0,&len); |
|
1275 |
|
1276 ol.startBold(); |
|
1277 if (j>=0) |
|
1278 { |
|
1279 while (j>=0) |
|
1280 { |
|
1281 find=find.left(j); |
|
1282 buf[0]=temp[j]; |
|
1283 ss=VhdlDocGen::findKeyWord(find); |
|
1284 bool k=VhdlDocGen::isNumber(find); // is this a number |
|
1285 if (k) |
|
1286 { |
|
1287 VhdlDocGen::startFonts(find,"vhdldigit",ol); |
|
1288 } |
|
1289 else if (j != 0 && ss) |
|
1290 { |
|
1291 VhdlDocGen::startFonts(find,ss->data(),ol); |
|
1292 } |
|
1293 else |
|
1294 { |
|
1295 if (j>0) |
|
1296 { |
|
1297 VhdlDocGen::writeStringLink(mdef,find,ol); |
|
1298 } |
|
1299 } |
|
1300 VhdlDocGen::startFonts(&buf[0],"vhdlchar",ol); |
|
1301 |
|
1302 QCString st=temp.remove(0,j+1); |
|
1303 find=st; |
|
1304 temp=st; |
|
1305 j = reg.match(temp.data(),0,&len); |
|
1306 }//while |
|
1307 }//if |
|
1308 else |
|
1309 { |
|
1310 VhdlDocGen::startFonts(find,"vhdlchar",ol); |
|
1311 } |
|
1312 ol.endBold(); |
|
1313 }// writeFormatString |
|
1314 |
|
1315 /*! |
|
1316 * returns TRUE if this string is a number |
|
1317 */ |
|
1318 |
|
1319 bool VhdlDocGen::isNumber(const QCString& s) |
|
1320 { |
|
1321 // static bool veriOpt=Config_getBool("OPTIMIZE_OUTPUT_VERILOG"); |
|
1322 static QRegExp regg("[0-9][0-9eEfFbBcCdDaA_.#-]*"); |
|
1323 |
|
1324 if (s.isEmpty()) return false; |
|
1325 int j,len; |
|
1326 j = regg.match(s.data(),0,&len); |
|
1327 if ((j==0) && (len==(int)s.length())) return true; |
|
1328 return false; |
|
1329 |
|
1330 #if 0 |
|
1331 int len=s.length(); |
|
1332 if (len==0) return FALSE; |
|
1333 for (int j=0;j<len;j++) |
|
1334 { |
|
1335 if (isdigit((int)(s.at(j) & 0xff))==0) |
|
1336 return FALSE; |
|
1337 } |
|
1338 return TRUE; |
|
1339 #endif |
|
1340 }// isNumber |
|
1341 |
|
1342 void VhdlDocGen::startFonts(const QCString& q, const char *keyword,OutputList& ol) |
|
1343 { |
|
1344 ol.startFontClass(keyword); |
|
1345 ol.docify(q.data()); |
|
1346 ol.endFontClass(); |
|
1347 } |
|
1348 |
|
1349 /*! |
|
1350 * inserts white spaces for better readings |
|
1351 * and writes a colored string to the output |
|
1352 */ |
|
1353 |
|
1354 void VhdlDocGen::formatString(QCString & qcs, OutputList& ol,const MemberDef* mdef) |
|
1355 { |
|
1356 QCString temp(qcs.length()); |
|
1357 qcs.stripPrefix(":"); |
|
1358 qcs.stripPrefix("is"); |
|
1359 qcs.stripPrefix("IS"); |
|
1360 qcs.stripPrefix("of"); |
|
1361 qcs.stripPrefix("OF"); |
|
1362 |
|
1363 VhdlDocGen::deleteCharRev(qcs,';'); |
|
1364 //char white='\t'; |
|
1365 int len = qcs.length(); |
|
1366 unsigned int index=1;//temp.length(); |
|
1367 |
|
1368 for (int j=0;j<len;j++) |
|
1369 { |
|
1370 char c=qcs[j]; |
|
1371 char b=c; |
|
1372 if (j>0) b=qcs[j-1]; |
|
1373 if (c=='"' || c==',' || c==';' || c=='\''|| c=='(' || c==')' || c==':' ) // || (c==':' && b!='=')) // || (c=='=' && b!='>')) |
|
1374 { |
|
1375 if (temp.at(index-1) != ' ') |
|
1376 { |
|
1377 temp+=" "; |
|
1378 } |
|
1379 temp+=c; |
|
1380 temp+=" "; |
|
1381 } |
|
1382 else if (c=='=') |
|
1383 { |
|
1384 if (b==':') // := operator |
|
1385 { |
|
1386 temp.replace(index-1,1,"="); |
|
1387 temp+=" "; |
|
1388 } |
|
1389 else // = operator |
|
1390 { |
|
1391 temp+=" "; |
|
1392 temp+=c; |
|
1393 temp+=" "; |
|
1394 } |
|
1395 } |
|
1396 else |
|
1397 { |
|
1398 temp+=c; |
|
1399 } |
|
1400 |
|
1401 index=temp.length(); |
|
1402 }// for |
|
1403 temp=temp.stripWhiteSpace(); |
|
1404 // printf("\n [%s]",qcs.data()); |
|
1405 VhdlDocGen::writeFormatString(temp,ol,mdef); |
|
1406 } |
|
1407 |
|
1408 /*! |
|
1409 * writes a procedure prototype to the output |
|
1410 */ |
|
1411 |
|
1412 void VhdlDocGen::writeProcedureProto(OutputList& ol,const ArgumentList* al,const MemberDef* mdef) |
|
1413 { |
|
1414 ArgumentListIterator ali(*al); |
|
1415 Argument *arg; |
|
1416 bool sem=FALSE; |
|
1417 int len=al->count(); |
|
1418 ol.docify("( "); |
|
1419 if (len > 2) |
|
1420 { |
|
1421 ol.lineBreak(); |
|
1422 } |
|
1423 for (;(arg=ali.current());++ali) |
|
1424 { |
|
1425 ol.startBold(); |
|
1426 if (sem && len <3) |
|
1427 ol.writeChar(','); |
|
1428 |
|
1429 QCString nn=arg->name; |
|
1430 nn+=": "; |
|
1431 |
|
1432 QCString *str=VhdlDocGen::findKeyWord(arg->defval); |
|
1433 arg->defval+=" "; |
|
1434 if (str) |
|
1435 { |
|
1436 VhdlDocGen::startFonts(arg->defval,str->data(),ol); |
|
1437 } |
|
1438 else |
|
1439 { |
|
1440 VhdlDocGen::startFonts(arg->defval,"vhdlchar",ol); // write type (variable,constant etc.) |
|
1441 } |
|
1442 |
|
1443 VhdlDocGen::startFonts(nn,"vhdlchar",ol); // write name |
|
1444 if (stricmp(arg->attrib.data(),arg->type.data()) != 0) |
|
1445 VhdlDocGen::startFonts(arg->attrib.lower(),"stringliteral",ol); // write in|out |
|
1446 ol.docify(" "); |
|
1447 VhdlDocGen::formatString(arg->type,ol,mdef); |
|
1448 sem=TRUE; |
|
1449 ol.endBold(); |
|
1450 if (len > 2) |
|
1451 { |
|
1452 ol.lineBreak(); |
|
1453 ol.docify(" "); |
|
1454 } |
|
1455 }//for |
|
1456 |
|
1457 ol.docify(" )"); |
|
1458 |
|
1459 |
|
1460 } |
|
1461 |
|
1462 /*! |
|
1463 * writes a function prototype to the output |
|
1464 */ |
|
1465 |
|
1466 void VhdlDocGen::writeFunctionProto(OutputList& ol,const ArgumentList* al,const MemberDef* mdef) |
|
1467 { |
|
1468 if (al==0) return; |
|
1469 ArgumentListIterator ali(*al); |
|
1470 Argument *arg; |
|
1471 bool sem=FALSE; |
|
1472 int len=al->count(); |
|
1473 ol.startBold(); |
|
1474 ol.docify(" ( "); |
|
1475 ol.endBold(); |
|
1476 if (len>2) |
|
1477 { |
|
1478 ol.lineBreak(); |
|
1479 } |
|
1480 for (;(arg=ali.current());++ali) |
|
1481 { |
|
1482 ol.startBold(); |
|
1483 if (sem && len < 3) |
|
1484 { |
|
1485 ol.docify(" , "); |
|
1486 } |
|
1487 QCString att=arg->defval; |
|
1488 if (!att.isEmpty()) |
|
1489 { |
|
1490 QCString *str=VhdlDocGen::findKeyWord(att); |
|
1491 att+=" "; |
|
1492 if (str) |
|
1493 VhdlDocGen::formatString(att,ol,mdef); |
|
1494 else |
|
1495 VhdlDocGen::startFonts(att,"vhdlchar",ol); |
|
1496 } |
|
1497 |
|
1498 QCString nn=arg->name; |
|
1499 nn+=": "; |
|
1500 QCString ss=arg->type; //.lower(); |
|
1501 QCString w=ss;//.upper(); |
|
1502 VhdlDocGen::startFonts(nn,"vhdlchar",ol); |
|
1503 VhdlDocGen::startFonts("in ","stringliteral",ol); |
|
1504 QCString *str=VhdlDocGen::findKeyWord(ss); |
|
1505 if (str) |
|
1506 VhdlDocGen::formatString(w,ol,mdef); |
|
1507 else |
|
1508 VhdlDocGen::startFonts(w,"vhdlchar",ol); |
|
1509 |
|
1510 sem=TRUE; |
|
1511 ol.endBold(); |
|
1512 if (len > 2) |
|
1513 { |
|
1514 ol.lineBreak(); |
|
1515 } |
|
1516 } |
|
1517 ol.startBold(); |
|
1518 ol.docify(" )"); |
|
1519 const char *exp=mdef->excpString(); |
|
1520 if (exp) |
|
1521 { |
|
1522 ol.insertMemberAlign(); |
|
1523 ol.docify("[ "); |
|
1524 ol.docify(exp); |
|
1525 ol.docify(" ]"); |
|
1526 } |
|
1527 ol.endBold(); |
|
1528 } |
|
1529 |
|
1530 /*! |
|
1531 * writes a process prototype to the output |
|
1532 */ |
|
1533 |
|
1534 void VhdlDocGen::writeProcessProto(OutputList& ol,const ArgumentList* al,const MemberDef* mdef) |
|
1535 { |
|
1536 if (al==0) return; |
|
1537 ArgumentListIterator ali(*al); |
|
1538 Argument *arg; |
|
1539 bool sem=FALSE; |
|
1540 ol.startBold(); |
|
1541 ol.docify(" ( "); |
|
1542 for (;(arg=ali.current());++ali) |
|
1543 { |
|
1544 if (sem) |
|
1545 ol.docify(" , "); |
|
1546 QCString nn=arg->name; |
|
1547 // VhdlDocGen::startFonts(nn,"vhdlchar",ol); |
|
1548 VhdlDocGen::writeFormatString(nn,ol,mdef); |
|
1549 sem=TRUE; |
|
1550 } |
|
1551 ol.docify(" )"); |
|
1552 ol.endBold(); |
|
1553 } |
|
1554 |
|
1555 |
|
1556 /*! |
|
1557 * writes a function|procedure documentation to the output |
|
1558 */ |
|
1559 |
|
1560 void VhdlDocGen::writeFuncProcDocu( |
|
1561 const MemberDef *md, |
|
1562 OutputList& ol, |
|
1563 const ArgumentList* al, |
|
1564 bool /*type*/) |
|
1565 { |
|
1566 if (al==0) return; |
|
1567 bool sem=FALSE; |
|
1568 ol.enableAll(); |
|
1569 |
|
1570 ArgumentListIterator ali(*al); |
|
1571 int index=ali.count(); |
|
1572 if (index==0) |
|
1573 { |
|
1574 ol.docify(" ( ) "); |
|
1575 return; |
|
1576 } |
|
1577 ol.startParameterList(FALSE); |
|
1578 Argument *arg; |
|
1579 bool first=TRUE; |
|
1580 for (;(arg=ali.current());++ali) |
|
1581 { |
|
1582 ol.startParameterType(first,""); |
|
1583 if (first) ol.writeChar('('); |
|
1584 if (!VhdlDocGen::isProcess(md)) |
|
1585 { |
|
1586 if (TRUE) //VhdlDocGen::isProcedure(md)) |
|
1587 { |
|
1588 startFonts(arg->defval,"keywordtype",ol); |
|
1589 ol.docify(" "); |
|
1590 } |
|
1591 // linkifyText(TextGeneratorOLImpl(ol),md->getClassDef(),md->getBodyDef(),md->name(),arg->type); |
|
1592 VhdlDocGen::writeFormatString(arg->name,ol,md); |
|
1593 ol.docify(" "); |
|
1594 |
|
1595 if (VhdlDocGen::isProcedure(md)) |
|
1596 startFonts(arg->attrib,"stringliteral",ol); |
|
1597 else |
|
1598 startFonts(QCString("in"),"stringliteral",ol); |
|
1599 } |
|
1600 ol.docify(" "); |
|
1601 ol.disable(OutputGenerator::Man); |
|
1602 ol.startEmphasis(); |
|
1603 ol.enable(OutputGenerator::Man); |
|
1604 if (!VhdlDocGen::isProcess(md)) |
|
1605 startFonts(arg->type,"vhdlkeyword",ol); |
|
1606 else |
|
1607 startFonts(arg->name,"vhdlkeyword",ol); |
|
1608 ol.disable(OutputGenerator::Man); |
|
1609 ol.endEmphasis(); |
|
1610 ol.enable(OutputGenerator::Man); |
|
1611 |
|
1612 if (--index) |
|
1613 ol.docify(" , "); |
|
1614 else |
|
1615 ol.docify(" ) "); |
|
1616 |
|
1617 ol.endParameterName(FALSE,FALSE,FALSE); |
|
1618 |
|
1619 sem=TRUE; |
|
1620 first=FALSE; |
|
1621 } |
|
1622 |
|
1623 } // writeDocFunProc |
|
1624 |
|
1625 /*! |
|
1626 * returns TRUE if this string is a function prototype or |
|
1627 * FALSE if this is a procedure |
|
1628 */ |
|
1629 |
|
1630 bool VhdlDocGen::isFunctionProto(QCString& ss) |
|
1631 { |
|
1632 QCString name=ss; |
|
1633 QCString proc("procedure"); |
|
1634 QCString func("function"); |
|
1635 name=name.stripWhiteSpace(); |
|
1636 QStringList ql=QStringList::split(QRegExp("[\\s]"),name,FALSE); |
|
1637 int j=ql.count(); |
|
1638 if (j<2) return FALSE; |
|
1639 QCString tt=(QCString)ql[0].lower(); |
|
1640 |
|
1641 if (tt=="impure" || tt=="pure") tt=ql[1]; |
|
1642 |
|
1643 if (VhdlDocGen::compareString(tt,proc)!=0 && VhdlDocGen::compareString(tt,func)!=0) |
|
1644 return FALSE; |
|
1645 |
|
1646 QCString temp=(QCString)ql[j-1]; |
|
1647 temp=temp.stripWhiteSpace(); |
|
1648 if (stricmp(temp.data(),"is")==0) |
|
1649 { |
|
1650 VhdlDocGen::deleteCharRev(name,'s'); |
|
1651 VhdlDocGen::deleteCharRev(name,'i'); |
|
1652 ss=name; |
|
1653 return TRUE; |
|
1654 } |
|
1655 return FALSE; |
|
1656 } |
|
1657 |
|
1658 QCString VhdlDocGen::convertArgumentListToString(const ArgumentList* al,bool func) |
|
1659 { |
|
1660 QCString argString; |
|
1661 bool sem=FALSE; |
|
1662 ArgumentListIterator ali(*al); |
|
1663 Argument *arg; |
|
1664 |
|
1665 for (;(arg=ali.current());++ali) |
|
1666 { |
|
1667 if (sem) argString.append(", "); |
|
1668 if (func) |
|
1669 { |
|
1670 argString+=arg->name; |
|
1671 argString+=":"; |
|
1672 argString+=arg->type; |
|
1673 } |
|
1674 else |
|
1675 { |
|
1676 argString+=arg->defval+" "; |
|
1677 argString+=arg->name+" :"; |
|
1678 argString+=arg->attrib+" "; |
|
1679 argString+=arg->type; |
|
1680 } |
|
1681 sem=TRUE; |
|
1682 } |
|
1683 return argString; |
|
1684 } |
|
1685 |
|
1686 |
|
1687 void VhdlDocGen::writeVhdlDeclarations(MemberList* ml, |
|
1688 OutputList& ol,GroupDef* gd,ClassDef* cd,FileDef *fd) |
|
1689 { |
|
1690 static ClassDef *cdef; |
|
1691 //static GroupDef* gdef; |
|
1692 if (cd && cdef!=cd) |
|
1693 { // only one inline link |
|
1694 VhdlDocGen::writeInlineClassLink(cd,ol); |
|
1695 cdef=cd; |
|
1696 } |
|
1697 |
|
1698 /* |
|
1699 if (gd && gdef==gd) return; |
|
1700 if (gd && gdef!=gd) |
|
1701 { |
|
1702 gdef=gd; |
|
1703 } |
|
1704 */ |
|
1705 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::LIBRARY,FALSE),0,FALSE,VhdlDocGen::LIBRARY); |
|
1706 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::USE,FALSE),0,FALSE,VhdlDocGen::USE); |
|
1707 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::FUNCTION,FALSE),0,FALSE,VhdlDocGen::FUNCTION); |
|
1708 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::COMPONENT,FALSE),0,FALSE,VhdlDocGen::COMPONENT); |
|
1709 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::CONSTANT,FALSE),0,FALSE,VhdlDocGen::CONSTANT); |
|
1710 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::TYPE,FALSE),0,FALSE,VhdlDocGen::TYPE); |
|
1711 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::SUBTYPE,FALSE),0,FALSE,VhdlDocGen::SUBTYPE); |
|
1712 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::GENERIC,FALSE),0,FALSE,VhdlDocGen::GENERIC); |
|
1713 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::PORT,FALSE),0,FALSE,VhdlDocGen::PORT); |
|
1714 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::PROCESS,FALSE),0,FALSE,VhdlDocGen::PROCESS); |
|
1715 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::SIGNAL,FALSE),0,FALSE,VhdlDocGen::SIGNAL); |
|
1716 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::ATTRIBUTE,FALSE),0,FALSE,VhdlDocGen::ATTRIBUTE); |
|
1717 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::PROCEDURE,FALSE),0,FALSE,VhdlDocGen::PROCEDURE); |
|
1718 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::RECORD,FALSE),0,FALSE,VhdlDocGen::RECORD); |
|
1719 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::UNITS,FALSE),0,FALSE,VhdlDocGen::UNITS); |
|
1720 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::SHAREDVARIABLE,FALSE),0,FALSE,VhdlDocGen::SHAREDVARIABLE); |
|
1721 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::VFILE,FALSE),0,FALSE,VhdlDocGen::VFILE); |
|
1722 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::GROUP,FALSE),0,FALSE,VhdlDocGen::GROUP); |
|
1723 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::COMPONENT_INST,FALSE),0,FALSE,VhdlDocGen::COMPONENT_INST); |
|
1724 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,0,gd,theTranslator_vhdlType(VhdlDocGen::ALIAS,FALSE),0,FALSE,VhdlDocGen::ALIAS); |
|
1725 |
|
1726 // configurations must be added to global file definitions. |
|
1727 VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,0,fd,gd,theTranslator_vhdlType(VhdlDocGen::CONFIG,FALSE),0,FALSE,VhdlDocGen::CONFIG); |
|
1728 } |
|
1729 |
|
1730 static void setGlobalType(MemberList *ml) |
|
1731 { |
|
1732 if (ml==0) return; |
|
1733 MemberDef *mdd=0; |
|
1734 MemberListIterator mmli(*ml); |
|
1735 for ( ; (mdd=mmli.current()); ++mmli ) |
|
1736 { |
|
1737 if (strcmp(mdd->argsString(),"configuration")==0) |
|
1738 { |
|
1739 mdd->setMemberSpecifiers(VhdlDocGen::CONFIG); |
|
1740 } |
|
1741 else if (strcmp(mdd->typeString(),"library")==0) |
|
1742 { |
|
1743 mdd->setMemberSpecifiers(VhdlDocGen::LIBRARY); |
|
1744 } |
|
1745 else if (strcmp(mdd->typeString(),"package")==0) |
|
1746 { |
|
1747 mdd->setMemberSpecifiers(VhdlDocGen::USE); |
|
1748 } |
|
1749 } |
|
1750 } |
|
1751 |
|
1752 /* writes a vhdl type documentation */ |
|
1753 void VhdlDocGen::writeVHDLTypeDocumentation(const MemberDef* mdef, const Definition *d, OutputList &ol) |
|
1754 { |
|
1755 ClassDef *cd=(ClassDef*)d; |
|
1756 if (cd==0) return; |
|
1757 if ((VhdlDocGen::isVhdlFunction(mdef) || VhdlDocGen::isProcedure(mdef) || VhdlDocGen::isProcess(mdef))) |
|
1758 { |
|
1759 QCString nn=mdef->typeString(); |
|
1760 nn=nn.stripWhiteSpace(); |
|
1761 QCString na=cd->name(); |
|
1762 MemberDef* memdef=VhdlDocGen::findMember(na,nn); |
|
1763 if (memdef && memdef->isLinkable()) |
|
1764 { |
|
1765 ol.startBold(); |
|
1766 //ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),0,mdef->typeString()); |
|
1767 writeLink(memdef,ol); |
|
1768 ol.endBold(); |
|
1769 ol.docify(" "); |
|
1770 } |
|
1771 else |
|
1772 { |
|
1773 QCString ttype=mdef->typeString(); |
|
1774 VhdlDocGen::formatString(ttype,ol,mdef); |
|
1775 } |
|
1776 ol.docify(mdef->name()); |
|
1777 VhdlDocGen::writeFuncProcDocu(mdef,ol, mdef->argumentList().pointer()); |
|
1778 } |
|
1779 |
|
1780 if (mdef->isVariable()) |
|
1781 { |
|
1782 //ol.docify(mdef->name().data()); |
|
1783 writeLink(mdef,ol); |
|
1784 ol.docify(" "); |
|
1785 QCString ttype=mdef->typeString(); |
|
1786 VhdlDocGen::formatString(ttype,ol,mdef); |
|
1787 ol.docify(" "); |
|
1788 if (VhdlDocGen::isPort(mdef)) |
|
1789 { |
|
1790 QCString largs=mdef->argsString(); |
|
1791 VhdlDocGen::formatString(largs,ol,mdef); |
|
1792 ol.docify(" "); |
|
1793 } |
|
1794 } |
|
1795 } |
|
1796 |
|
1797 /* writes a vhdl type declaration */ |
|
1798 |
|
1799 void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol, |
|
1800 ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd, |
|
1801 bool /*inGroup*/) |
|
1802 { |
|
1803 |
|
1804 LockingPtr<MemberDef> lock(mdef,mdef); |
|
1805 |
|
1806 Definition *d=0; |
|
1807 |
|
1808 /* some vhdl files contain only a configuration description |
|
1809 |
|
1810 library work; |
|
1811 configuration cfg_tb_jtag_gotoBackup of tb_jtag_gotoBackup is |
|
1812 for RTL |
|
1813 end for; |
|
1814 end cfg_tb_jtag_gotoBackup; |
|
1815 |
|
1816 in this case library work does not belong to an entity, package ... |
|
1817 |
|
1818 */ |
|
1819 |
|
1820 ASSERT(cd!=0 || nd!=0 || fd!=0 || gd!=0 || |
|
1821 mdef->getMemberSpecifiers()==VhdlDocGen::LIBRARY || |
|
1822 mdef->getMemberSpecifiers()==VhdlDocGen::USE |
|
1823 ); // member should belong to something |
|
1824 if (cd) d=cd; |
|
1825 else if (nd) d=nd; |
|
1826 else if (fd) d=fd; |
|
1827 else if (gd) d=gd; |
|
1828 else d=(Definition*)mdef; |
|
1829 |
|
1830 // write tag file information of this member |
|
1831 if (!Config_getString("GENERATE_TAGFILE").isEmpty()) |
|
1832 { |
|
1833 Doxygen::tagFile << " <member kind=\""; |
|
1834 if (VhdlDocGen::isGeneric(mdef)) Doxygen::tagFile << "generic"; |
|
1835 if (VhdlDocGen::isPort(mdef)) Doxygen::tagFile << "port"; |
|
1836 if (VhdlDocGen::isEntity(mdef)) Doxygen::tagFile << "entity"; |
|
1837 if (VhdlDocGen::isComponent(mdef)) Doxygen::tagFile << "component"; |
|
1838 if (VhdlDocGen::isVType(mdef)) Doxygen::tagFile << "type"; |
|
1839 if (VhdlDocGen::isConstant(mdef)) Doxygen::tagFile << "constant"; |
|
1840 if (VhdlDocGen::isSubType(mdef)) Doxygen::tagFile << "subtype"; |
|
1841 if (VhdlDocGen::isVhdlFunction(mdef)) Doxygen::tagFile << "function"; |
|
1842 if (VhdlDocGen::isProcedure(mdef)) Doxygen::tagFile << "procedure"; |
|
1843 if (VhdlDocGen::isProcess(mdef)) Doxygen::tagFile << "process"; |
|
1844 if (VhdlDocGen::isSignals(mdef)) Doxygen::tagFile << "signal"; |
|
1845 if (VhdlDocGen::isAttribute(mdef)) Doxygen::tagFile << "attribute"; |
|
1846 if (VhdlDocGen::isRecord(mdef)) Doxygen::tagFile << "record"; |
|
1847 if (VhdlDocGen::isLibrary(mdef)) Doxygen::tagFile << "library"; |
|
1848 if (VhdlDocGen::isPackage(mdef)) Doxygen::tagFile << "package"; |
|
1849 if (VhdlDocGen::isVariable(mdef)) Doxygen::tagFile << "shared variable"; |
|
1850 if (VhdlDocGen::isFile(mdef)) Doxygen::tagFile << "file"; |
|
1851 if (VhdlDocGen::isGroup(mdef)) Doxygen::tagFile << "group"; |
|
1852 if (VhdlDocGen::isCompInst(mdef)) Doxygen::tagFile << "component instantiation"; |
|
1853 if (VhdlDocGen::isAlias(mdef)) Doxygen::tagFile << "alias"; |
|
1854 if (VhdlDocGen::isCompInst(mdef)) Doxygen::tagFile << "configuration"; |
|
1855 |
|
1856 Doxygen::tagFile << "\">" << endl; |
|
1857 Doxygen::tagFile << " <type>" << convertToXML(mdef->typeString()) << "</type>" << endl; |
|
1858 Doxygen::tagFile << " <name>" << convertToXML(mdef->name()) << "</name>" << endl; |
|
1859 Doxygen::tagFile << " <anchorfile>" << convertToXML(mdef->getOutputFileBase()+Doxygen::htmlFileExtension) << "</anchorfile>" << endl; |
|
1860 Doxygen::tagFile << " <anchor>" << convertToXML(mdef->anchor()) << "</anchor>" << endl; |
|
1861 |
|
1862 if (VhdlDocGen::isVhdlFunction(mdef)) |
|
1863 Doxygen::tagFile << " <arglist>" << convertToXML(VhdlDocGen::convertArgumentListToString(mdef->argumentList().pointer(),TRUE)) << "</arglist>" << endl; |
|
1864 else if (VhdlDocGen::isProcedure(mdef)) |
|
1865 Doxygen::tagFile << " <arglist>" << convertToXML(VhdlDocGen::convertArgumentListToString(mdef->argumentList().pointer(),FALSE)) << "</arglist>" << endl; |
|
1866 else |
|
1867 Doxygen::tagFile << " <arglist>" << convertToXML(mdef->argsString()) << "</arglist>" << endl; |
|
1868 |
|
1869 mdef->writeDocAnchorsToTagFile(); |
|
1870 Doxygen::tagFile << " </member>" << endl; |
|
1871 |
|
1872 } |
|
1873 |
|
1874 // write search index info |
|
1875 if (Doxygen::searchIndex) |
|
1876 { |
|
1877 Doxygen::searchIndex->setCurrentDoc(mdef->qualifiedName(),mdef->getOutputFileBase(),mdef->anchor()); |
|
1878 Doxygen::searchIndex->addWord(mdef->localName(),TRUE); |
|
1879 Doxygen::searchIndex->addWord(mdef->qualifiedName(),FALSE); |
|
1880 } |
|
1881 |
|
1882 QCString cname = d->name(); |
|
1883 QCString cfname = mdef->getOutputFileBase(); |
|
1884 |
|
1885 //HtmlHelp *htmlHelp=0; |
|
1886 // bool hasHtmlHelp = Config_getBool("GENERATE_HTML") && Config_getBool("GENERATE_HTMLHELP"); |
|
1887 // if (hasHtmlHelp) htmlHelp = HtmlHelp::getInstance(); |
|
1888 |
|
1889 // search for the last anonymous scope in the member type |
|
1890 ClassDef *annoClassDef=mdef->getClassDefOfAnonymousType(); |
|
1891 |
|
1892 // start a new member declaration |
|
1893 bool isAnonymous = annoClassDef; // || m_impl->annMemb || m_impl->annEnumType; |
|
1894 ///printf("startMemberItem for %s\n",name().data()); |
|
1895 ol.startMemberItem( isAnonymous ); //? 1 : m_impl->tArgList ? 3 : 0); |
|
1896 |
|
1897 // If there is no detailed description we need to write the anchor here. |
|
1898 bool detailsVisible = mdef->isDetailedSectionLinkable(); |
|
1899 if (!detailsVisible) // && !m_impl->annMemb) |
|
1900 { |
|
1901 QCString doxyName=mdef->name().copy(); |
|
1902 if (!cname.isEmpty()) doxyName.prepend(cname+"::"); |
|
1903 QCString doxyArgs=mdef->argsString(); |
|
1904 ol.startDoxyAnchor(cfname,cname,mdef->anchor(),doxyName,doxyArgs); |
|
1905 |
|
1906 ol.pushGeneratorState(); |
|
1907 ol.disable(OutputGenerator::Man); |
|
1908 ol.disable(OutputGenerator::Latex); |
|
1909 ol.docify("\n"); |
|
1910 ol.popGeneratorState(); |
|
1911 |
|
1912 } |
|
1913 // *** write type |
|
1914 /*VHDL CHANGE */ |
|
1915 QCString ltype(mdef->typeString()); |
|
1916 QCString largs(mdef->argsString()); |
|
1917 int mm=mdef->getMemberSpecifiers(); |
|
1918 //printf(":: ltype=%s largs=%s name=%s mm=%d\n", |
|
1919 // ltype.data(),largs.data(),mdef->name().data(),mm); |
|
1920 |
|
1921 ClassDef *kl=0; |
|
1922 //FileDef *fdd=0; |
|
1923 LockingPtr<ArgumentList> alp = mdef->argumentList(); |
|
1924 QCString nn; |
|
1925 if (gd) gd=0; |
|
1926 switch(mm) |
|
1927 { |
|
1928 case VhdlDocGen::PROCEDURE: |
|
1929 case VhdlDocGen::FUNCTION: |
|
1930 ol.startBold(); |
|
1931 VhdlDocGen::formatString(ltype,ol,mdef); |
|
1932 ol.endBold(); |
|
1933 ol.insertMemberAlign(); |
|
1934 writeLink(mdef,ol); |
|
1935 if (alp!=0 && mm==VhdlDocGen::FUNCTION) |
|
1936 VhdlDocGen::writeFunctionProto(ol,alp.pointer(),mdef); |
|
1937 |
|
1938 if (alp!=0 && mm==VhdlDocGen::PROCEDURE) |
|
1939 VhdlDocGen::writeProcedureProto(ol,alp.pointer(),mdef); |
|
1940 |
|
1941 break; |
|
1942 case VhdlDocGen::USE: |
|
1943 kl=VhdlDocGen::getClass(mdef->name()); |
|
1944 if (kl && ((VhdlDocGen::VhdlClasses)kl->protection()==VhdlDocGen::ENTITYCLASS)) break; |
|
1945 writeLink(mdef,ol); |
|
1946 ol.insertMemberAlign(); |
|
1947 ol.docify(" "); |
|
1948 |
|
1949 if (kl) |
|
1950 { |
|
1951 nn=kl->getOutputFileBase(); |
|
1952 ol.pushGeneratorState(); |
|
1953 ol.disableAllBut(OutputGenerator::Html); |
|
1954 ol.docify(" "); |
|
1955 QCString name=theTranslator_vhdlType(VhdlDocGen::PACKAGE,TRUE); |
|
1956 ol.startBold(); |
|
1957 ol.docify(name.data()); |
|
1958 name.resize(0); |
|
1959 ol.endBold(); |
|
1960 name+=" <"+mdef->name()+">"; |
|
1961 ol.startEmphasis(); |
|
1962 ol.writeObjectLink(kl->getReference(),kl->getOutputFileBase(),0,name.data()); |
|
1963 ol.popGeneratorState(); |
|
1964 } |
|
1965 break; |
|
1966 case VhdlDocGen::LIBRARY: |
|
1967 writeLink(mdef,ol); |
|
1968 ol.insertMemberAlign(); |
|
1969 break; |
|
1970 case VhdlDocGen::GENERIC: |
|
1971 case VhdlDocGen::PORT: |
|
1972 writeLink(mdef,ol); |
|
1973 ol.insertMemberAlign(); |
|
1974 if (mm==VhdlDocGen::GENERIC) |
|
1975 { |
|
1976 ol.startBold(); |
|
1977 ol.docify(" "); |
|
1978 VhdlDocGen::formatString(ltype,ol,mdef); |
|
1979 ol.endBold(); |
|
1980 } |
|
1981 else |
|
1982 { |
|
1983 ol.docify(" "); |
|
1984 ol.startBold(); |
|
1985 ol.docify(mdef->typeString()); |
|
1986 ol.endBold(); |
|
1987 ol.docify(" "); |
|
1988 VhdlDocGen::formatString(largs,ol,mdef); |
|
1989 } |
|
1990 break; |
|
1991 case VhdlDocGen::PROCESS: |
|
1992 writeLink(mdef,ol); |
|
1993 ol.insertMemberAlign(); |
|
1994 VhdlDocGen::writeProcessProto(ol,alp.pointer(),mdef); |
|
1995 break; |
|
1996 case VhdlDocGen::PACKAGE: |
|
1997 case VhdlDocGen::ENTITY: |
|
1998 case VhdlDocGen::COMPONENT: |
|
1999 case VhdlDocGen::COMPONENT_INST: |
|
2000 case VhdlDocGen::CONFIG: |
|
2001 writeLink(mdef,ol); |
|
2002 ol.insertMemberAlign(); |
|
2003 ol.startBold(); |
|
2004 ol.docify(ltype); |
|
2005 ol.endBold(); |
|
2006 ol.docify(" "); |
|
2007 if (VhdlDocGen::isComponent(mdef) || |
|
2008 VhdlDocGen::isConfig(mdef) || |
|
2009 VhdlDocGen::isCompInst(mdef)) |
|
2010 { |
|
2011 if (VhdlDocGen::isConfig(mdef) || VhdlDocGen::isCompInst(mdef)) |
|
2012 { |
|
2013 nn=ltype; |
|
2014 } |
|
2015 else |
|
2016 { |
|
2017 nn=mdef->name(); |
|
2018 } |
|
2019 kl=getClass(nn.data()); |
|
2020 if (kl) |
|
2021 { |
|
2022 nn=kl->getOutputFileBase(); |
|
2023 ol.pushGeneratorState(); |
|
2024 ol.disableAllBut(OutputGenerator::Html); |
|
2025 ol.startEmphasis(); |
|
2026 QCString name("<Entity "); |
|
2027 if (VhdlDocGen::isConfig(mdef) || VhdlDocGen::isCompInst(mdef)) |
|
2028 { |
|
2029 name+=ltype+">"; |
|
2030 } |
|
2031 else |
|
2032 { |
|
2033 name+=mdef->name()+"> "; |
|
2034 } |
|
2035 ol.writeObjectLink(kl->getReference(),kl->getOutputFileBase(),0,name.data()); |
|
2036 ol.endEmphasis(); |
|
2037 ol.popGeneratorState(); |
|
2038 } |
|
2039 } |
|
2040 break; |
|
2041 case VhdlDocGen::SIGNAL: |
|
2042 case VhdlDocGen::ATTRIBUTE: |
|
2043 case VhdlDocGen::TYPE: |
|
2044 case VhdlDocGen::SUBTYPE: |
|
2045 case VhdlDocGen::CONSTANT: |
|
2046 case VhdlDocGen::SHAREDVARIABLE: |
|
2047 case VhdlDocGen::VFILE: |
|
2048 case VhdlDocGen::GROUP: |
|
2049 case VhdlDocGen::ALIAS: |
|
2050 writeLink(mdef,ol); |
|
2051 ol.docify(" "); |
|
2052 ol.insertMemberAlign(); |
|
2053 VhdlDocGen::formatString(ltype,ol,mdef); |
|
2054 break; |
|
2055 case VhdlDocGen::RECORD: |
|
2056 writeLink(mdef,ol); |
|
2057 ol.startBold(); |
|
2058 if (ltype.isEmpty()) ol.docify(" : record"); |
|
2059 ol.insertMemberAlign(); |
|
2060 if (!ltype.isEmpty()) |
|
2061 VhdlDocGen::formatString(ltype,ol,mdef); |
|
2062 ol.endBold(); |
|
2063 break; |
|
2064 case VhdlDocGen::UNITS: |
|
2065 ol.startBold(); |
|
2066 writeLink(mdef,ol); |
|
2067 if (ltype.isEmpty()) ol.docify(" : unit"); |
|
2068 ol.insertMemberAlign(); |
|
2069 if (!ltype.isEmpty()) |
|
2070 VhdlDocGen::formatString(ltype,ol,mdef); |
|
2071 ol.endBold(); |
|
2072 break; |
|
2073 default: break; |
|
2074 } |
|
2075 |
|
2076 bool htmlOn = ol.isEnabled(OutputGenerator::Html); |
|
2077 if (htmlOn && Config_getBool("HTML_ALIGN_MEMBERS") && !ltype.isEmpty()) |
|
2078 { |
|
2079 ol.disable(OutputGenerator::Html); |
|
2080 } |
|
2081 if (!ltype.isEmpty()) ol.docify(" "); |
|
2082 |
|
2083 if (htmlOn) |
|
2084 { |
|
2085 ol.enable(OutputGenerator::Html); |
|
2086 } |
|
2087 |
|
2088 if (!detailsVisible)// && !m_impl->annMemb) |
|
2089 { |
|
2090 ol.endDoxyAnchor(cfname,mdef->anchor()); |
|
2091 } |
|
2092 |
|
2093 //printf("endMember %s annoClassDef=%p annEnumType=%p\n", |
|
2094 // name().data(),annoClassDef,annEnumType); |
|
2095 ol.endMemberItem(); |
|
2096 if (!mdef->briefDescription().isEmpty() && Config_getBool("BRIEF_MEMBER_DESC") /* && !annMemb */) |
|
2097 { |
|
2098 ol.startMemberDescription(); |
|
2099 ol.parseDoc(mdef->briefFile(),mdef->briefLine(), |
|
2100 mdef->getOuterScope()?mdef->getOuterScope():d, |
|
2101 mdef,mdef->briefDescription(),TRUE,FALSE,0,TRUE,FALSE); |
|
2102 if (detailsVisible) |
|
2103 { |
|
2104 ol.pushGeneratorState(); |
|
2105 ol.disableAllBut(OutputGenerator::Html); |
|
2106 //ol.endEmphasis(); |
|
2107 ol.docify(" "); |
|
2108 if (mdef->getGroupDef()!=0 && gd==0) // forward link to the group |
|
2109 { |
|
2110 ol.startTextLink(mdef->getOutputFileBase(),mdef->anchor()); |
|
2111 } |
|
2112 else // local link |
|
2113 { |
|
2114 ol.startTextLink(0,mdef->anchor()); |
|
2115 } |
|
2116 ol.endTextLink(); |
|
2117 //ol.startEmphasis(); |
|
2118 ol.popGeneratorState(); |
|
2119 } |
|
2120 //ol.newParagraph(); |
|
2121 ol.endMemberDescription(); |
|
2122 } |
|
2123 mdef->warnIfUndocumented(); |
|
2124 |
|
2125 }// end writeVhdlDeclaration |
|
2126 |
|
2127 |
|
2128 void VhdlDocGen::writeLink(const MemberDef* mdef,OutputList &ol) |
|
2129 { |
|
2130 ol.writeObjectLink(mdef->getReference(), |
|
2131 mdef->getOutputFileBase(), |
|
2132 mdef->anchor(), |
|
2133 mdef->name()); |
|
2134 } |
|
2135 |
|
2136 void VhdlDocGen::writePlainVHDLDeclarations( |
|
2137 MemberList* mlist,OutputList &ol, |
|
2138 ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,int specifier) |
|
2139 { |
|
2140 |
|
2141 SDict<QCString> pack(1009); |
|
2142 |
|
2143 ol.pushGeneratorState(); |
|
2144 |
|
2145 bool first=TRUE; |
|
2146 MemberDef *md; |
|
2147 MemberListIterator mli(*mlist); |
|
2148 for ( ; (md=mli.current()); ++mli ) |
|
2149 { |
|
2150 int mems=md->getMemberSpecifiers(); |
|
2151 if (md->isBriefSectionVisible() && (mems==specifier) && (mems!=VhdlDocGen::LIBRARY) ) |
|
2152 { |
|
2153 if (first) {ol.startMemberList();first=FALSE;} |
|
2154 VhdlDocGen::writeVHDLDeclaration(md,ol,cd,nd,fd,gd,FALSE); |
|
2155 } //if |
|
2156 else if (md->isBriefSectionVisible() && (mems==specifier)) |
|
2157 { |
|
2158 if (!pack.find(md->name().data())) |
|
2159 { |
|
2160 if (first) ol.startMemberList(),first=FALSE; |
|
2161 VhdlDocGen::writeVHDLDeclaration(md,ol,cd,nd,fd,gd,FALSE); |
|
2162 pack.append(md->name().data(),new QCString(md->name().data())); |
|
2163 } |
|
2164 } //if |
|
2165 } //for |
|
2166 if (!first) ol.endMemberList(); |
|
2167 pack.clear(); |
|
2168 }//plainDeclaration |
|
2169 |
|
2170 bool VhdlDocGen::membersHaveSpecificType(MemberList *ml,int type) |
|
2171 { |
|
2172 if (ml==0) return FALSE; |
|
2173 MemberDef *mdd=0; |
|
2174 MemberListIterator mmli(*ml); |
|
2175 for ( ; (mdd=mmli.current()); ++mmli ) |
|
2176 { |
|
2177 if (mdd->getMemberSpecifiers()==type) //is type in class |
|
2178 { |
|
2179 return TRUE; |
|
2180 } |
|
2181 } |
|
2182 if (ml->getMemberGroupList()) |
|
2183 { |
|
2184 MemberGroupListIterator mgli(*ml->getMemberGroupList()); |
|
2185 MemberGroup *mg; |
|
2186 while ((mg=mgli.current())) |
|
2187 { |
|
2188 if (mg->members()) |
|
2189 { |
|
2190 if (membersHaveSpecificType(mg->members(),type)) return TRUE; |
|
2191 } |
|
2192 ++mgli; |
|
2193 } |
|
2194 } |
|
2195 return FALSE; |
|
2196 } |
|
2197 |
|
2198 void VhdlDocGen::writeVHDLDeclarations(MemberList* ml,OutputList &ol, |
|
2199 ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd, |
|
2200 const char *title,const char *subtitle,bool /*showEnumValues*/,int type) |
|
2201 { |
|
2202 setGlobalType(ml); |
|
2203 if (!membersHaveSpecificType(ml,type)) return; |
|
2204 |
|
2205 if (title) |
|
2206 { |
|
2207 ol.startMemberHeader(); |
|
2208 ol.parseText(title); |
|
2209 ol.endMemberHeader(); |
|
2210 ol.docify(" "); |
|
2211 } |
|
2212 if (subtitle && subtitle[0]!=0) |
|
2213 { |
|
2214 ol.startMemberSubtitle(); |
|
2215 ol.parseDoc("[generated]",-1,0,0,subtitle,FALSE,FALSE,0,TRUE,FALSE); |
|
2216 ol.endMemberSubtitle(); |
|
2217 } //printf("memberGroupList=%p\n",memberGroupList); |
|
2218 |
|
2219 VhdlDocGen::writePlainVHDLDeclarations(ml,ol,cd,nd,fd,gd,type); |
|
2220 |
|
2221 if (ml->getMemberGroupList()) |
|
2222 { |
|
2223 MemberGroupListIterator mgli(*ml->getMemberGroupList()); |
|
2224 MemberGroup *mg; |
|
2225 while ((mg=mgli.current())) |
|
2226 { |
|
2227 if (membersHaveSpecificType(mg->members(),type)) |
|
2228 { |
|
2229 //printf("mg->header=%s\n",mg->header().data()); |
|
2230 bool hasHeader=mg->header()!="[NOHEADER]"; |
|
2231 ol.startMemberGroupHeader(hasHeader); |
|
2232 if (hasHeader) |
|
2233 { |
|
2234 ol.parseText(mg->header()); |
|
2235 } |
|
2236 ol.endMemberGroupHeader(); |
|
2237 if (!mg->documentation().isEmpty()) |
|
2238 { |
|
2239 //printf("Member group has docs!\n"); |
|
2240 ol.startMemberGroupDocs(); |
|
2241 ol.parseDoc("[generated]",-1,0,0,mg->documentation()+"\n",FALSE,FALSE); |
|
2242 ol.endMemberGroupDocs(); |
|
2243 } |
|
2244 ol.startMemberGroup(); |
|
2245 //printf("--- mg->writePlainDeclarations ---\n"); |
|
2246 VhdlDocGen::writePlainVHDLDeclarations(mg->members(),ol,cd,nd,fd,gd,type); |
|
2247 ol.endMemberGroup(hasHeader); |
|
2248 } |
|
2249 ++mgli; |
|
2250 } |
|
2251 } |
|
2252 }// writeVHDLDeclarations |
|
2253 |
|
2254 /* strips the prefix for record and unit members*/ |
|
2255 void VhdlDocGen::adjustRecordMember(MemberDef *mdef) |
|
2256 { //,OutputList & ol) { |
|
2257 QRegExp regg("[_a-zA-Z]"); |
|
2258 QCString nn=mdef->name(); |
|
2259 int j=nn.find(regg,0); |
|
2260 if (j>0) |
|
2261 { |
|
2262 nn=nn.mid(j,nn.length()); |
|
2263 mdef->setName(nn.data()); |
|
2264 } |
|
2265 }//adjustRecordMember |
|
2266 |
|
2267 /* strips the prefix for package and package body */ |
|
2268 |
|
2269 bool VhdlDocGen::writeClassType( ClassDef *& cd, |
|
2270 OutputList &ol ,QCString & cname) |
|
2271 { |
|
2272 //static ClassDef *prev = 0; |
|
2273 //if (prev == cd) return TRUE; |
|
2274 //if (cd != prev) prev=cd; |
|
2275 |
|
2276 int id=cd->protection(); |
|
2277 QCString qcs = VhdlDocGen::trTypeString(id+2); |
|
2278 cname=VhdlDocGen::getClassName(cd); |
|
2279 ol.startBold(); |
|
2280 ol.writeString(qcs.data()); |
|
2281 ol.writeString(" "); |
|
2282 ol.endBold(); |
|
2283 //ol.insertMemberAlign(); |
|
2284 return FALSE; |
|
2285 }// writeClassLink |
|
2286 |
|
2287 QCString VhdlDocGen::trVhdlType(int type,bool sing) |
|
2288 { |
|
2289 switch(type) |
|
2290 { |
|
2291 case VhdlDocGen::LIBRARY: |
|
2292 if (sing) return "Library"; |
|
2293 else return "Libraries"; |
|
2294 case VhdlDocGen::PACKAGE: |
|
2295 if (sing) return "Package"; |
|
2296 else return "Packages"; |
|
2297 case VhdlDocGen::SIGNAL: |
|
2298 if (sing) return "Signal"; |
|
2299 else return "Signals"; |
|
2300 case VhdlDocGen::COMPONENT: |
|
2301 if (sing) return "Component"; |
|
2302 else return "Components"; |
|
2303 case VhdlDocGen::CONSTANT: |
|
2304 if (sing) return "Constant"; |
|
2305 else return "Constants"; |
|
2306 case VhdlDocGen::ENTITY: |
|
2307 if (sing) return "Entity"; |
|
2308 else return "Entities"; |
|
2309 case VhdlDocGen::TYPE: |
|
2310 if (sing) return "Type"; |
|
2311 else return "Types"; |
|
2312 case VhdlDocGen::SUBTYPE: |
|
2313 if (sing) return "Subtype"; |
|
2314 else return "Subtypes"; |
|
2315 case VhdlDocGen::FUNCTION: |
|
2316 if (sing) return "Function"; |
|
2317 else return "Functions"; |
|
2318 case VhdlDocGen::RECORD: |
|
2319 if (sing) return "Record"; |
|
2320 else return "Records"; |
|
2321 case VhdlDocGen::PROCEDURE: |
|
2322 if (sing) return "Procedure"; |
|
2323 else return "Procedures"; |
|
2324 case VhdlDocGen::ARCHITECTURE: |
|
2325 if (sing) return "Architecture"; |
|
2326 else return "Architectures"; |
|
2327 case VhdlDocGen::ATTRIBUTE: |
|
2328 if (sing) return "Attribute"; |
|
2329 else return "Attributes"; |
|
2330 case VhdlDocGen::PROCESS: |
|
2331 if (sing) return "Process"; |
|
2332 else return "Processes"; |
|
2333 case VhdlDocGen::PORT: |
|
2334 if (sing) return "Port"; |
|
2335 else return "Ports"; |
|
2336 case VhdlDocGen::USE: |
|
2337 if (sing) return "Package"; |
|
2338 else return "Packages"; |
|
2339 case VhdlDocGen::GENERIC: |
|
2340 if (sing) return "Generic"; |
|
2341 else return "Generics"; |
|
2342 case VhdlDocGen::PACKAGE_BODY: |
|
2343 return "Package Body"; |
|
2344 case VhdlDocGen::DOCUMENT: |
|
2345 return "Doc"; |
|
2346 case VhdlDocGen::UNITS: |
|
2347 return "Units"; |
|
2348 case VhdlDocGen::SHAREDVARIABLE: |
|
2349 if (sing) return "Shared Variable"; |
|
2350 return "Shared Variables"; |
|
2351 case VhdlDocGen::VFILE: |
|
2352 if (sing) return "File"; |
|
2353 return "Files"; |
|
2354 case VhdlDocGen::GROUP: |
|
2355 if (sing) return "Group"; |
|
2356 return "Groups"; |
|
2357 case VhdlDocGen::COMPONENT_INST: |
|
2358 if (sing) return "Component Instantiation"; |
|
2359 else return "Component Instantiations"; |
|
2360 case VhdlDocGen::ALIAS: |
|
2361 if (sing) return "Alias"; |
|
2362 return "Aliases"; |
|
2363 case VhdlDocGen::CONFIG: |
|
2364 if (sing) return "Configuration"; |
|
2365 return "Configurations"; |
|
2366 |
|
2367 default: |
|
2368 return "Class"; |
|
2369 } |
|
2370 } |
|
2371 |
|
2372 QCString VhdlDocGen::trDesignUnitHierarchy() |
|
2373 { |
|
2374 return "Design Unit Hierarchy"; |
|
2375 } |
|
2376 |
|
2377 QCString VhdlDocGen::trDesignUnitList() |
|
2378 { |
|
2379 return "Design Unit List"; |
|
2380 } |
|
2381 |
|
2382 QCString VhdlDocGen::trDesignUnitMembers() |
|
2383 { |
|
2384 return "Design Unit Members"; |
|
2385 } |
|
2386 |
|
2387 QCString VhdlDocGen::trDesignUnitListDescription() |
|
2388 { |
|
2389 return "Here is a list of all design unit members with links to " |
|
2390 "the Entities and Packages they belong to:"; |
|
2391 } |
|
2392 |
|
2393 QCString VhdlDocGen::trDesignUnitIndex() |
|
2394 { |
|
2395 return "Design Unit Index"; |
|
2396 } |
|
2397 |
|
2398 QCString VhdlDocGen::trDesignUnits() |
|
2399 { |
|
2400 return "Design Units"; |
|
2401 } |
|
2402 |
|
2403 QCString VhdlDocGen::trFunctionAndProc() |
|
2404 { |
|
2405 return "Functions/Procedures/Processes"; |
|
2406 } |
|
2407 |
|
2408 |
|
2409 |
|
2410 /*! adds documentation to a function/procedure */ |
|
2411 bool VhdlDocGen::writeDoc(EntryNav* rootNav) |
|
2412 { |
|
2413 Entry *e=rootNav->entry(); |
|
2414 //if (e->section==Entry::Entry::OVERLOADDOC_SEC) |
|
2415 if (stricmp(e->type.data(),"function")==0) |
|
2416 { |
|
2417 VhdlDocGen::addFuncDoc(rootNav); |
|
2418 } |
|
2419 |
|
2420 return FALSE; |
|
2421 }// writeDoc |
|
2422 |
|
2423 |
|
2424 /* do not insert the same component twice */ |
|
2425 |
|
2426 bool VhdlDocGen::foundInsertedComponent(const QCString & name,Entry* root) |
|
2427 { |
|
2428 QListIterator<BaseInfo> bii(*root->extends); |
|
2429 BaseInfo *bi=0; |
|
2430 for (bii.toFirst();(bi=bii.current());++bii) |
|
2431 { |
|
2432 if (bi->name==name) |
|
2433 { |
|
2434 return TRUE; // |
|
2435 } |
|
2436 } |
|
2437 |
|
2438 return FALSE; |
|
2439 }// found component |
|
2440 |
|
2441 /*! writes a link if the string is linkable else a formatted string */ |
|
2442 |
|
2443 void VhdlDocGen::writeStringLink(const MemberDef *mdef,QCString mem, OutputList& ol) |
|
2444 { |
|
2445 if (mdef) |
|
2446 { |
|
2447 ClassDef *cd=mdef->getClassDef(); |
|
2448 if (cd) |
|
2449 { |
|
2450 QCString n=cd->name(); |
|
2451 MemberDef* memdef=VhdlDocGen::findMember(n,mem); |
|
2452 if (memdef && memdef->isLinkable()) |
|
2453 { |
|
2454 ol.startBold(); |
|
2455 writeLink(memdef,ol); |
|
2456 ol.endBold(); |
|
2457 ol.docify(" "); |
|
2458 return; |
|
2459 } |
|
2460 } |
|
2461 } |
|
2462 VhdlDocGen::startFonts(mem,"vhdlchar",ol); |
|
2463 }// found component |
|
2464 |