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