Root/
Source at commit 1322 created 12 years 7 months ago. By meklort, Add doxygen to utils folder | |
---|---|
1 | /******************************************************************************␊ |
2 | *␊ |
3 | *␊ |
4 | *␊ |
5 | *␊ |
6 | * Copyright (C) 1997-2011 by Dimitri van Heesch.␊ |
7 | * Authors: Dimitri van Heesch, Miguel Lobo.␊ |
8 | *␊ |
9 | * Permission to use, copy, modify, and distribute this software and its␊ |
10 | * documentation under the terms of the GNU General Public License is hereby␊ |
11 | * granted. No representations are made about the suitability of this software␊ |
12 | * for any purpose. It is provided "as is" without express or implied warranty.␊ |
13 | * See the GNU General Public License for more details.␊ |
14 | *␊ |
15 | * Documents produced by Doxygen are derivative works derived from the␊ |
16 | * input used in their production; they are not affected by this license.␊ |
17 | *␊ |
18 | */␊ |
19 | ␊ |
20 | #include <stdlib.h>␊ |
21 | ␊ |
22 | #include "perlmodgen.h"␊ |
23 | #include "docparser.h"␊ |
24 | #include "message.h"␊ |
25 | #include "doxygen.h"␊ |
26 | #include "pagedef.h"␊ |
27 | ␊ |
28 | #include <qdir.h>␊ |
29 | #include <qstack.h>␊ |
30 | #include <qdict.h>␊ |
31 | #include <qfile.h>␊ |
32 | #include "ftextstream.h"␊ |
33 | ␊ |
34 | #define PERLOUTPUT_MAX_INDENTATION 40␊ |
35 | ␊ |
36 | class PerlModOutputStream␊ |
37 | {␊ |
38 | public:␊ |
39 | ␊ |
40 | QCString m_s;␊ |
41 | FTextStream *m_t;␊ |
42 | ␊ |
43 | PerlModOutputStream(FTextStream *t = 0) : m_t(t) { }␊ |
44 | ␊ |
45 | void add(char c);␊ |
46 | void add(const char *s);␊ |
47 | void add(QCString &s);␊ |
48 | void add(int n);␊ |
49 | void add(unsigned int n);␊ |
50 | };␊ |
51 | ␊ |
52 | void PerlModOutputStream::add(char c)␊ |
53 | {␊ |
54 | if (m_t != 0)␊ |
55 | (*m_t) << c;␊ |
56 | else␊ |
57 | m_s += c;␊ |
58 | }␊ |
59 | ␊ |
60 | void PerlModOutputStream::add(const char *s)␊ |
61 | {␊ |
62 | if (m_t != 0)␊ |
63 | (*m_t) << s;␊ |
64 | else␊ |
65 | m_s += s;␊ |
66 | }␊ |
67 | ␊ |
68 | void PerlModOutputStream::add(QCString &s)␊ |
69 | {␊ |
70 | if (m_t != 0)␊ |
71 | (*m_t) << s;␊ |
72 | else␊ |
73 | m_s += s;␊ |
74 | }␊ |
75 | ␊ |
76 | void PerlModOutputStream::add(int n)␊ |
77 | {␊ |
78 | if (m_t != 0)␊ |
79 | (*m_t) << n;␊ |
80 | else␊ |
81 | m_s += n;␊ |
82 | }␊ |
83 | ␊ |
84 | void PerlModOutputStream::add(unsigned int n)␊ |
85 | {␊ |
86 | if (m_t != 0)␊ |
87 | (*m_t) << n;␊ |
88 | else␊ |
89 | m_s += n;␊ |
90 | }␊ |
91 | ␊ |
92 | class PerlModOutput␊ |
93 | {␊ |
94 | public:␊ |
95 | ␊ |
96 | bool m_pretty;␊ |
97 | ␊ |
98 | inline PerlModOutput(bool pretty)␊ |
99 | : m_pretty(pretty), m_stream(0), m_indentation(false), m_blockstart(true)␊ |
100 | {␊ |
101 | m_spaces[0] = 0;␊ |
102 | }␊ |
103 | ␊ |
104 | virtual ~PerlModOutput() { }␊ |
105 | ␊ |
106 | inline void setPerlModOutputStream(PerlModOutputStream *os) { m_stream = os; }␊ |
107 | ␊ |
108 | inline PerlModOutput &openSave() { iopenSave(); return *this; }␊ |
109 | inline PerlModOutput &closeSave(QCString &s) { icloseSave(s); return *this; }␊ |
110 | ␊ |
111 | inline PerlModOutput &continueBlock()␊ |
112 | {␊ |
113 | if (m_blockstart)␊ |
114 | m_blockstart = false;␊ |
115 | else␊ |
116 | m_stream->add(',');␊ |
117 | indent();␊ |
118 | return *this;␊ |
119 | }␊ |
120 | ␊ |
121 | inline PerlModOutput &add(char c) { m_stream->add(c); return *this; }␊ |
122 | inline PerlModOutput &add(const char *s) { m_stream->add(s); return *this; }␊ |
123 | inline PerlModOutput &add(QCString &s) { m_stream->add(s); return *this; }␊ |
124 | inline PerlModOutput &add(int n) { m_stream->add(n); return *this; }␊ |
125 | inline PerlModOutput &add(unsigned int n) { m_stream->add(n); return *this; }␊ |
126 | ␊ |
127 | PerlModOutput &addQuoted(const char *s) { iaddQuoted(s); return *this; }␊ |
128 | ␊ |
129 | inline PerlModOutput &indent()␊ |
130 | {␊ |
131 | if (m_pretty) {␊ |
132 | m_stream->add('\n');␊ |
133 | m_stream->add(m_spaces);␊ |
134 | }␊ |
135 | return *this;␊ |
136 | }␊ |
137 | ␊ |
138 | inline PerlModOutput &open(char c, const char *s = 0) { iopen(c, s); return *this; }␊ |
139 | inline PerlModOutput &close(char c = 0) { iclose(c); return *this; }␊ |
140 | ␊ |
141 | inline PerlModOutput &addField(const char *s) { iaddField(s); return *this; }␊ |
142 | inline PerlModOutput &addFieldQuotedChar(const char *field, char content)␊ |
143 | {␊ |
144 | iaddFieldQuotedChar(field, content); return *this;␊ |
145 | }␊ |
146 | inline PerlModOutput &addFieldQuotedString(const char *field, const char *content)␊ |
147 | {␊ |
148 | iaddFieldQuotedString(field, content); return *this;␊ |
149 | }␊ |
150 | inline PerlModOutput &addFieldBoolean(const char *field, bool content)␊ |
151 | {␊ |
152 | return addFieldQuotedString(field, content ? "yes" : "no");␊ |
153 | }␊ |
154 | inline PerlModOutput &openList(const char *s = 0) { open('[', s); return *this; }␊ |
155 | inline PerlModOutput &closeList() { close(']'); return *this; }␊ |
156 | inline PerlModOutput &openHash(const char *s = 0 ) { open('{', s); return *this; }␊ |
157 | inline PerlModOutput &closeHash() { close('}'); return *this; }␊ |
158 | ␊ |
159 | protected:␊ |
160 | ␊ |
161 | void iopenSave();␊ |
162 | void icloseSave(QCString &);␊ |
163 | ␊ |
164 | void incIndent();␊ |
165 | void decIndent();␊ |
166 | ␊ |
167 | void iaddQuoted(const char *);␊ |
168 | void iaddFieldQuotedChar(const char *, char);␊ |
169 | void iaddFieldQuotedString(const char *, const char *);␊ |
170 | void iaddField(const char *);␊ |
171 | ␊ |
172 | void iopen(char, const char *);␊ |
173 | void iclose(char);␊ |
174 | ␊ |
175 | private:␊ |
176 | ␊ |
177 | PerlModOutputStream *m_stream;␊ |
178 | int m_indentation;␊ |
179 | bool m_blockstart;␊ |
180 | ␊ |
181 | QStack<PerlModOutputStream> m_saved;␊ |
182 | char m_spaces[PERLOUTPUT_MAX_INDENTATION * 2 + 2];␊ |
183 | };␊ |
184 | ␊ |
185 | void PerlModOutput::iopenSave()␊ |
186 | {␊ |
187 | m_saved.push(m_stream);␊ |
188 | m_stream = new PerlModOutputStream();␊ |
189 | }␊ |
190 | ␊ |
191 | void PerlModOutput::icloseSave(QCString &s)␊ |
192 | {␊ |
193 | s = m_stream->m_s;␊ |
194 | delete m_stream;␊ |
195 | m_stream = m_saved.pop();␊ |
196 | }␊ |
197 | ␊ |
198 | void PerlModOutput::incIndent()␊ |
199 | {␊ |
200 | if (m_indentation < PERLOUTPUT_MAX_INDENTATION)␊ |
201 | {␊ |
202 | char *s = &m_spaces[m_indentation * 2];␊ |
203 | *s++ = ' '; *s++ = ' '; *s = 0;␊ |
204 | }␊ |
205 | m_indentation++;␊ |
206 | }␊ |
207 | ␊ |
208 | void PerlModOutput::decIndent()␊ |
209 | {␊ |
210 | m_indentation--;␊ |
211 | if (m_indentation < PERLOUTPUT_MAX_INDENTATION)␊ |
212 | m_spaces[m_indentation * 2] = 0;␊ |
213 | }␊ |
214 | ␊ |
215 | void PerlModOutput::iaddQuoted(const char *s) ␊ |
216 | {␊ |
217 | char c;␊ |
218 | while ((c = *s++) != 0) {␊ |
219 | if ((c == '\'') || (c == '\\'))␊ |
220 | m_stream->add('\\');␊ |
221 | m_stream->add(c);␊ |
222 | }␊ |
223 | }␊ |
224 | ␊ |
225 | void PerlModOutput::iaddField(const char *s)␊ |
226 | {␊ |
227 | continueBlock();␊ |
228 | m_stream->add(s);␊ |
229 | m_stream->add(m_pretty ? " => " : "=>");␊ |
230 | }␊ |
231 | ␊ |
232 | void PerlModOutput::iaddFieldQuotedChar(const char *field, char content)␊ |
233 | {␊ |
234 | iaddField(field);␊ |
235 | m_stream->add('\'');␊ |
236 | if ((content == '\'') || (content == '\\'))␊ |
237 | m_stream->add('\\');␊ |
238 | m_stream->add(content);␊ |
239 | m_stream->add('\'');␊ |
240 | }␊ |
241 | ␊ |
242 | void PerlModOutput::iaddFieldQuotedString(const char *field, const char *content)␊ |
243 | {␊ |
244 | if (content == 0)␊ |
245 | return;␊ |
246 | iaddField(field);␊ |
247 | m_stream->add('\'');␊ |
248 | iaddQuoted(content);␊ |
249 | m_stream->add('\'');␊ |
250 | }␊ |
251 | ␊ |
252 | void PerlModOutput::iopen(char c, const char *s)␊ |
253 | {␊ |
254 | if (s != 0)␊ |
255 | iaddField(s);␊ |
256 | else␊ |
257 | continueBlock();␊ |
258 | m_stream->add(c);␊ |
259 | incIndent();␊ |
260 | m_blockstart = true;␊ |
261 | }␊ |
262 | ␊ |
263 | void PerlModOutput::iclose(char c)␊ |
264 | {␊ |
265 | decIndent(); ␊ |
266 | indent();␊ |
267 | if (c != 0)␊ |
268 | m_stream->add(c); ␊ |
269 | m_blockstart = false;␊ |
270 | }␊ |
271 | ␊ |
272 | /*! @brief Concrete visitor implementation for PerlMod output. */␊ |
273 | class PerlModDocVisitor : public DocVisitor␊ |
274 | {␊ |
275 | public:␊ |
276 | PerlModDocVisitor(PerlModOutput &);␊ |
277 | virtual ~PerlModDocVisitor() { }␊ |
278 | ␊ |
279 | void finish();␊ |
280 | ␊ |
281 | //--------------------------------------␊ |
282 | // visitor functions for leaf nodes␊ |
283 | //--------------------------------------␊ |
284 | ␊ |
285 | void visit(DocWord *);␊ |
286 | void visit(DocLinkedWord *);␊ |
287 | void visit(DocWhiteSpace *);␊ |
288 | void visit(DocSymbol *);␊ |
289 | void visit(DocURL *);␊ |
290 | void visit(DocLineBreak *);␊ |
291 | void visit(DocHorRuler *);␊ |
292 | void visit(DocStyleChange *);␊ |
293 | void visit(DocVerbatim *);␊ |
294 | void visit(DocAnchor *);␊ |
295 | void visit(DocInclude *);␊ |
296 | void visit(DocIncOperator *);␊ |
297 | void visit(DocFormula *);␊ |
298 | void visit(DocIndexEntry *);␊ |
299 | void visit(DocSimpleSectSep *);␊ |
300 | ␊ |
301 | //--------------------------------------␊ |
302 | // visitor functions for compound nodes␊ |
303 | //--------------------------------------␊ |
304 | ␊ |
305 | void visitPre(DocAutoList *);␊ |
306 | void visitPost(DocAutoList *);␊ |
307 | void visitPre(DocAutoListItem *);␊ |
308 | void visitPost(DocAutoListItem *);␊ |
309 | void visitPre(DocPara *) ;␊ |
310 | void visitPost(DocPara *);␊ |
311 | void visitPre(DocRoot *);␊ |
312 | void visitPost(DocRoot *);␊ |
313 | void visitPre(DocSimpleSect *);␊ |
314 | void visitPost(DocSimpleSect *);␊ |
315 | void visitPre(DocTitle *);␊ |
316 | void visitPost(DocTitle *);␊ |
317 | void visitPre(DocSimpleList *);␊ |
318 | void visitPost(DocSimpleList *);␊ |
319 | void visitPre(DocSimpleListItem *);␊ |
320 | void visitPost(DocSimpleListItem *);␊ |
321 | void visitPre(DocSection *);␊ |
322 | void visitPost(DocSection *);␊ |
323 | void visitPre(DocHtmlList *);␊ |
324 | void visitPost(DocHtmlList *) ;␊ |
325 | void visitPre(DocHtmlListItem *);␊ |
326 | void visitPost(DocHtmlListItem *);␊ |
327 | //void visitPre(DocHtmlPre *);␊ |
328 | //void visitPost(DocHtmlPre *);␊ |
329 | void visitPre(DocHtmlDescList *);␊ |
330 | void visitPost(DocHtmlDescList *);␊ |
331 | void visitPre(DocHtmlDescTitle *);␊ |
332 | void visitPost(DocHtmlDescTitle *);␊ |
333 | void visitPre(DocHtmlDescData *);␊ |
334 | void visitPost(DocHtmlDescData *);␊ |
335 | void visitPre(DocHtmlTable *);␊ |
336 | void visitPost(DocHtmlTable *);␊ |
337 | void visitPre(DocHtmlRow *);␊ |
338 | void visitPost(DocHtmlRow *) ;␊ |
339 | void visitPre(DocHtmlCell *);␊ |
340 | void visitPost(DocHtmlCell *);␊ |
341 | void visitPre(DocHtmlCaption *);␊ |
342 | void visitPost(DocHtmlCaption *);␊ |
343 | void visitPre(DocInternal *);␊ |
344 | void visitPost(DocInternal *);␊ |
345 | void visitPre(DocHRef *);␊ |
346 | void visitPost(DocHRef *);␊ |
347 | void visitPre(DocHtmlHeader *);␊ |
348 | void visitPost(DocHtmlHeader *);␊ |
349 | void visitPre(DocImage *);␊ |
350 | void visitPost(DocImage *);␊ |
351 | void visitPre(DocDotFile *);␊ |
352 | void visitPost(DocDotFile *);␊ |
353 | void visitPre(DocMscFile *);␊ |
354 | void visitPost(DocMscFile *);␊ |
355 | void visitPre(DocLink *);␊ |
356 | void visitPost(DocLink *);␊ |
357 | void visitPre(DocRef *);␊ |
358 | void visitPost(DocRef *);␊ |
359 | void visitPre(DocSecRefItem *);␊ |
360 | void visitPost(DocSecRefItem *);␊ |
361 | void visitPre(DocSecRefList *);␊ |
362 | void visitPost(DocSecRefList *);␊ |
363 | //void visitPre(DocLanguage *);␊ |
364 | //void visitPost(DocLanguage *);␊ |
365 | void visitPre(DocParamSect *);␊ |
366 | void visitPost(DocParamSect *);␊ |
367 | void visitPre(DocParamList *);␊ |
368 | void visitPost(DocParamList *);␊ |
369 | void visitPre(DocXRefItem *);␊ |
370 | void visitPost(DocXRefItem *);␊ |
371 | void visitPre(DocInternalRef *);␊ |
372 | void visitPost(DocInternalRef *);␊ |
373 | void visitPre(DocCopy *);␊ |
374 | void visitPost(DocCopy *);␊ |
375 | void visitPre(DocText *);␊ |
376 | void visitPost(DocText *);␊ |
377 | ␊ |
378 | private:␊ |
379 | ␊ |
380 | //--------------------------------------␊ |
381 | // helper functions␊ |
382 | //--------------------------------------␊ |
383 | ␊ |
384 | void addLink(const QCString &ref, const QCString &file,␊ |
385 | ␉ const QCString &anchor);␊ |
386 | ␊ |
387 | void enterText();␊ |
388 | void leaveText();␊ |
389 | ␊ |
390 | void openItem(const char *);␊ |
391 | void closeItem();␊ |
392 | void singleItem(const char *);␊ |
393 | void openSubBlock(const char * = 0);␊ |
394 | void closeSubBlock();␊ |
395 | void openOther();␊ |
396 | void closeOther();␊ |
397 | ␊ |
398 | //--------------------------------------␊ |
399 | // state variables␊ |
400 | //--------------------------------------␊ |
401 | ␊ |
402 | PerlModOutput &m_output;␊ |
403 | bool m_textmode;␊ |
404 | bool m_textblockstart;␊ |
405 | QCString m_other;␊ |
406 | };␊ |
407 | ␊ |
408 | PerlModDocVisitor::PerlModDocVisitor(PerlModOutput &output)␊ |
409 | : DocVisitor(DocVisitor_Other), m_output(output), m_textmode(false)␊ |
410 | {␊ |
411 | m_output.openList("doc");␊ |
412 | }␊ |
413 | ␊ |
414 | void PerlModDocVisitor::finish()␊ |
415 | {␊ |
416 | leaveText();␊ |
417 | m_output.closeList()␊ |
418 | .add(m_other);␊ |
419 | }␊ |
420 | ␊ |
421 | void PerlModDocVisitor::addLink(const QCString &,const QCString &file,const QCString &anchor)␊ |
422 | {␊ |
423 | QCString link = file;␊ |
424 | if (!anchor.isEmpty())␊ |
425 | (link += "_1") += anchor;␊ |
426 | m_output.addFieldQuotedString("link", link);␊ |
427 | }␊ |
428 | ␊ |
429 | void PerlModDocVisitor::openItem(const char *name)␊ |
430 | {␊ |
431 | leaveText();␊ |
432 | m_output.openHash().addFieldQuotedString("type", name);␊ |
433 | }␊ |
434 | ␊ |
435 | void PerlModDocVisitor::closeItem()␊ |
436 | {␊ |
437 | leaveText();␊ |
438 | m_output.closeHash();␊ |
439 | }␊ |
440 | ␊ |
441 | void PerlModDocVisitor::enterText()␊ |
442 | {␊ |
443 | if (m_textmode)␊ |
444 | return;␊ |
445 | openItem("text");␊ |
446 | m_output.addField("content").add('\'');␊ |
447 | m_textmode = true;␊ |
448 | }␊ |
449 | ␊ |
450 | void PerlModDocVisitor::leaveText()␊ |
451 | {␊ |
452 | if (!m_textmode)␊ |
453 | return;␊ |
454 | m_textmode = false;␊ |
455 | m_output␊ |
456 | .add('\'')␊ |
457 | .closeHash();␊ |
458 | }␊ |
459 | ␊ |
460 | void PerlModDocVisitor::singleItem(const char *name)␊ |
461 | {␊ |
462 | openItem(name);␊ |
463 | closeItem();␊ |
464 | }␊ |
465 | ␊ |
466 | void PerlModDocVisitor::openSubBlock(const char *s)␊ |
467 | {␊ |
468 | leaveText();␊ |
469 | m_output.openList(s);␊ |
470 | m_textblockstart = true;␊ |
471 | }␊ |
472 | ␊ |
473 | void PerlModDocVisitor::closeSubBlock()␊ |
474 | {␊ |
475 | leaveText();␊ |
476 | m_output.closeList();␊ |
477 | }␊ |
478 | ␊ |
479 | void PerlModDocVisitor::openOther()␊ |
480 | {␊ |
481 | // Using a secondary text stream will corrupt the perl file. Instead of␊ |
482 | // printing doc => [ data => [] ], it will print doc => [] data => [].␊ |
483 | /*␊ |
484 | leaveText();␊ |
485 | m_output.openSave();␊ |
486 | */␊ |
487 | }␊ |
488 | ␊ |
489 | void PerlModDocVisitor::closeOther()␊ |
490 | {␊ |
491 | // Using a secondary text stream will corrupt the perl file. Instead of␊ |
492 | // printing doc => [ data => [] ], it will print doc => [] data => [].␊ |
493 | /*␊ |
494 | QCString other;␊ |
495 | leaveText();␊ |
496 | m_output.closeSave(other);␊ |
497 | m_other += other;␊ |
498 | */␊ |
499 | }␊ |
500 | ␊ |
501 | void PerlModDocVisitor::visit(DocWord *w)␊ |
502 | {␊ |
503 | enterText();␊ |
504 | m_output.addQuoted(w->word());␊ |
505 | }␊ |
506 | ␊ |
507 | void PerlModDocVisitor::visit(DocLinkedWord *w)␊ |
508 | {␊ |
509 | openItem("url");␊ |
510 | addLink(w->ref(), w->file(), w->anchor());␊ |
511 | m_output.addFieldQuotedString("content", w->word());␊ |
512 | closeItem();␊ |
513 | }␊ |
514 | ␊ |
515 | void PerlModDocVisitor::visit(DocWhiteSpace *)␊ |
516 | {␊ |
517 | enterText();␊ |
518 | m_output.add(' ');␊ |
519 | }␊ |
520 | ␊ |
521 | void PerlModDocVisitor::visit(DocSymbol *sy)␊ |
522 | {␊ |
523 | char c = 0;␊ |
524 | const char *s = 0;␊ |
525 | const char *accent = 0;␊ |
526 | const char *symbol = 0;␊ |
527 | switch(sy->symbol())␊ |
528 | {␊ |
529 | case DocSymbol::At: c = '@'; break;␊ |
530 | case DocSymbol::Less: c = '<'; break;␊ |
531 | case DocSymbol::Greater: c = '>'; break;␊ |
532 | case DocSymbol::Amp: c = '&'; break;␊ |
533 | case DocSymbol::Dollar: c = '$'; break;␊ |
534 | case DocSymbol::Hash: c = '#'; break;␊ |
535 | case DocSymbol::DoubleColon: s = "::"; break;␊ |
536 | case DocSymbol::Percent: c = '%'; break;␊ |
537 | case DocSymbol::Quot: c = '"'; break;␊ |
538 | case DocSymbol::Lsquo: s = "\\\'"; break;␊ |
539 | case DocSymbol::Rsquo: s = "\\\'"; break;␊ |
540 | case DocSymbol::Ldquo: c = '"'; break;␊ |
541 | case DocSymbol::Rdquo: c = '"'; break;␊ |
542 | case DocSymbol::Ndash: c = '-'; break;␊ |
543 | case DocSymbol::Mdash: s = "--"; break;␊ |
544 | case DocSymbol::Nbsp: c = ' '; break;␊ |
545 | case DocSymbol::Uml: accent = "umlaut"; break;␊ |
546 | case DocSymbol::Acute: accent = "acute"; break;␊ |
547 | case DocSymbol::Grave: accent = "grave"; break;␊ |
548 | case DocSymbol::Circ: accent = "circ"; break;␊ |
549 | case DocSymbol::Slash: accent = "slash"; break;␊ |
550 | case DocSymbol::Tilde: accent = "tilde"; break;␊ |
551 | case DocSymbol::Cedil: accent = "cedilla"; break;␊ |
552 | case DocSymbol::Ring: accent = "ring"; break;␊ |
553 | case DocSymbol::BSlash: s = "\\\\"; break;␊ |
554 | case DocSymbol::Copy: symbol = "copyright"; break;␊ |
555 | case DocSymbol::Tm: symbol = "trademark"; break;␊ |
556 | case DocSymbol::Reg: symbol = "registered"; break;␊ |
557 | case DocSymbol::Szlig: symbol = "szlig"; break;␊ |
558 | case DocSymbol::Apos: s = "\\\'"; break;␊ |
559 | case DocSymbol::Aelig: symbol = "aelig"; break;␊ |
560 | case DocSymbol::AElig: symbol = "AElig"; break;␊ |
561 | case DocSymbol::Unknown: err("error: unknown symbol found\n");␊ |
562 | break;␊ |
563 | }␊ |
564 | if (c != 0) ␊ |
565 | {␊ |
566 | enterText();␊ |
567 | m_output.add(c);␊ |
568 | } ␊ |
569 | else if (s != 0) ␊ |
570 | {␊ |
571 | enterText();␊ |
572 | m_output.add(s);␊ |
573 | } ␊ |
574 | else if (symbol != 0) ␊ |
575 | {␊ |
576 | leaveText();␊ |
577 | openItem("symbol");␊ |
578 | m_output.addFieldQuotedString("symbol", symbol);␊ |
579 | closeItem();␊ |
580 | } ␊ |
581 | else if (accent != 0) ␊ |
582 | {␊ |
583 | leaveText();␊ |
584 | openItem("accent");␊ |
585 | m_output␊ |
586 | .addFieldQuotedString("accent", accent)␊ |
587 | .addFieldQuotedChar("letter", sy->letter());␊ |
588 | closeItem();␊ |
589 | }␊ |
590 | }␊ |
591 | ␊ |
592 | void PerlModDocVisitor::visit(DocURL *u)␊ |
593 | {␊ |
594 | openItem("url");␊ |
595 | m_output.addFieldQuotedString("content", u->url());␊ |
596 | closeItem();␊ |
597 | }␊ |
598 | ␊ |
599 | void PerlModDocVisitor::visit(DocLineBreak *) { singleItem("linebreak"); }␊ |
600 | void PerlModDocVisitor::visit(DocHorRuler *) { singleItem("hruler"); }␊ |
601 | ␊ |
602 | void PerlModDocVisitor::visit(DocStyleChange *s)␊ |
603 | {␊ |
604 | const char *style = 0;␊ |
605 | switch (s->style())␊ |
606 | {␊ |
607 | case DocStyleChange::Bold: style = "bold"; break;␊ |
608 | case DocStyleChange::Italic: style = "italic"; break;␊ |
609 | case DocStyleChange::Code: style = "code"; break;␊ |
610 | case DocStyleChange::Subscript: style = "subscript"; break;␊ |
611 | case DocStyleChange::Superscript: style = "superscript"; break;␊ |
612 | case DocStyleChange::Center: style = "center"; break;␊ |
613 | case DocStyleChange::Small: style = "small"; break;␊ |
614 | case DocStyleChange::Preformatted: style = "preformatted"; break;␊ |
615 | case DocStyleChange::Div: style = "div"; break;␊ |
616 | case DocStyleChange::Span: style = "span"; break;␊ |
617 | ␊ |
618 | }␊ |
619 | openItem("style");␊ |
620 | m_output.addFieldQuotedString("style", style)␊ |
621 | .addFieldBoolean("enable", s->enable());␊ |
622 | closeItem();␊ |
623 | }␊ |
624 | ␊ |
625 | void PerlModDocVisitor::visit(DocVerbatim *s)␊ |
626 | {␊ |
627 | const char *type = 0;␊ |
628 | switch(s->type())␊ |
629 | {␊ |
630 | case DocVerbatim::Code:␊ |
631 | #if 0␊ |
632 | m_output.add("<programlisting>");␊ |
633 | parseCode(m_ci,s->context(),s->text(),FALSE,0);␊ |
634 | m_output.add("</programlisting>");␊ |
635 | #endif␊ |
636 | return;␊ |
637 | case DocVerbatim::Verbatim:␉type = "preformatted"; break;␊ |
638 | case DocVerbatim::HtmlOnly:␉type = "htmlonly"; break;␊ |
639 | case DocVerbatim::ManOnly:␉type = "manonly"; break;␊ |
640 | case DocVerbatim::LatexOnly:␉type = "latexonly"; break;␊ |
641 | case DocVerbatim::XmlOnly:␉type = "xmlonly"; break;␊ |
642 | case DocVerbatim::Dot:␉type = "dot"; break;␊ |
643 | case DocVerbatim::Msc:␉type = "msc"; break;␊ |
644 | }␊ |
645 | openItem(type);␊ |
646 | m_output.addFieldQuotedString("content", s->text());␊ |
647 | closeItem();␊ |
648 | }␊ |
649 | ␊ |
650 | void PerlModDocVisitor::visit(DocAnchor *anc)␊ |
651 | {␊ |
652 | QCString anchor = anc->file() + "_1" + anc->anchor();␊ |
653 | openItem("anchor");␊ |
654 | m_output.addFieldQuotedString("id", anchor);␊ |
655 | closeItem();␊ |
656 | }␊ |
657 | ␊ |
658 | void PerlModDocVisitor::visit(DocInclude *inc)␊ |
659 | {␊ |
660 | const char *type = 0;␊ |
661 | switch(inc->type())␊ |
662 | {␊ |
663 | case DocInclude::IncWithLines:␊ |
664 | #if 0␊ |
665 | { ␊ |
666 | m_t << "<div class=\"fragment\"><pre>";␊ |
667 | QFileInfo cfi( inc->file() );␊ |
668 | FileDef fd( cfi.dirPath(), cfi.fileName() );␊ |
669 | parseCode(m_ci,inc->context(),inc->text().latin1(),inc->isExample(),inc->exampleFile(), &fd);␊ |
670 | m_t << "</pre></div>"; ␊ |
671 | }␊ |
672 | break;␊ |
673 | #endif␊ |
674 | return;␊ |
675 | case DocInclude::Include:␊ |
676 | #if 0␊ |
677 | m_output.add("<programlisting>");␊ |
678 | parseCode(m_ci,inc->context(),inc->text(),FALSE,0);␊ |
679 | m_output.add("</programlisting>");␊ |
680 | #endif␊ |
681 | return;␊ |
682 | case DocInclude::DontInclude:␉return;␊ |
683 | case DocInclude::HtmlInclude:␉type = "htmlonly"; break;␊ |
684 | case DocInclude::VerbInclude:␉type = "preformatted"; break;␊ |
685 | }␊ |
686 | openItem(type);␊ |
687 | m_output.addFieldQuotedString("content", inc->text());␊ |
688 | closeItem();␊ |
689 | }␊ |
690 | ␊ |
691 | void PerlModDocVisitor::visit(DocIncOperator *)␊ |
692 | {␊ |
693 | #if 0␊ |
694 | //printf("DocIncOperator: type=%d first=%d, last=%d text=`%s'\n",␊ |
695 | // op->type(),op->isFirst(),op->isLast(),op->text().data());␊ |
696 | if (op->isFirst())␊ |
697 | {␊ |
698 | m_output.add("<programlisting>");␊ |
699 | }␊ |
700 | if (op->type()!=DocIncOperator::Skip)␊ |
701 | {␊ |
702 | parseCode(m_ci,op->context(),op->text(),FALSE,0);␊ |
703 | }␊ |
704 | if (op->isLast()) ␊ |
705 | {␊ |
706 | m_output.add("</programlisting>");␊ |
707 | }␊ |
708 | else␊ |
709 | {␊ |
710 | m_output.add('\n');␊ |
711 | }␊ |
712 | #endif␊ |
713 | }␊ |
714 | ␊ |
715 | void PerlModDocVisitor::visit(DocFormula *f)␊ |
716 | {␊ |
717 | openItem("formula");␊ |
718 | QCString id;␊ |
719 | id += f->id();␊ |
720 | m_output.addFieldQuotedString("id", id).addFieldQuotedString("content", f->text());␊ |
721 | closeItem();␊ |
722 | }␊ |
723 | ␊ |
724 | void PerlModDocVisitor::visit(DocIndexEntry *)␊ |
725 | {␊ |
726 | #if 0␊ |
727 | m_output.add("<indexentry>"␊ |
728 | ␉ "<primaryie>");␊ |
729 | m_output.addQuoted(ie->entry());␊ |
730 | m_output.add("</primaryie>"␊ |
731 | ␉ "<secondaryie></secondaryie>"␊ |
732 | ␉ "</indexentry>");␊ |
733 | #endif␊ |
734 | }␊ |
735 | ␊ |
736 | void PerlModDocVisitor::visit(DocSimpleSectSep *)␊ |
737 | {␊ |
738 | }␊ |
739 | ␊ |
740 | //--------------------------------------␊ |
741 | // visitor functions for compound nodes␊ |
742 | //--------------------------------------␊ |
743 | ␊ |
744 | void PerlModDocVisitor::visitPre(DocAutoList *l)␊ |
745 | {␊ |
746 | openItem("list");␊ |
747 | m_output.addFieldQuotedString("style", l->isEnumList() ? "ordered" : "itemized");␊ |
748 | openSubBlock("content");␊ |
749 | }␊ |
750 | ␊ |
751 | void PerlModDocVisitor::visitPost(DocAutoList *)␊ |
752 | {␊ |
753 | closeSubBlock();␊ |
754 | closeItem();␊ |
755 | }␊ |
756 | ␊ |
757 | void PerlModDocVisitor::visitPre(DocAutoListItem *)␊ |
758 | {␊ |
759 | openSubBlock();␊ |
760 | }␊ |
761 | ␊ |
762 | void PerlModDocVisitor::visitPost(DocAutoListItem *)␊ |
763 | {␊ |
764 | closeSubBlock();␊ |
765 | }␊ |
766 | ␊ |
767 | void PerlModDocVisitor::visitPre(DocPara *)␊ |
768 | {␊ |
769 | if (m_textblockstart)␊ |
770 | m_textblockstart = false;␊ |
771 | else␊ |
772 | singleItem("parbreak");␊ |
773 | /*␊ |
774 | openItem("para");␊ |
775 | openSubBlock("content");␊ |
776 | */␊ |
777 | }␊ |
778 | ␊ |
779 | void PerlModDocVisitor::visitPost(DocPara *)␊ |
780 | {␊ |
781 | /*␊ |
782 | closeSubBlock();␊ |
783 | closeItem();␊ |
784 | */␊ |
785 | }␊ |
786 | ␊ |
787 | void PerlModDocVisitor::visitPre(DocRoot *)␊ |
788 | {␊ |
789 | }␊ |
790 | ␊ |
791 | void PerlModDocVisitor::visitPost(DocRoot *)␊ |
792 | {␊ |
793 | }␊ |
794 | ␊ |
795 | void PerlModDocVisitor::visitPre(DocSimpleSect *s)␊ |
796 | {␊ |
797 | const char *type = 0;␊ |
798 | switch (s->type())␊ |
799 | {␊ |
800 | case DocSimpleSect::See:␉␉type = "see"; break;␊ |
801 | case DocSimpleSect::Return:␉␉type = "return"; break;␊ |
802 | case DocSimpleSect::Author:␉␉type = "author"; break;␊ |
803 | case DocSimpleSect::Authors:␉␉type = "authors"; break;␊ |
804 | case DocSimpleSect::Version:␉␉type = "version"; break;␊ |
805 | case DocSimpleSect::Since:␉␉type = "since"; break;␊ |
806 | case DocSimpleSect::Date:␉␉type = "date"; break;␊ |
807 | case DocSimpleSect::Note:␉␉type = "note"; break;␊ |
808 | case DocSimpleSect::Warning:␉␉type = "warning"; break;␊ |
809 | case DocSimpleSect::Pre:␉␉type = "pre"; break;␊ |
810 | case DocSimpleSect::Post:␉␉type = "post"; break;␊ |
811 | case DocSimpleSect::Invar:␉␉type = "invariant"; break;␊ |
812 | case DocSimpleSect::Remark:␉␉type = "remark"; break;␊ |
813 | case DocSimpleSect::Attention:␉type = "attention"; break;␊ |
814 | case DocSimpleSect::User:␉␉type = "par"; break;␊ |
815 | case DocSimpleSect::Rcs:␉␉type = "rcs"; break;␊ |
816 | case DocSimpleSect::Unknown:␊ |
817 | err("error: unknown simple section found\n");␊ |
818 | break;␊ |
819 | }␊ |
820 | leaveText();␊ |
821 | m_output.openHash();␊ |
822 | openOther();␊ |
823 | openSubBlock(type);␊ |
824 | }␊ |
825 | ␊ |
826 | void PerlModDocVisitor::visitPost(DocSimpleSect *)␊ |
827 | {␊ |
828 | closeSubBlock();␊ |
829 | closeOther();␊ |
830 | m_output.closeHash();␊ |
831 | }␊ |
832 | ␊ |
833 | void PerlModDocVisitor::visitPre(DocTitle *)␊ |
834 | {␊ |
835 | openItem("title");␊ |
836 | openSubBlock("content");␊ |
837 | }␊ |
838 | ␊ |
839 | void PerlModDocVisitor::visitPost(DocTitle *)␊ |
840 | {␊ |
841 | closeSubBlock();␊ |
842 | closeItem();␊ |
843 | }␊ |
844 | ␊ |
845 | void PerlModDocVisitor::visitPre(DocSimpleList *) ␊ |
846 | {␊ |
847 | openItem("list");␊ |
848 | m_output.addFieldQuotedString("style", "itemized");␊ |
849 | openSubBlock("content");␊ |
850 | }␊ |
851 | ␊ |
852 | void PerlModDocVisitor::visitPost(DocSimpleList *)␊ |
853 | {␊ |
854 | closeSubBlock();␊ |
855 | closeItem();␊ |
856 | }␊ |
857 | ␊ |
858 | void PerlModDocVisitor::visitPre(DocSimpleListItem *) { openSubBlock(); }␊ |
859 | void PerlModDocVisitor::visitPost(DocSimpleListItem *) { closeSubBlock(); }␊ |
860 | ␊ |
861 | void PerlModDocVisitor::visitPre(DocSection *s)␊ |
862 | {␊ |
863 | QCString sect = QCString().sprintf("sect%d",s->level());␊ |
864 | openItem(sect);␊ |
865 | openSubBlock("content");␊ |
866 | }␊ |
867 | ␊ |
868 | void PerlModDocVisitor::visitPost(DocSection *)␊ |
869 | {␊ |
870 | closeSubBlock();␊ |
871 | closeItem();␊ |
872 | }␊ |
873 | ␊ |
874 | void PerlModDocVisitor::visitPre(DocHtmlList *l)␊ |
875 | {␊ |
876 | openItem("list");␊ |
877 | m_output.addFieldQuotedString("style", (l->type() == DocHtmlList::Ordered) ? "ordered" : "itemized");␊ |
878 | openSubBlock("content");␊ |
879 | }␊ |
880 | ␊ |
881 | void PerlModDocVisitor::visitPost(DocHtmlList *)␊ |
882 | {␊ |
883 | closeSubBlock();␊ |
884 | closeItem();␊ |
885 | }␊ |
886 | ␊ |
887 | void PerlModDocVisitor::visitPre(DocHtmlListItem *) { openSubBlock(); }␊ |
888 | void PerlModDocVisitor::visitPost(DocHtmlListItem *) { closeSubBlock(); }␊ |
889 | ␊ |
890 | //void PerlModDocVisitor::visitPre(DocHtmlPre *)␊ |
891 | //{␊ |
892 | // openItem("preformatted");␊ |
893 | // openSubBlock("content");␊ |
894 | // //m_insidePre=TRUE;␊ |
895 | //}␊ |
896 | ␊ |
897 | //void PerlModDocVisitor::visitPost(DocHtmlPre *)␊ |
898 | //{␊ |
899 | // //m_insidePre=FALSE;␊ |
900 | // closeSubBlock();␊ |
901 | // closeItem();␊ |
902 | //}␊ |
903 | ␊ |
904 | void PerlModDocVisitor::visitPre(DocHtmlDescList *)␊ |
905 | {␊ |
906 | #if 0␊ |
907 | m_output.add("<variablelist>\n");␊ |
908 | #endif␊ |
909 | }␊ |
910 | ␊ |
911 | void PerlModDocVisitor::visitPost(DocHtmlDescList *)␊ |
912 | {␊ |
913 | #if 0␊ |
914 | m_output.add("</variablelist>\n");␊ |
915 | #endif␊ |
916 | }␊ |
917 | ␊ |
918 | void PerlModDocVisitor::visitPre(DocHtmlDescTitle *)␊ |
919 | {␊ |
920 | #if 0␊ |
921 | m_output.add("<varlistentry><term>");␊ |
922 | #endif␊ |
923 | }␊ |
924 | ␊ |
925 | void PerlModDocVisitor::visitPost(DocHtmlDescTitle *)␊ |
926 | {␊ |
927 | #if 0␊ |
928 | m_output.add("</term></varlistentry>\n");␊ |
929 | #endif␊ |
930 | }␊ |
931 | ␊ |
932 | void PerlModDocVisitor::visitPre(DocHtmlDescData *)␊ |
933 | {␊ |
934 | #if 0␊ |
935 | m_output.add("<listitem>");␊ |
936 | #endif␊ |
937 | }␊ |
938 | ␊ |
939 | void PerlModDocVisitor::visitPost(DocHtmlDescData *)␊ |
940 | {␊ |
941 | #if 0␊ |
942 | m_output.add("</listitem>\n");␊ |
943 | #endif␊ |
944 | }␊ |
945 | ␊ |
946 | void PerlModDocVisitor::visitPre(DocHtmlTable *)␊ |
947 | {␊ |
948 | #if 0␊ |
949 | m_output.add("<table rows=\""); m_output.add(t->numRows());␊ |
950 | m_output.add("\" cols=\""); m_output.add(t->numCols()); m_output.add("\">");␊ |
951 | #endif␊ |
952 | }␊ |
953 | ␊ |
954 | void PerlModDocVisitor::visitPost(DocHtmlTable *)␊ |
955 | {␊ |
956 | #if 0␊ |
957 | m_output.add("</table>\n");␊ |
958 | #endif␊ |
959 | }␊ |
960 | ␊ |
961 | void PerlModDocVisitor::visitPre(DocHtmlRow *)␊ |
962 | {␊ |
963 | #if 0␊ |
964 | m_output.add("<row>\n");␊ |
965 | #endif␊ |
966 | }␊ |
967 | ␊ |
968 | void PerlModDocVisitor::visitPost(DocHtmlRow *)␊ |
969 | {␊ |
970 | #if 0␊ |
971 | m_output.add("</row>\n");␊ |
972 | #endif␊ |
973 | }␊ |
974 | ␊ |
975 | void PerlModDocVisitor::visitPre(DocHtmlCell *)␊ |
976 | {␊ |
977 | #if 0␊ |
978 | if (c->isHeading()) m_output.add("<entry thead=\"yes\">"); else m_output.add("<entry thead=\"no\">");␊ |
979 | #endif␊ |
980 | }␊ |
981 | ␊ |
982 | void PerlModDocVisitor::visitPost(DocHtmlCell *)␊ |
983 | {␊ |
984 | #if 0␊ |
985 | m_output.add("</entry>");␊ |
986 | #endif␊ |
987 | }␊ |
988 | ␊ |
989 | void PerlModDocVisitor::visitPre(DocHtmlCaption *)␊ |
990 | {␊ |
991 | #if 0␊ |
992 | m_output.add("<caption>");␊ |
993 | #endif␊ |
994 | }␊ |
995 | ␊ |
996 | void PerlModDocVisitor::visitPost(DocHtmlCaption *)␊ |
997 | {␊ |
998 | #if 0␊ |
999 | m_output.add("</caption>\n");␊ |
1000 | #endif␊ |
1001 | }␊ |
1002 | ␊ |
1003 | void PerlModDocVisitor::visitPre(DocInternal *)␊ |
1004 | {␊ |
1005 | #if 0␊ |
1006 | m_output.add("<internal>");␊ |
1007 | #endif␊ |
1008 | }␊ |
1009 | ␊ |
1010 | void PerlModDocVisitor::visitPost(DocInternal *)␊ |
1011 | {␊ |
1012 | #if 0␊ |
1013 | m_output.add("</internal>");␊ |
1014 | #endif␊ |
1015 | }␊ |
1016 | ␊ |
1017 | void PerlModDocVisitor::visitPre(DocHRef *)␊ |
1018 | {␊ |
1019 | #if 0␊ |
1020 | m_output.add("<ulink url=\""); m_output.add(href->url()); m_output.add("\">");␊ |
1021 | #endif␊ |
1022 | }␊ |
1023 | ␊ |
1024 | void PerlModDocVisitor::visitPost(DocHRef *)␊ |
1025 | {␊ |
1026 | #if 0␊ |
1027 | m_output.add("</ulink>");␊ |
1028 | #endif␊ |
1029 | }␊ |
1030 | ␊ |
1031 | void PerlModDocVisitor::visitPre(DocHtmlHeader *)␊ |
1032 | {␊ |
1033 | #if 0␊ |
1034 | m_output.add("<sect"); m_output.add(header->level()); m_output.add(">");␊ |
1035 | #endif␊ |
1036 | }␊ |
1037 | ␊ |
1038 | void PerlModDocVisitor::visitPost(DocHtmlHeader *)␊ |
1039 | {␊ |
1040 | #if 0␊ |
1041 | m_output.add("</sect"); m_output.add(header->level()); m_output.add(">\n");␊ |
1042 | #endif␊ |
1043 | }␊ |
1044 | ␊ |
1045 | void PerlModDocVisitor::visitPre(DocImage *)␊ |
1046 | {␊ |
1047 | #if 0␊ |
1048 | m_output.add("<image type=\"");␊ |
1049 | switch(img->type())␊ |
1050 | {␊ |
1051 | case DocImage::Html: m_output.add("html"); break;␊ |
1052 | case DocImage::Latex: m_output.add("latex"); break;␊ |
1053 | case DocImage::Rtf: m_output.add("rtf"); break;␊ |
1054 | }␊ |
1055 | m_output.add("\"");␊ |
1056 | ␊ |
1057 | QCString baseName=img->name();␊ |
1058 | int i;␊ |
1059 | if ((i=baseName.findRev('/'))!=-1 || (i=baseName.findRev('\\'))!=-1)␊ |
1060 | {␊ |
1061 | baseName=baseName.right(baseName.length()-i-1);␊ |
1062 | }␊ |
1063 | m_output.add(" name=\""); m_output.add(baseName); m_output.add("\"");␊ |
1064 | if (!img->width().isEmpty())␊ |
1065 | {␊ |
1066 | m_output.add(" width=\"");␊ |
1067 | m_output.addQuoted(img->width());␊ |
1068 | m_output.add("\"");␊ |
1069 | }␊ |
1070 | else if (!img->height().isEmpty())␊ |
1071 | {␊ |
1072 | m_output.add(" height=\"");␊ |
1073 | m_output.addQuoted(img->height());␊ |
1074 | m_output.add("\"");␊ |
1075 | }␊ |
1076 | m_output.add(">");␊ |
1077 | #endif␊ |
1078 | }␊ |
1079 | ␊ |
1080 | void PerlModDocVisitor::visitPost(DocImage *)␊ |
1081 | {␊ |
1082 | #if 0␊ |
1083 | m_output.add("</image>");␊ |
1084 | #endif␊ |
1085 | }␊ |
1086 | ␊ |
1087 | void PerlModDocVisitor::visitPre(DocDotFile *)␊ |
1088 | {␊ |
1089 | #if 0␊ |
1090 | m_output.add("<dotfile name=\""); m_output.add(df->file()); m_output.add("\">");␊ |
1091 | #endif␊ |
1092 | }␊ |
1093 | ␊ |
1094 | void PerlModDocVisitor::visitPost(DocDotFile *)␊ |
1095 | {␊ |
1096 | #if 0␊ |
1097 | m_output.add("</dotfile>");␊ |
1098 | #endif␊ |
1099 | }␊ |
1100 | void PerlModDocVisitor::visitPre(DocMscFile *)␊ |
1101 | {␊ |
1102 | #if 0␊ |
1103 | m_output.add("<mscfile name=\""); m_output.add(df->file()); m_output.add("\">");␊ |
1104 | #endif␊ |
1105 | }␊ |
1106 | ␊ |
1107 | void PerlModDocVisitor::visitPost(DocMscFile *)␊ |
1108 | {␊ |
1109 | #if 0␊ |
1110 | m_output.add("<mscfile>");␊ |
1111 | #endif␊ |
1112 | }␊ |
1113 | ␊ |
1114 | ␊ |
1115 | void PerlModDocVisitor::visitPre(DocLink *lnk)␊ |
1116 | {␊ |
1117 | openItem("link");␊ |
1118 | addLink(lnk->ref(), lnk->file(), lnk->anchor());␊ |
1119 | }␊ |
1120 | ␊ |
1121 | void PerlModDocVisitor::visitPost(DocLink *)␊ |
1122 | {␊ |
1123 | closeItem();␊ |
1124 | }␊ |
1125 | ␊ |
1126 | void PerlModDocVisitor::visitPre(DocRef *ref)␊ |
1127 | {␊ |
1128 | openItem("ref");␊ |
1129 | if (!ref->hasLinkText())␊ |
1130 | m_output.addFieldQuotedString("text", ref->targetTitle());␊ |
1131 | openSubBlock("content");␊ |
1132 | }␊ |
1133 | ␊ |
1134 | void PerlModDocVisitor::visitPost(DocRef *)␊ |
1135 | {␊ |
1136 | closeSubBlock();␊ |
1137 | closeItem();␊ |
1138 | }␊ |
1139 | ␊ |
1140 | void PerlModDocVisitor::visitPre(DocSecRefItem *)␊ |
1141 | {␊ |
1142 | #if 0␊ |
1143 | m_output.add("<tocitem id=\""); m_output.add(ref->file()); m_output.add("_1"); m_output.add(ref->anchor()); m_output.add("\">");␊ |
1144 | #endif␊ |
1145 | }␊ |
1146 | ␊ |
1147 | void PerlModDocVisitor::visitPost(DocSecRefItem *)␊ |
1148 | {␊ |
1149 | #if 0␊ |
1150 | m_output.add("</tocitem>");␊ |
1151 | #endif␊ |
1152 | }␊ |
1153 | ␊ |
1154 | void PerlModDocVisitor::visitPre(DocSecRefList *)␊ |
1155 | {␊ |
1156 | #if 0␊ |
1157 | m_output.add("<toclist>");␊ |
1158 | #endif␊ |
1159 | }␊ |
1160 | ␊ |
1161 | void PerlModDocVisitor::visitPost(DocSecRefList *)␊ |
1162 | {␊ |
1163 | #if 0␊ |
1164 | m_output.add("</toclist>");␊ |
1165 | #endif␊ |
1166 | }␊ |
1167 | ␊ |
1168 | //void PerlModDocVisitor::visitPre(DocLanguage *l)␊ |
1169 | //{␊ |
1170 | // openItem("language");␊ |
1171 | // m_output.addFieldQuotedString("id", l->id());␊ |
1172 | //}␊ |
1173 | //␊ |
1174 | //void PerlModDocVisitor::visitPost(DocLanguage *)␊ |
1175 | //{␊ |
1176 | // closeItem();␊ |
1177 | //}␊ |
1178 | ␊ |
1179 | void PerlModDocVisitor::visitPre(DocParamSect *s)␊ |
1180 | {␊ |
1181 | leaveText();␊ |
1182 | const char *type = 0;␊ |
1183 | switch(s->type())␊ |
1184 | {␊ |
1185 | case DocParamSect::Param: type = "params"; break;␊ |
1186 | case DocParamSect::RetVal: type = "retvals"; break;␊ |
1187 | case DocParamSect::Exception: type = "exceptions"; break;␊ |
1188 | case DocParamSect::TemplateParam: type = "templateparam"; break;␊ |
1189 | case DocParamSect::Unknown:␊ |
1190 | err("error: unknown parameter section found\n");␊ |
1191 | break;␊ |
1192 | }␊ |
1193 | openOther();␊ |
1194 | openSubBlock(type);␊ |
1195 | }␊ |
1196 | ␊ |
1197 | void PerlModDocVisitor::visitPost(DocParamSect *)␊ |
1198 | {␊ |
1199 | closeSubBlock();␊ |
1200 | closeOther();␊ |
1201 | }␊ |
1202 | ␊ |
1203 | void PerlModDocVisitor::visitPre(DocParamList *pl)␊ |
1204 | {␊ |
1205 | leaveText();␊ |
1206 | m_output.openHash()␊ |
1207 | .openList("parameters");␊ |
1208 | //QStrListIterator li(pl->parameters());␊ |
1209 | //const char *s;␊ |
1210 | QListIterator<DocNode> li(pl->parameters());␊ |
1211 | DocNode *param;␊ |
1212 | for (li.toFirst();(param=li.current());++li)␊ |
1213 | {␊ |
1214 | QCString s;␊ |
1215 | if (param->kind()==DocNode::Kind_Word)␊ |
1216 | {␊ |
1217 | s = ((DocWord*)param)->word(); ␊ |
1218 | }␊ |
1219 | else if (param->kind()==DocNode::Kind_LinkedWord)␊ |
1220 | {␊ |
1221 | s = ((DocLinkedWord*)param)->word(); ␊ |
1222 | }␊ |
1223 | m_output.openHash()␊ |
1224 | .addFieldQuotedString("name", s)␊ |
1225 | .closeHash();␊ |
1226 | }␊ |
1227 | m_output.closeList()␊ |
1228 | .openList("doc");␊ |
1229 | }␊ |
1230 | ␊ |
1231 | void PerlModDocVisitor::visitPost(DocParamList *)␊ |
1232 | {␊ |
1233 | leaveText();␊ |
1234 | m_output.closeList()␊ |
1235 | .closeHash();␊ |
1236 | }␊ |
1237 | ␊ |
1238 | void PerlModDocVisitor::visitPre(DocXRefItem *)␊ |
1239 | {␊ |
1240 | #if 0␊ |
1241 | m_output.add("<xrefsect id=\"");␊ |
1242 | m_output.add(x->file()); m_output.add("_1"); m_output.add(x->anchor());␊ |
1243 | m_output.add("\">");␊ |
1244 | m_output.add("<xreftitle>");␊ |
1245 | m_output.addQuoted(x->title());␊ |
1246 | m_output.add("</xreftitle>");␊ |
1247 | m_output.add("<xrefdescription>");␊ |
1248 | #endif␊ |
1249 | openItem("xrefitem");␊ |
1250 | openSubBlock("content");␊ |
1251 | }␊ |
1252 | ␊ |
1253 | void PerlModDocVisitor::visitPost(DocXRefItem *)␊ |
1254 | {␊ |
1255 | closeSubBlock();␊ |
1256 | closeItem();␊ |
1257 | #if 0␊ |
1258 | m_output.add("</xrefdescription>");␊ |
1259 | m_output.add("</xrefsect>");␊ |
1260 | #endif␊ |
1261 | }␊ |
1262 | ␊ |
1263 | void PerlModDocVisitor::visitPre(DocInternalRef *ref)␊ |
1264 | {␊ |
1265 | openItem("ref");␊ |
1266 | addLink(0,ref->file(),ref->anchor());␊ |
1267 | openSubBlock("content");␊ |
1268 | }␊ |
1269 | ␊ |
1270 | void PerlModDocVisitor::visitPost(DocInternalRef *)␊ |
1271 | {␊ |
1272 | closeSubBlock();␊ |
1273 | closeItem();␊ |
1274 | }␊ |
1275 | ␊ |
1276 | void PerlModDocVisitor::visitPre(DocCopy *)␊ |
1277 | {␊ |
1278 | }␊ |
1279 | ␊ |
1280 | void PerlModDocVisitor::visitPost(DocCopy *)␊ |
1281 | {␊ |
1282 | }␊ |
1283 | ␊ |
1284 | void PerlModDocVisitor::visitPre(DocText *)␊ |
1285 | {␊ |
1286 | }␊ |
1287 | ␊ |
1288 | void PerlModDocVisitor::visitPost(DocText *)␊ |
1289 | {␊ |
1290 | }␊ |
1291 | ␊ |
1292 | static void addTemplateArgumentList(ArgumentList *al,PerlModOutput &output,const char *)␊ |
1293 | {␊ |
1294 | QCString indentStr;␊ |
1295 | if (!al)␊ |
1296 | return;␊ |
1297 | output.openList("template_parameters");␊ |
1298 | ArgumentListIterator ali(*al);␊ |
1299 | Argument *a;␊ |
1300 | for (ali.toFirst();(a=ali.current());++ali)␊ |
1301 | {␊ |
1302 | output.openHash();␊ |
1303 | if (!a->type.isEmpty())␊ |
1304 | output.addFieldQuotedString("type", a->type);␊ |
1305 | if (!a->name.isEmpty())␊ |
1306 | output.addFieldQuotedString("declaration_name", a->name)␊ |
1307 | ␉.addFieldQuotedString("definition_name", a->name);␊ |
1308 | if (!a->defval.isEmpty())␊ |
1309 | output.addFieldQuotedString("default", a->defval);␊ |
1310 | output.closeHash();␊ |
1311 | }␊ |
1312 | output.closeList();␊ |
1313 | }␊ |
1314 | ␊ |
1315 | #if 0␊ |
1316 | static void addMemberTemplateLists(MemberDef *md,PerlModOutput &output)␊ |
1317 | {␊ |
1318 | ClassDef *cd = md->getClassDef();␊ |
1319 | const char *cname = cd ? cd->name().data() : 0;␊ |
1320 | if (md->templateArguments()) // function template prefix␊ |
1321 | addTemplateArgumentList(md->templateArguments(),output,cname);␊ |
1322 | }␊ |
1323 | #endif␊ |
1324 | ␊ |
1325 | static void addTemplateList(ClassDef *cd,PerlModOutput &output)␊ |
1326 | {␊ |
1327 | addTemplateArgumentList(cd->templateArguments(),output,cd->name());␊ |
1328 | }␊ |
1329 | ␊ |
1330 | static void addPerlModDocBlock(PerlModOutput &output,␊ |
1331 | ␉␉␉ const char *name,␊ |
1332 | ␉␉␉ const QCString &fileName,␊ |
1333 | ␉␉␉ int lineNr,␊ |
1334 | ␉␉␉ Definition *scope,␊ |
1335 | ␉␉␉ MemberDef *md,␊ |
1336 | ␉␉␉ const QCString &text)␊ |
1337 | {␊ |
1338 | QCString stext = text.stripWhiteSpace();␊ |
1339 | if (stext.isEmpty())␊ |
1340 | output.addField(name).add("{}");␊ |
1341 | else {␊ |
1342 | DocNode *root = validatingParseDoc(fileName,lineNr,scope,md,stext,FALSE,0);␊ |
1343 | output.openHash(name);␊ |
1344 | PerlModDocVisitor *visitor = new PerlModDocVisitor(output);␊ |
1345 | root->accept(visitor);␊ |
1346 | visitor->finish();␊ |
1347 | output.closeHash();␊ |
1348 | delete visitor;␊ |
1349 | delete root;␊ |
1350 | }␊ |
1351 | }␊ |
1352 | ␊ |
1353 | static const char *getProtectionName(Protection prot) ␊ |
1354 | {␊ |
1355 | switch (prot)␊ |
1356 | {␊ |
1357 | case Public: return "public";␊ |
1358 | case Protected: return "protected";␊ |
1359 | case Private: return "private";␊ |
1360 | case Package: return "package";␊ |
1361 | }␊ |
1362 | return 0;␊ |
1363 | }␊ |
1364 | ␊ |
1365 | static const char *getVirtualnessName(Specifier virt)␊ |
1366 | {␊ |
1367 | switch(virt)␊ |
1368 | {␊ |
1369 | case Normal: return "non_virtual";␊ |
1370 | case Virtual: return "virtual";␊ |
1371 | case Pure: return "pure_virtual";␊ |
1372 | }␊ |
1373 | return 0;␊ |
1374 | }␊ |
1375 | ␊ |
1376 | static QCString pathDoxyfile;␊ |
1377 | static QCString pathDoxyExec;␊ |
1378 | ␊ |
1379 | void setPerlModDoxyfile(const QCString &qs)␊ |
1380 | {␊ |
1381 | pathDoxyfile = qs;␊ |
1382 | pathDoxyExec = QDir::currentDirPath();␊ |
1383 | }␊ |
1384 | ␊ |
1385 | class PerlModGenerator␊ |
1386 | {␊ |
1387 | public:␊ |
1388 | ␊ |
1389 | PerlModOutput m_output;␊ |
1390 | ␊ |
1391 | QCString pathDoxyStructurePM;␊ |
1392 | QCString pathDoxyDocsTex;␊ |
1393 | QCString pathDoxyFormatTex;␊ |
1394 | QCString pathDoxyLatexTex;␊ |
1395 | QCString pathDoxyLatexDVI;␊ |
1396 | QCString pathDoxyLatexPDF;␊ |
1397 | QCString pathDoxyStructureTex;␊ |
1398 | QCString pathDoxyDocsPM;␊ |
1399 | QCString pathDoxyLatexPL;␊ |
1400 | QCString pathDoxyLatexStructurePL;␊ |
1401 | QCString pathDoxyRules;␊ |
1402 | QCString pathMakefile;␊ |
1403 | ␊ |
1404 | inline PerlModGenerator(bool pretty) : m_output(pretty) { }␊ |
1405 | ␊ |
1406 | void generatePerlModForMember(MemberDef *md, Definition *);␊ |
1407 | void generatePerlModSection(Definition *d, MemberList *ml,␊ |
1408 | ␉␉␉ const char *name, const char *header=0);␊ |
1409 | void addListOfAllMembers(ClassDef *cd);␊ |
1410 | void generatePerlModForClass(ClassDef *cd);␊ |
1411 | void generatePerlModForNamespace(NamespaceDef *nd);␊ |
1412 | void generatePerlModForFile(FileDef *fd);␊ |
1413 | void generatePerlModForGroup(GroupDef *gd);␊ |
1414 | void generatePerlModForPage(PageDef *pi);␊ |
1415 | ␊ |
1416 | bool createOutputFile(QFile &f, const char *s);␊ |
1417 | bool createOutputDir(QDir &perlModDir);␊ |
1418 | bool generateDoxyLatexTex();␊ |
1419 | bool generateDoxyFormatTex();␊ |
1420 | bool generateDoxyStructurePM();␊ |
1421 | bool generateDoxyLatexPL();␊ |
1422 | bool generateDoxyLatexStructurePL();␊ |
1423 | bool generateDoxyRules();␊ |
1424 | bool generateMakefile();␊ |
1425 | bool generatePerlModOutput();␊ |
1426 | ␊ |
1427 | void generate();␊ |
1428 | };␊ |
1429 | ␊ |
1430 | void PerlModGenerator::generatePerlModForMember(MemberDef *md,Definition *)␊ |
1431 | {␊ |
1432 | // + declaration/definition arg lists␊ |
1433 | // + reimplements␊ |
1434 | // + reimplementedBy␊ |
1435 | // + exceptions␊ |
1436 | // + const/volatile specifiers␊ |
1437 | // - examples␊ |
1438 | // - source definition␊ |
1439 | // - source references␊ |
1440 | // - source referenced by␊ |
1441 | // - body code␊ |
1442 | // - template arguments␊ |
1443 | // (templateArguments(), definitionTemplateParameterLists())␊ |
1444 | ␊ |
1445 | QCString memType;␊ |
1446 | bool isFunc=FALSE;␊ |
1447 | switch (md->memberType())␊ |
1448 | {␊ |
1449 | case MemberDef::Define: memType="define"; break;␊ |
1450 | case MemberDef::EnumValue: memType="enumvalue"; break;␊ |
1451 | case MemberDef::Property: memType="property"; break;␊ |
1452 | case MemberDef::Variable: memType="variable"; break;␊ |
1453 | case MemberDef::Typedef: memType="typedef"; break;␊ |
1454 | case MemberDef::Enumeration: memType="enum"; break;␊ |
1455 | case MemberDef::Function: memType="function"; isFunc=TRUE; break;␊ |
1456 | case MemberDef::Signal: memType="signal"; isFunc=TRUE; break;␊ |
1457 | //case MemberDef::Prototype: memType="prototype"; isFunc=TRUE; break;␊ |
1458 | case MemberDef::Friend: memType="friend"; isFunc=TRUE; break;␊ |
1459 | case MemberDef::DCOP: memType="dcop"; isFunc=TRUE; break;␊ |
1460 | case MemberDef::Slot: memType="slot"; isFunc=TRUE; break;␊ |
1461 | case MemberDef::Event: memType="event"; break;␊ |
1462 | }␊ |
1463 | ␊ |
1464 | m_output.openHash()␊ |
1465 | .addFieldQuotedString("kind", memType)␊ |
1466 | .addFieldQuotedString("name", md->name())␊ |
1467 | .addFieldQuotedString("virtualness", getVirtualnessName(md->virtualness()))␊ |
1468 | .addFieldQuotedString("protection", getProtectionName(md->protection()))␊ |
1469 | .addFieldBoolean("static", md->isStatic());␊ |
1470 | ␊ |
1471 | addPerlModDocBlock(m_output,"brief",md->getDefFileName(),md->getDefLine(),md->getOuterScope(),md,md->briefDescription());␊ |
1472 | addPerlModDocBlock(m_output,"detailed",md->getDefFileName(),md->getDefLine(),md->getOuterScope(),md,md->documentation());␊ |
1473 | if (md->memberType()!=MemberDef::Define &&␊ |
1474 | md->memberType()!=MemberDef::Enumeration)␊ |
1475 | m_output.addFieldQuotedString("type", md->typeString());␊ |
1476 | ␊ |
1477 | LockingPtr<ArgumentList> al = md->argumentList();␊ |
1478 | if (isFunc) //function␊ |
1479 | {␊ |
1480 | m_output.addFieldBoolean("const", al!=0 && al->constSpecifier)␊ |
1481 | .addFieldBoolean("volatile", al!=0 && al->volatileSpecifier);␊ |
1482 | ␊ |
1483 | m_output.openList("parameters");␊ |
1484 | LockingPtr<ArgumentList> declAl = md->declArgumentList();␊ |
1485 | LockingPtr<ArgumentList> defAl = md->argumentList();␊ |
1486 | if (declAl!=0 && declAl->count()>0)␊ |
1487 | {␊ |
1488 | ArgumentListIterator declAli(*declAl);␊ |
1489 | ArgumentListIterator defAli(*defAl);␊ |
1490 | Argument *a;␊ |
1491 | for (declAli.toFirst();(a=declAli.current());++declAli)␊ |
1492 | {␊ |
1493 | ␉Argument *defArg = defAli.current();␊ |
1494 | ␉m_output.openHash();␊ |
1495 | ␊ |
1496 | ␉if (!a->name.isEmpty())␊ |
1497 | ␉ m_output.addFieldQuotedString("declaration_name", a->name);␊ |
1498 | ␊ |
1499 | ␉if (defArg && !defArg->name.isEmpty() && defArg->name!=a->name)␊ |
1500 | ␉ m_output.addFieldQuotedString("definition_name", defArg->name);␊ |
1501 | ␊ |
1502 | ␉if (!a->type.isEmpty())␊ |
1503 | ␉ m_output.addFieldQuotedString("type", a->type);␊ |
1504 | ␊ |
1505 | ␉if (!a->array.isEmpty())␊ |
1506 | ␉ m_output.addFieldQuotedString("array", a->array);␊ |
1507 | ␊ |
1508 | ␉if (!a->defval.isEmpty())␊ |
1509 | ␉ m_output.addFieldQuotedString("default_value", a->defval);␊ |
1510 | ␊ |
1511 | ␉if (!a->attrib.isEmpty())␊ |
1512 | ␉ m_output.addFieldQuotedString("attributes", a->attrib);␊ |
1513 | ␉␊ |
1514 | ␉m_output.closeHash();␊ |
1515 | ␉if (defArg) ++defAli;␊ |
1516 | }␊ |
1517 | }␊ |
1518 | m_output.closeList();␊ |
1519 | }␊ |
1520 | else if (md->memberType()==MemberDef::Define &&␊ |
1521 | ␉ md->argsString()!=0) // define␊ |
1522 | {␊ |
1523 | m_output.openList("parameters");␊ |
1524 | ArgumentListIterator ali(*al);␊ |
1525 | Argument *a;␊ |
1526 | for (ali.toFirst();(a=ali.current());++ali)␊ |
1527 | {␊ |
1528 | m_output.openHash()␊ |
1529 | ␉.addFieldQuotedString("name", a->type)␊ |
1530 | ␉.closeHash();␊ |
1531 | }␊ |
1532 | m_output.closeList();␊ |
1533 | }␊ |
1534 | if (!md->initializer().isEmpty())␊ |
1535 | m_output.addFieldQuotedString("initializer", md->initializer());␊ |
1536 | ␊ |
1537 | if (md->excpString())␊ |
1538 | m_output.addFieldQuotedString("exceptions", md->excpString());␊ |
1539 | ␊ |
1540 | if (md->memberType()==MemberDef::Enumeration) // enum␊ |
1541 | {␊ |
1542 | LockingPtr<MemberList> enumFields = md->enumFieldList();␊ |
1543 | if (enumFields!=0)␊ |
1544 | {␊ |
1545 | m_output.openList("values");␊ |
1546 | MemberListIterator emli(*enumFields);␊ |
1547 | MemberDef *emd;␊ |
1548 | for (emli.toFirst();(emd=emli.current());++emli)␊ |
1549 | {␊ |
1550 | ␉m_output.openHash()␊ |
1551 | ␉ .addFieldQuotedString("name", emd->name());␊ |
1552 | ␉ ␊ |
1553 | ␉if (!emd->initializer().isEmpty())␊ |
1554 | ␉ m_output.addFieldQuotedString("initializer", emd->initializer());␊ |
1555 | ␊ |
1556 | ␉addPerlModDocBlock(m_output,"brief",emd->getDefFileName(),emd->getDefLine(),emd->getOuterScope(),emd,emd->briefDescription());␊ |
1557 | ␊ |
1558 | ␉addPerlModDocBlock(m_output,"detailed",emd->getDefFileName(),emd->getDefLine(),emd->getOuterScope(),emd,emd->documentation());␊ |
1559 | ␊ |
1560 | ␉m_output.closeHash();␊ |
1561 | }␊ |
1562 | m_output.closeList();␊ |
1563 | }␊ |
1564 | }␊ |
1565 | ␊ |
1566 | MemberDef *rmd = md->reimplements();␊ |
1567 | if (rmd)␊ |
1568 | m_output.openHash("reimplements")␊ |
1569 | .addFieldQuotedString("name", rmd->name())␊ |
1570 | .closeHash();␊ |
1571 | ␊ |
1572 | LockingPtr<MemberList> rbml = md->reimplementedBy();␊ |
1573 | if (rbml!=0)␊ |
1574 | {␊ |
1575 | MemberListIterator mli(*rbml);␊ |
1576 | m_output.openList("reimplemented_by");␊ |
1577 | for (mli.toFirst();(rmd=mli.current());++mli)␊ |
1578 | m_output.openHash()␊ |
1579 | ␉.addFieldQuotedString("name", rmd->name())␊ |
1580 | ␉.closeHash();␊ |
1581 | m_output.closeList();␊ |
1582 | }␊ |
1583 | ␊ |
1584 | m_output.closeHash();␊ |
1585 | }␊ |
1586 | ␊ |
1587 | void PerlModGenerator::generatePerlModSection(Definition *d,␊ |
1588 | ␉␉␉␉␉ MemberList *ml,const char *name,const char *header)␊ |
1589 | {␊ |
1590 | if (ml==0) return; // empty list␊ |
1591 | ␊ |
1592 | m_output.openHash(name);␊ |
1593 | ␊ |
1594 | if (header)␊ |
1595 | m_output.addFieldQuotedString("header", header);␊ |
1596 | ␊ |
1597 | m_output.openList("members");␊ |
1598 | MemberListIterator mli(*ml);␊ |
1599 | MemberDef *md;␊ |
1600 | for (mli.toFirst();(md=mli.current());++mli)␊ |
1601 | {␊ |
1602 | generatePerlModForMember(md,d);␊ |
1603 | }␊ |
1604 | m_output.closeList()␊ |
1605 | .closeHash();␊ |
1606 | }␊ |
1607 | ␊ |
1608 | void PerlModGenerator::addListOfAllMembers(ClassDef *cd)␊ |
1609 | {␊ |
1610 | m_output.openList("all_members");␊ |
1611 | if (cd->memberNameInfoSDict())␊ |
1612 | {␊ |
1613 | MemberNameInfoSDict::Iterator mnii(*cd->memberNameInfoSDict());␊ |
1614 | MemberNameInfo *mni;␊ |
1615 | for (mnii.toFirst();(mni=mnii.current());++mnii)␊ |
1616 | {␊ |
1617 | MemberNameInfoIterator mii(*mni);␊ |
1618 | MemberInfo *mi;␊ |
1619 | for (mii.toFirst();(mi=mii.current());++mii)␊ |
1620 | {␊ |
1621 | MemberDef *md=mi->memberDef;␊ |
1622 | ClassDef *cd=md->getClassDef();␊ |
1623 | Definition *d=md->getGroupDef();␊ |
1624 | if (d==0) d = cd;␊ |
1625 | ␊ |
1626 | m_output.openHash()␊ |
1627 | .addFieldQuotedString("name", md->name())␊ |
1628 | .addFieldQuotedString("virtualness", getVirtualnessName(md->virtualness()))␊ |
1629 | .addFieldQuotedString("protection", getProtectionName(mi->prot));␊ |
1630 | ␊ |
1631 | if (!mi->ambiguityResolutionScope.isEmpty())␊ |
1632 | m_output.addFieldQuotedString("ambiguity_scope", mi->ambiguityResolutionScope);␊ |
1633 | ␊ |
1634 | m_output.addFieldQuotedString("scope", cd->name())␊ |
1635 | .closeHash();␊ |
1636 | }␊ |
1637 | }␊ |
1638 | }␊ |
1639 | m_output.closeList();␊ |
1640 | }␊ |
1641 | ␊ |
1642 | void PerlModGenerator::generatePerlModForClass(ClassDef *cd)␊ |
1643 | {␊ |
1644 | // + brief description␊ |
1645 | // + detailed description␊ |
1646 | // + template argument list(s)␊ |
1647 | // - include file␊ |
1648 | // + member groups␊ |
1649 | // + inheritance diagram␊ |
1650 | // + list of direct super classes␊ |
1651 | // + list of direct sub classes␊ |
1652 | // + list of inner classes␊ |
1653 | // + collaboration diagram␊ |
1654 | // + list of all members␊ |
1655 | // + user defined member sections␊ |
1656 | // + standard member sections␊ |
1657 | // + detailed member documentation␊ |
1658 | // - examples using the class␊ |
1659 | ␊ |
1660 | if (cd->isReference()) return; // skip external references.␊ |
1661 | if (cd->name().find('@')!=-1) return; // skip anonymous compounds.␊ |
1662 | if (cd->templateMaster()!=0) return; // skip generated template instances.␊ |
1663 | ␊ |
1664 | m_output.openHash()␊ |
1665 | .addFieldQuotedString("name", cd->name());␊ |
1666 | ␊ |
1667 | if (cd->baseClasses())␊ |
1668 | {␊ |
1669 | m_output.openList("base");␊ |
1670 | BaseClassListIterator bcli(*cd->baseClasses());␊ |
1671 | BaseClassDef *bcd;␊ |
1672 | for (bcli.toFirst();(bcd=bcli.current());++bcli)␊ |
1673 | m_output.openHash()␊ |
1674 | ␉.addFieldQuotedString("name", bcd->classDef->displayName())␊ |
1675 | ␉.addFieldQuotedString("virtualness", getVirtualnessName(bcd->virt))␊ |
1676 | ␉.addFieldQuotedString("protection", getProtectionName(bcd->prot))␊ |
1677 | ␉.closeHash();␊ |
1678 | m_output.closeList();␊ |
1679 | }␊ |
1680 | ␊ |
1681 | if (cd->subClasses())␊ |
1682 | {␊ |
1683 | m_output.openList("derived");␊ |
1684 | BaseClassListIterator bcli(*cd->subClasses());␊ |
1685 | BaseClassDef *bcd;␊ |
1686 | for (bcli.toFirst();(bcd=bcli.current());++bcli)␊ |
1687 | m_output.openHash()␊ |
1688 | ␉.addFieldQuotedString("name", bcd->classDef->displayName())␊ |
1689 | ␉.addFieldQuotedString("virtualness", getVirtualnessName(bcd->virt))␊ |
1690 | ␉.addFieldQuotedString("protection", getProtectionName(bcd->prot))␊ |
1691 | ␉.closeHash();␊ |
1692 | m_output.closeList();␊ |
1693 | }␊ |
1694 | ␊ |
1695 | ClassSDict *cl = cd->getInnerClasses();␊ |
1696 | if (cl)␊ |
1697 | {␊ |
1698 | m_output.openList("inner");␊ |
1699 | ClassSDict::Iterator cli(*cl);␊ |
1700 | ClassDef *cd;␊ |
1701 | for (cli.toFirst();(cd=cli.current());++cli)␊ |
1702 | m_output.openHash()␊ |
1703 | ␉.addFieldQuotedString("name", cd->name())␊ |
1704 | ␉.closeHash();␊ |
1705 | m_output.closeList();␊ |
1706 | }␊ |
1707 | ␊ |
1708 | IncludeInfo *ii=cd->includeInfo();␊ |
1709 | if (ii)␊ |
1710 | {␊ |
1711 | QCString nm = ii->includeName;␊ |
1712 | if (nm.isEmpty() && ii->fileDef) nm = ii->fileDef->docName();␊ |
1713 | if (!nm.isEmpty())␊ |
1714 | {␊ |
1715 | m_output.openHash("includes");␊ |
1716 | #if 0␊ |
1717 | if (ii->fileDef && !ii->fileDef->isReference()) // TODO: support external references␊ |
1718 | t << " id=\"" << ii->fileDef->getOutputFileBase() << "\"";␊ |
1719 | #endif␊ |
1720 | m_output.addFieldBoolean("local", ii->local)␊ |
1721 | ␉.addFieldQuotedString("name", nm)␊ |
1722 | ␉.closeHash();␊ |
1723 | }␊ |
1724 | }␊ |
1725 | ␊ |
1726 | addTemplateList(cd,m_output);␊ |
1727 | addListOfAllMembers(cd);␊ |
1728 | if (cd->getMemberGroupSDict())␊ |
1729 | {␊ |
1730 | MemberGroupSDict::Iterator mgli(*cd->getMemberGroupSDict());␊ |
1731 | MemberGroup *mg;␊ |
1732 | for (;(mg=mgli.current());++mgli)␊ |
1733 | generatePerlModSection(cd,mg->members(),"user_defined",mg->header());␊ |
1734 | }␊ |
1735 | ␊ |
1736 | generatePerlModSection(cd,cd->getMemberList(MemberList::pubTypes),"public_typedefs");␊ |
1737 | generatePerlModSection(cd,cd->getMemberList(MemberList::pubMethods),"public_methods");␊ |
1738 | generatePerlModSection(cd,cd->getMemberList(MemberList::pubAttribs),"public_members");␊ |
1739 | generatePerlModSection(cd,cd->getMemberList(MemberList::pubSlots),"public_slots");␊ |
1740 | generatePerlModSection(cd,cd->getMemberList(MemberList::signals),"signals");␊ |
1741 | generatePerlModSection(cd,cd->getMemberList(MemberList::dcopMethods),"dcop_methods");␊ |
1742 | generatePerlModSection(cd,cd->getMemberList(MemberList::properties),"properties");␊ |
1743 | generatePerlModSection(cd,cd->getMemberList(MemberList::pubStaticMethods),"public_static_methods");␊ |
1744 | generatePerlModSection(cd,cd->getMemberList(MemberList::pubStaticAttribs),"public_static_members");␊ |
1745 | generatePerlModSection(cd,cd->getMemberList(MemberList::proTypes),"protected_typedefs");␊ |
1746 | generatePerlModSection(cd,cd->getMemberList(MemberList::proMethods),"protected_methods");␊ |
1747 | generatePerlModSection(cd,cd->getMemberList(MemberList::proAttribs),"protected_members");␊ |
1748 | generatePerlModSection(cd,cd->getMemberList(MemberList::proSlots),"protected_slots");␊ |
1749 | generatePerlModSection(cd,cd->getMemberList(MemberList::proStaticMethods),"protected_static_methods");␊ |
1750 | generatePerlModSection(cd,cd->getMemberList(MemberList::proStaticAttribs),"protected_static_members");␊ |
1751 | generatePerlModSection(cd,cd->getMemberList(MemberList::priTypes),"private_typedefs");␊ |
1752 | generatePerlModSection(cd,cd->getMemberList(MemberList::priMethods),"private_methods");␊ |
1753 | generatePerlModSection(cd,cd->getMemberList(MemberList::priAttribs),"private_members");␊ |
1754 | generatePerlModSection(cd,cd->getMemberList(MemberList::priSlots),"private_slots");␊ |
1755 | generatePerlModSection(cd,cd->getMemberList(MemberList::priStaticMethods),"private_static_methods");␊ |
1756 | generatePerlModSection(cd,cd->getMemberList(MemberList::priStaticAttribs),"private_static_members");␊ |
1757 | generatePerlModSection(cd,cd->getMemberList(MemberList::friends),"friend_methods");␊ |
1758 | generatePerlModSection(cd,cd->getMemberList(MemberList::related),"related_methods");␊ |
1759 | ␊ |
1760 | addPerlModDocBlock(m_output,"brief",cd->getDefFileName(),cd->getDefLine(),cd,0,cd->briefDescription());␊ |
1761 | addPerlModDocBlock(m_output,"detailed",cd->getDefFileName(),cd->getDefLine(),cd,0,cd->documentation());␊ |
1762 | ␊ |
1763 | #if 0␊ |
1764 | DotClassGraph inheritanceGraph(cd,DotClassGraph::Inheritance);␊ |
1765 | if (!inheritanceGraph.isTrivial())␊ |
1766 | {␊ |
1767 | t << " <inheritancegraph>" << endl;␊ |
1768 | inheritanceGraph.writePerlMod(t);␊ |
1769 | t << " </inheritancegraph>" << endl;␊ |
1770 | }␊ |
1771 | DotClassGraph collaborationGraph(cd,DotClassGraph::Implementation);␊ |
1772 | if (!collaborationGraph.isTrivial())␊ |
1773 | {␊ |
1774 | t << " <collaborationgraph>" << endl;␊ |
1775 | collaborationGraph.writePerlMod(t);␊ |
1776 | t << " </collaborationgraph>" << endl;␊ |
1777 | }␊ |
1778 | t << " <location file=\"" ␊ |
1779 | << cd->getDefFileName() << "\" line=\"" ␊ |
1780 | << cd->getDefLine() << "\"";␊ |
1781 | if (cd->getStartBodyLine()!=-1)␊ |
1782 | {␊ |
1783 | t << " bodystart=\"" << cd->getStartBodyLine() << "\" bodyend=\"" ␊ |
1784 | << cd->getEndBodyLine() << "\"";␊ |
1785 | }␊ |
1786 | t << "/>" << endl;␊ |
1787 | #endif␊ |
1788 | ␊ |
1789 | m_output.closeHash();␊ |
1790 | }␊ |
1791 | ␊ |
1792 | void PerlModGenerator::generatePerlModForNamespace(NamespaceDef *nd)␊ |
1793 | {␊ |
1794 | // + contained class definitions␊ |
1795 | // + contained namespace definitions␊ |
1796 | // + member groups␊ |
1797 | // + normal members␊ |
1798 | // + brief desc␊ |
1799 | // + detailed desc␊ |
1800 | // + location␊ |
1801 | // - files containing (parts of) the namespace definition␊ |
1802 | ␊ |
1803 | if (nd->isReference()) return; // skip external references␊ |
1804 | ␊ |
1805 | m_output.openHash()␊ |
1806 | .addFieldQuotedString("name", nd->name());␊ |
1807 | ␊ |
1808 | ClassSDict *cl = nd->getClassSDict();␊ |
1809 | if (cl)␊ |
1810 | {␊ |
1811 | m_output.openList("classes");␊ |
1812 | ClassSDict::Iterator cli(*cl);␊ |
1813 | ClassDef *cd;␊ |
1814 | for (cli.toFirst();(cd=cli.current());++cli)␊ |
1815 | m_output.openHash()␊ |
1816 | ␉.addFieldQuotedString("name", cd->name())␊ |
1817 | ␉.closeHash();␊ |
1818 | m_output.closeList();␊ |
1819 | }␊ |
1820 | ␊ |
1821 | NamespaceSDict *nl = nd->getNamespaceSDict();␊ |
1822 | if (nl)␊ |
1823 | {␊ |
1824 | m_output.openList("namespaces");␊ |
1825 | NamespaceSDict::Iterator nli(*nl);␊ |
1826 | NamespaceDef *nd;␊ |
1827 | for (nli.toFirst();(nd=nli.current());++nli)␊ |
1828 | m_output.openHash()␊ |
1829 | ␉.addFieldQuotedString("name", nd->name())␊ |
1830 | ␉.closeHash();␊ |
1831 | m_output.closeList();␊ |
1832 | }␊ |
1833 | ␊ |
1834 | if (nd->getMemberGroupSDict())␊ |
1835 | {␊ |
1836 | MemberGroupSDict::Iterator mgli(*nd->getMemberGroupSDict());␊ |
1837 | MemberGroup *mg;␊ |
1838 | for (;(mg=mgli.current());++mgli)␊ |
1839 | generatePerlModSection(nd,mg->members(),"user-defined",mg->header());␊ |
1840 | }␊ |
1841 | ␊ |
1842 | generatePerlModSection(nd,nd->getMemberList(MemberList::decDefineMembers),"defines");␊ |
1843 | generatePerlModSection(nd,nd->getMemberList(MemberList::decProtoMembers),"prototypes");␊ |
1844 | generatePerlModSection(nd,nd->getMemberList(MemberList::decTypedefMembers),"typedefs");␊ |
1845 | generatePerlModSection(nd,nd->getMemberList(MemberList::decEnumMembers),"enums");␊ |
1846 | generatePerlModSection(nd,nd->getMemberList(MemberList::decFuncMembers),"functions");␊ |
1847 | generatePerlModSection(nd,nd->getMemberList(MemberList::decVarMembers),"variables");␊ |
1848 | ␊ |
1849 | addPerlModDocBlock(m_output,"brief",nd->getDefFileName(),nd->getDefLine(),0,0,nd->briefDescription());␊ |
1850 | addPerlModDocBlock(m_output,"detailed",nd->getDefFileName(),nd->getDefLine(),0,0,nd->documentation());␊ |
1851 | ␊ |
1852 | m_output.closeHash();␊ |
1853 | }␊ |
1854 | ␊ |
1855 | void PerlModGenerator::generatePerlModForFile(FileDef *fd)␊ |
1856 | {␊ |
1857 | // + includes files␊ |
1858 | // + includedby files␊ |
1859 | // - include graph␊ |
1860 | // - included by graph␊ |
1861 | // - contained class definitions␊ |
1862 | // - contained namespace definitions␊ |
1863 | // - member groups␊ |
1864 | // + normal members␊ |
1865 | // + brief desc␊ |
1866 | // + detailed desc␊ |
1867 | // - source code␊ |
1868 | // - location␊ |
1869 | // - number of lines␊ |
1870 | ␊ |
1871 | if (fd->isReference()) return;␊ |
1872 | ␊ |
1873 | m_output.openHash()␊ |
1874 | .addFieldQuotedString("name", fd->name());␊ |
1875 | ␊ |
1876 | IncludeInfo *inc;␊ |
1877 | m_output.openList("includes");␊ |
1878 | if (fd->includeFileList())␊ |
1879 | {␊ |
1880 | QListIterator<IncludeInfo> ili1(*fd->includeFileList());␊ |
1881 | for (ili1.toFirst();(inc=ili1.current());++ili1)␊ |
1882 | {␊ |
1883 | m_output.openHash()␊ |
1884 | .addFieldQuotedString("name", inc->includeName);␊ |
1885 | if (inc->fileDef && !inc->fileDef->isReference())␊ |
1886 | {␊ |
1887 | m_output.addFieldQuotedString("ref", inc->fileDef->getOutputFileBase());␊ |
1888 | }␊ |
1889 | m_output.closeHash();␊ |
1890 | }␊ |
1891 | }␊ |
1892 | m_output.closeList();␊ |
1893 | ␊ |
1894 | m_output.openList("included_by");␊ |
1895 | if (fd->includedByFileList())␊ |
1896 | {␊ |
1897 | QListIterator<IncludeInfo> ili2(*fd->includedByFileList());␊ |
1898 | for (ili2.toFirst();(inc=ili2.current());++ili2)␊ |
1899 | {␊ |
1900 | m_output.openHash()␊ |
1901 | .addFieldQuotedString("name", inc->includeName);␊ |
1902 | if (inc->fileDef && !inc->fileDef->isReference())␊ |
1903 | {␊ |
1904 | m_output.addFieldQuotedString("ref", inc->fileDef->getOutputFileBase());␊ |
1905 | }␊ |
1906 | m_output.closeHash();␊ |
1907 | }␊ |
1908 | }␊ |
1909 | m_output.closeList();␊ |
1910 | ␊ |
1911 | generatePerlModSection(fd,fd->getMemberList(MemberList::decDefineMembers),"defines");␊ |
1912 | generatePerlModSection(fd,fd->getMemberList(MemberList::decProtoMembers),"prototypes");␊ |
1913 | generatePerlModSection(fd,fd->getMemberList(MemberList::decTypedefMembers),"typedefs");␊ |
1914 | generatePerlModSection(fd,fd->getMemberList(MemberList::decEnumMembers),"enums");␊ |
1915 | generatePerlModSection(fd,fd->getMemberList(MemberList::decFuncMembers),"functions");␊ |
1916 | generatePerlModSection(fd,fd->getMemberList(MemberList::decVarMembers),"variables");␊ |
1917 | ␊ |
1918 | addPerlModDocBlock(m_output,"brief",fd->getDefFileName(),fd->getDefLine(),0,0,fd->briefDescription());␊ |
1919 | addPerlModDocBlock(m_output,"detailed",fd->getDefFileName(),fd->getDefLine(),0,0,fd->documentation());␊ |
1920 | ␊ |
1921 | m_output.closeHash();␊ |
1922 | }␊ |
1923 | ␊ |
1924 | void PerlModGenerator::generatePerlModForGroup(GroupDef *gd)␊ |
1925 | {␊ |
1926 | // + members␊ |
1927 | // + member groups␊ |
1928 | // + files␊ |
1929 | // + classes␊ |
1930 | // + namespaces␊ |
1931 | // - packages␊ |
1932 | // + pages␊ |
1933 | // + child groups␊ |
1934 | // - examples␊ |
1935 | // + brief description␊ |
1936 | // + detailed description␊ |
1937 | ␊ |
1938 | if (gd->isReference()) return; // skip external references␊ |
1939 | ␊ |
1940 | m_output.openHash()␊ |
1941 | .addFieldQuotedString("name", gd->name())␊ |
1942 | .addFieldQuotedString("title", gd->groupTitle());␊ |
1943 | ␊ |
1944 | FileList *fl = gd->getFiles();␊ |
1945 | if (fl)␊ |
1946 | {␊ |
1947 | m_output.openList("files");␊ |
1948 | QListIterator<FileDef> fli(*fl);␊ |
1949 | FileDef *fd = fl->first();␊ |
1950 | for (fli.toFirst();(fd=fli.current());++fli)␊ |
1951 | m_output.openHash()␊ |
1952 | ␉.addFieldQuotedString("name", fd->name())␊ |
1953 | ␉.closeHash();␊ |
1954 | m_output.closeList();␊ |
1955 | }␊ |
1956 | ␊ |
1957 | ClassSDict *cl = gd->getClasses();␊ |
1958 | if (cl)␊ |
1959 | {␊ |
1960 | m_output.openList("classes");␊ |
1961 | ClassSDict::Iterator cli(*cl);␊ |
1962 | ClassDef *cd;␊ |
1963 | for (cli.toFirst();(cd=cli.current());++cli)␊ |
1964 | m_output.openHash()␊ |
1965 | ␉.addFieldQuotedString("name", cd->name())␊ |
1966 | ␉.closeHash();␊ |
1967 | m_output.closeList();␊ |
1968 | }␊ |
1969 | ␊ |
1970 | NamespaceSDict *nl = gd->getNamespaces();␊ |
1971 | if (nl)␊ |
1972 | {␊ |
1973 | m_output.openList("namespaces");␊ |
1974 | NamespaceSDict::Iterator nli(*nl);␊ |
1975 | NamespaceDef *nd;␊ |
1976 | for (nli.toFirst();(nd=nli.current());++nli)␊ |
1977 | m_output.openHash()␊ |
1978 | ␉.addFieldQuotedString("name", nd->name())␊ |
1979 | ␉.closeHash();␊ |
1980 | m_output.closeList();␊ |
1981 | }␊ |
1982 | ␊ |
1983 | PageSDict *pl = gd->getPages();␊ |
1984 | if (pl)␊ |
1985 | {␊ |
1986 | m_output.openList("pages");␊ |
1987 | PageSDict::Iterator pli(*pl);␊ |
1988 | PageDef *pd;␊ |
1989 | for (pli.toFirst();(pd=pli.current());++pli)␊ |
1990 | m_output.openHash()␊ |
1991 | ␉.addFieldQuotedString("title", pd->title())␊ |
1992 | ␉.closeHash();␊ |
1993 | m_output.closeList();␊ |
1994 | }␊ |
1995 | ␊ |
1996 | GroupList *gl = gd->getSubGroups();␊ |
1997 | if (gl)␊ |
1998 | {␊ |
1999 | m_output.openList("groups");␊ |
2000 | GroupListIterator gli(*gl);␊ |
2001 | GroupDef *sgd;␊ |
2002 | for (gli.toFirst();(sgd=gli.current());++gli)␊ |
2003 | m_output.openHash()␊ |
2004 | ␉.addFieldQuotedString("title", sgd->groupTitle())␊ |
2005 | ␉.closeHash();␊ |
2006 | m_output.closeList();␊ |
2007 | }␊ |
2008 | ␊ |
2009 | if (gd->getMemberGroupSDict())␊ |
2010 | {␊ |
2011 | MemberGroupSDict::Iterator mgli(*gd->getMemberGroupSDict());␊ |
2012 | MemberGroup *mg;␊ |
2013 | for (;(mg=mgli.current());++mgli)␊ |
2014 | generatePerlModSection(gd,mg->members(),"user-defined",mg->header());␊ |
2015 | }␊ |
2016 | ␊ |
2017 | generatePerlModSection(gd,gd->getMemberList(MemberList::decDefineMembers),"defines");␊ |
2018 | generatePerlModSection(gd,gd->getMemberList(MemberList::decProtoMembers),"prototypes");␊ |
2019 | generatePerlModSection(gd,gd->getMemberList(MemberList::decTypedefMembers),"typedefs");␊ |
2020 | generatePerlModSection(gd,gd->getMemberList(MemberList::decEnumMembers),"enums");␊ |
2021 | generatePerlModSection(gd,gd->getMemberList(MemberList::decFuncMembers),"functions");␊ |
2022 | generatePerlModSection(gd,gd->getMemberList(MemberList::decVarMembers),"variables");␊ |
2023 | ␊ |
2024 | addPerlModDocBlock(m_output,"brief",gd->getDefFileName(),gd->getDefLine(),0,0,gd->briefDescription());␊ |
2025 | addPerlModDocBlock(m_output,"detailed",gd->getDefFileName(),gd->getDefLine(),0,0,gd->documentation());␊ |
2026 | ␊ |
2027 | m_output.closeHash();␊ |
2028 | }␊ |
2029 | ␊ |
2030 | void PerlModGenerator::generatePerlModForPage(PageDef *pd)␊ |
2031 | {␊ |
2032 | // + name␊ |
2033 | // + title␊ |
2034 | // + documentation␊ |
2035 | ␊ |
2036 | if (pd->isReference()) return;␊ |
2037 | ␊ |
2038 | m_output.openHash()␊ |
2039 | .addFieldQuotedString("name", pd->name());␊ |
2040 | ␊ |
2041 | SectionInfo *si = Doxygen::sectionDict.find(pd->name());␊ |
2042 | if (si)␊ |
2043 | m_output.addFieldQuotedString("title", si->title);␊ |
2044 | ␊ |
2045 | addPerlModDocBlock(m_output,"detailed",pd->docFile(),pd->docLine(),0,0,pd->documentation());␊ |
2046 | m_output.closeHash();␊ |
2047 | }␊ |
2048 | ␊ |
2049 | bool PerlModGenerator::generatePerlModOutput()␊ |
2050 | {␊ |
2051 | QFile outputFile;␊ |
2052 | if (!createOutputFile(outputFile, pathDoxyDocsPM))␊ |
2053 | return false;␊ |
2054 | ␊ |
2055 | FTextStream outputTextStream(&outputFile);␊ |
2056 | PerlModOutputStream outputStream(&outputTextStream);␊ |
2057 | m_output.setPerlModOutputStream(&outputStream);␊ |
2058 | m_output.add("$doxydocs=").openHash();␊ |
2059 | ␊ |
2060 | m_output.openList("classes");␊ |
2061 | ClassSDict::Iterator cli(*Doxygen::classSDict);␊ |
2062 | ClassDef *cd;␊ |
2063 | for (cli.toFirst();(cd=cli.current());++cli)␊ |
2064 | generatePerlModForClass(cd);␊ |
2065 | m_output.closeList();␊ |
2066 | ␊ |
2067 | m_output.openList("namespaces");␊ |
2068 | NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict);␊ |
2069 | NamespaceDef *nd;␊ |
2070 | for (nli.toFirst();(nd=nli.current());++nli)␊ |
2071 | generatePerlModForNamespace(nd);␊ |
2072 | m_output.closeList();␊ |
2073 | ␊ |
2074 | m_output.openList("files");␊ |
2075 | FileNameListIterator fnli(*Doxygen::inputNameList);␊ |
2076 | FileName *fn;␊ |
2077 | for (;(fn=fnli.current());++fnli)␊ |
2078 | {␊ |
2079 | FileNameIterator fni(*fn);␊ |
2080 | FileDef *fd;␊ |
2081 | for (;(fd=fni.current());++fni)␊ |
2082 | generatePerlModForFile(fd);␊ |
2083 | }␊ |
2084 | m_output.closeList();␊ |
2085 | ␊ |
2086 | m_output.openList("groups");␊ |
2087 | GroupSDict::Iterator gli(*Doxygen::groupSDict);␊ |
2088 | GroupDef *gd;␊ |
2089 | for (;(gd=gli.current());++gli)␊ |
2090 | {␊ |
2091 | generatePerlModForGroup(gd);␊ |
2092 | }␊ |
2093 | m_output.closeList();␊ |
2094 | ␊ |
2095 | m_output.openList("pages");␊ |
2096 | PageSDict::Iterator pdi(*Doxygen::pageSDict);␊ |
2097 | PageDef *pd=0;␊ |
2098 | for (pdi.toFirst();(pd=pdi.current());++pdi)␊ |
2099 | {␊ |
2100 | generatePerlModForPage(pd);␊ |
2101 | }␊ |
2102 | if (Doxygen::mainPage)␊ |
2103 | {␊ |
2104 | generatePerlModForPage(Doxygen::mainPage);␊ |
2105 | }␊ |
2106 | m_output.closeList();␊ |
2107 | ␊ |
2108 | m_output.closeHash().add(";\n1;\n");␊ |
2109 | return true;␊ |
2110 | }␊ |
2111 | ␊ |
2112 | bool PerlModGenerator::createOutputFile(QFile &f, const char *s)␊ |
2113 | {␊ |
2114 | f.setName(s);␊ |
2115 | if (!f.open(IO_WriteOnly))␊ |
2116 | {␊ |
2117 | err("Cannot open file %s for writing!\n", s);␊ |
2118 | return false;␊ |
2119 | }␊ |
2120 | return true;␊ |
2121 | }␊ |
2122 | ␊ |
2123 | bool PerlModGenerator::createOutputDir(QDir &perlModDir)␊ |
2124 | {␊ |
2125 | QCString outputDirectory = Config_getString("OUTPUT_DIRECTORY");␊ |
2126 | if (outputDirectory.isEmpty())␊ |
2127 | {␊ |
2128 | outputDirectory=QDir::currentDirPath();␊ |
2129 | }␊ |
2130 | else␊ |
2131 | {␊ |
2132 | QDir dir(outputDirectory);␊ |
2133 | if (!dir.exists())␊ |
2134 | {␊ |
2135 | dir.setPath(QDir::currentDirPath());␊ |
2136 | if (!dir.mkdir(outputDirectory))␊ |
2137 | {␊ |
2138 | ␉err("error: tag OUTPUT_DIRECTORY: Output directory `%s' does not "␊ |
2139 | ␉ "exist and cannot be created\n",outputDirectory.data());␊ |
2140 | ␉exit(1);␊ |
2141 | }␊ |
2142 | else if (!Config_getBool("QUIET"))␊ |
2143 | {␊ |
2144 | ␉err("notice: Output directory `%s' does not exist. "␊ |
2145 | ␉ "I have created it for you.\n", outputDirectory.data());␊ |
2146 | }␊ |
2147 | dir.cd(outputDirectory);␊ |
2148 | }␊ |
2149 | outputDirectory=dir.absPath();␊ |
2150 | }␊ |
2151 | ␊ |
2152 | QDir dir(outputDirectory);␊ |
2153 | if (!dir.exists())␊ |
2154 | {␊ |
2155 | dir.setPath(QDir::currentDirPath());␊ |
2156 | if (!dir.mkdir(outputDirectory))␊ |
2157 | {␊ |
2158 | err("Cannot create directory %s\n",outputDirectory.data());␊ |
2159 | return false;␊ |
2160 | }␊ |
2161 | }␊ |
2162 | ␊ |
2163 | perlModDir.setPath(outputDirectory+"/perlmod");␊ |
2164 | if (!perlModDir.exists() && !perlModDir.mkdir(outputDirectory+"/perlmod"))␊ |
2165 | {␊ |
2166 | err("Could not create perlmod directory in %s\n",outputDirectory.data());␊ |
2167 | return false;␊ |
2168 | }␊ |
2169 | return true;␊ |
2170 | }␊ |
2171 | ␊ |
2172 | bool PerlModGenerator::generateDoxyStructurePM()␊ |
2173 | {␊ |
2174 | QFile doxyModelPM;␊ |
2175 | if (!createOutputFile(doxyModelPM, pathDoxyStructurePM))␊ |
2176 | return false;␊ |
2177 | ␊ |
2178 | FTextStream doxyModelPMStream(&doxyModelPM);␊ |
2179 | doxyModelPMStream << ␊ |
2180 | "sub memberlist($) {\n"␊ |
2181 | " my $prefix = $_[0];\n"␊ |
2182 | " return\n"␊ |
2183 | "\t[ \"hash\", $prefix . \"s\",\n"␊ |
2184 | "\t {\n"␊ |
2185 | "\t members =>\n"␊ |
2186 | "\t [ \"list\", $prefix . \"List\",\n"␊ |
2187 | "\t\t[ \"hash\", $prefix,\n"␊ |
2188 | "\t\t {\n"␊ |
2189 | "\t\t kind => [ \"string\", $prefix . \"Kind\" ],\n"␊ |
2190 | "\t\t name => [ \"string\", $prefix . \"Name\" ],\n"␊ |
2191 | "\t\t static => [ \"string\", $prefix . \"Static\" ],\n"␊ |
2192 | "\t\t virtualness => [ \"string\", $prefix . \"Virtualness\" ],\n"␊ |
2193 | "\t\t protection => [ \"string\", $prefix . \"Protection\" ],\n"␊ |
2194 | "\t\t type => [ \"string\", $prefix . \"Type\" ],\n"␊ |
2195 | "\t\t parameters =>\n"␊ |
2196 | "\t\t [ \"list\", $prefix . \"Params\",\n"␊ |
2197 | "\t\t\t[ \"hash\", $prefix . \"Param\",\n"␊ |
2198 | "\t\t\t {\n"␊ |
2199 | "\t\t\t declaration_name => [ \"string\", $prefix . \"ParamName\" ],\n"␊ |
2200 | "\t\t\t type => [ \"string\", $prefix . \"ParamType\" ],\n"␊ |
2201 | "\t\t\t },\n"␊ |
2202 | "\t\t\t],\n"␊ |
2203 | "\t\t ],\n"␊ |
2204 | "\t\t detailed =>\n"␊ |
2205 | "\t\t [ \"hash\", $prefix . \"Detailed\",\n"␊ |
2206 | "\t\t\t{\n"␊ |
2207 | "\t\t\t doc => [ \"doc\", $prefix . \"DetailedDoc\" ],\n"␊ |
2208 | "\t\t\t return => [ \"doc\", $prefix . \"Return\" ],\n"␊ |
2209 | "\t\t\t see => [ \"doc\", $prefix . \"See\" ],\n"␊ |
2210 | "\t\t\t params =>\n"␊ |
2211 | "\t\t\t [ \"list\", $prefix . \"PDBlocks\",\n"␊ |
2212 | "\t\t\t [ \"hash\", $prefix . \"PDBlock\",\n"␊ |
2213 | "\t\t\t\t{\n"␊ |
2214 | "\t\t\t\t parameters =>\n"␊ |
2215 | "\t\t\t\t [ \"list\", $prefix . \"PDParams\",\n"␊ |
2216 | "\t\t\t\t [ \"hash\", $prefix . \"PDParam\",\n"␊ |
2217 | "\t\t\t\t\t{\n"␊ |
2218 | "\t\t\t\t\t name => [ \"string\", $prefix . \"PDParamName\" ],\n"␊ |
2219 | "\t\t\t\t\t},\n"␊ |
2220 | "\t\t\t\t ],\n"␊ |
2221 | "\t\t\t\t ],\n"␊ |
2222 | "\t\t\t\t doc => [ \"doc\", $prefix . \"PDDoc\" ],\n"␊ |
2223 | "\t\t\t\t},\n"␊ |
2224 | "\t\t\t ],\n"␊ |
2225 | "\t\t\t ],\n"␊ |
2226 | "\t\t\t},\n"␊ |
2227 | "\t\t ],\n"␊ |
2228 | "\t\t },\n"␊ |
2229 | "\t\t],\n"␊ |
2230 | "\t ],\n"␊ |
2231 | "\t },\n"␊ |
2232 | "\t];\n"␊ |
2233 | "}\n"␊ |
2234 | "\n"␊ |
2235 | "$doxystructure =\n"␊ |
2236 | " [ \"hash\", \"Root\",\n"␊ |
2237 | " {\n"␊ |
2238 | "\tfiles =>\n"␊ |
2239 | "\t [ \"list\", \"Files\",\n"␊ |
2240 | "\t [ \"hash\", \"File\",\n"␊ |
2241 | "\t {\n"␊ |
2242 | "\t\tname => [ \"string\", \"FileName\" ],\n"␊ |
2243 | "\t\ttypedefs => memberlist(\"FileTypedef\"),\n"␊ |
2244 | "\t\tvariables => memberlist(\"FileVariable\"),\n"␊ |
2245 | "\t\tfunctions => memberlist(\"FileFunction\"),\n"␊ |
2246 | "\t\tdetailed =>\n"␊ |
2247 | "\t\t [ \"hash\", \"FileDetailed\",\n"␊ |
2248 | "\t\t {\n"␊ |
2249 | "\t\t doc => [ \"doc\", \"FileDetailedDoc\" ],\n"␊ |
2250 | "\t\t },\n"␊ |
2251 | "\t\t ],\n"␊ |
2252 | "\t },\n"␊ |
2253 | "\t ],\n"␊ |
2254 | "\t ],\n"␊ |
2255 | "\tpages =>\n"␊ |
2256 | "\t [ \"list\", \"Pages\",\n"␊ |
2257 | "\t [ \"hash\", \"Page\",\n"␊ |
2258 | "\t {\n"␊ |
2259 | "\t\tname => [ \"string\", \"PageName\" ],\n"␊ |
2260 | "\t\tdetailed =>\n"␊ |
2261 | "\t\t [ \"hash\", \"PageDetailed\",\n"␊ |
2262 | "\t\t {\n"␊ |
2263 | "\t\t doc => [ \"doc\", \"PageDetailedDoc\" ],\n"␊ |
2264 | "\t\t },\n"␊ |
2265 | "\t\t ],\n"␊ |
2266 | "\t },\n"␊ |
2267 | "\t ],\n"␊ |
2268 | "\t ],\n"␊ |
2269 | "\tclasses =>\n"␊ |
2270 | "\t [ \"list\", \"Classes\",\n"␊ |
2271 | "\t [ \"hash\", \"Class\",\n"␊ |
2272 | "\t {\n"␊ |
2273 | "\t\tname => [ \"string\", \"ClassName\" ],\n"␊ |
2274 | "\t\tpublic_typedefs => memberlist(\"ClassPublicTypedef\"),\n"␊ |
2275 | "\t\tpublic_methods => memberlist(\"ClassPublicMethod\"),\n"␊ |
2276 | "\t\tpublic_members => memberlist(\"ClassPublicMember\"),\n"␊ |
2277 | "\t\tprotected_typedefs => memberlist(\"ClassProtectedTypedef\"),\n"␊ |
2278 | "\t\tprotected_methods => memberlist(\"ClassProtectedMethod\"),\n"␊ |
2279 | "\t\tprotected_members => memberlist(\"ClassProtectedMember\"),\n"␊ |
2280 | "\t\tprivate_typedefs => memberlist(\"ClassPrivateTypedef\"),\n"␊ |
2281 | "\t\tprivate_methods => memberlist(\"ClassPrivateMethod\"),\n"␊ |
2282 | "\t\tprivate_members => memberlist(\"ClassPrivateMember\"),\n"␊ |
2283 | "\t\tdetailed =>\n"␊ |
2284 | "\t\t [ \"hash\", \"ClassDetailed\",\n"␊ |
2285 | "\t\t {\n"␊ |
2286 | "\t\t doc => [ \"doc\", \"ClassDetailedDoc\" ],\n"␊ |
2287 | "\t\t },\n"␊ |
2288 | "\t\t ],\n"␊ |
2289 | "\t },\n"␊ |
2290 | "\t ],\n"␊ |
2291 | "\t ],\n"␊ |
2292 | "\tgroups =>\n"␊ |
2293 | "\t [ \"list\", \"Groups\",\n"␊ |
2294 | "\t [ \"hash\", \"Group\",\n"␊ |
2295 | "\t {\n"␊ |
2296 | "\t\tname => [ \"string\", \"GroupName\" ],\n"␊ |
2297 | "\t\ttitle => [ \"string\", \"GroupTitle\" ],\n"␊ |
2298 | "\t\tfiles =>\n"␊ |
2299 | "\t\t [ \"list\", \"Files\",\n"␊ |
2300 | "\t\t [ \"hash\", \"File\",\n"␊ |
2301 | "\t\t {\n"␊ |
2302 | "\t\t name => [ \"string\", \"Filename\" ]\n"␊ |
2303 | "\t\t }\n"␊ |
2304 | "\t\t ],\n"␊ |
2305 | "\t\t ],\n"␊ |
2306 | "\t\tclasses =>\n"␊ |
2307 | "\t\t [ \"list\", \"Classes\",\n"␊ |
2308 | "\t\t [ \"hash\", \"Class\",\n"␊ |
2309 | "\t\t {\n" ␊ |
2310 | "\t\t name => [ \"string\", \"Classname\" ]\n"␊ |
2311 | "\t\t }\n"␊ |
2312 | "\t\t ],\n"␊ |
2313 | "\t\t ],\n"␊ |
2314 | "\t\tnamespaces =>\n"␊ |
2315 | "\t\t [ \"list\", \"Namespaces\",\n"␊ |
2316 | "\t\t [ \"hash\", \"Namespace\",\n"␊ |
2317 | "\t\t {\n" ␊ |
2318 | "\t\t name => [ \"string\", \"NamespaceName\" ]\n"␊ |
2319 | "\t\t }\n"␊ |
2320 | "\t\t ],\n"␊ |
2321 | "\t\t ],\n"␊ |
2322 | "\t\tpages =>\n"␊ |
2323 | "\t\t [ \"list\", \"Pages\",\n"␊ |
2324 | "\t\t [ \"hash\", \"Page\","␊ |
2325 | "\t\t {\n"␊ |
2326 | "\t\t title => [ \"string\", \"PageName\" ]\n"␊ |
2327 | "\t\t }\n"␊ |
2328 | "\t\t ],\n"␊ |
2329 | "\t\t ],\n"␊ |
2330 | "\t\tgroups =>\n"␊ |
2331 | "\t\t [ \"list\", \"Groups\",\n"␊ |
2332 | "\t\t [ \"hash\", \"Group\",\n"␊ |
2333 | "\t\t {\n"␊ |
2334 | "\t\t title => [ \"string\", \"GroupName\" ]\n"␊ |
2335 | "\t\t }\n"␊ |
2336 | "\t\t ],\n"␊ |
2337 | "\t\t ],\n"␊ |
2338 | "\t\tfunctions => memberlist(\"GroupFunction\"),\n"␊ |
2339 | "\t\tdetailed =>\n"␊ |
2340 | "\t\t [ \"hash\", \"GroupDetailed\",\n"␊ |
2341 | "\t\t {\n"␊ |
2342 | "\t\t doc => [ \"doc\", \"GroupDetailedDoc\" ],\n"␊ |
2343 | "\t\t },\n"␊ |
2344 | "\t\t ],\n"␊ |
2345 | "\t }\n"␊ |
2346 | "\t ],\n"␊ |
2347 | "\t ],\n"␊ |
2348 | " },\n"␊ |
2349 | " ];\n"␊ |
2350 | "\n"␊ |
2351 | "1;\n";␊ |
2352 | ␊ |
2353 | return true;␊ |
2354 | }␊ |
2355 | ␊ |
2356 | bool PerlModGenerator::generateDoxyRules()␊ |
2357 | {␊ |
2358 | QFile doxyRules;␊ |
2359 | if (!createOutputFile(doxyRules, pathDoxyRules))␊ |
2360 | return false;␊ |
2361 | ␊ |
2362 | bool perlmodLatex = Config_getBool("PERLMOD_LATEX");␊ |
2363 | QCString prefix = Config_getString("PERLMOD_MAKEVAR_PREFIX");␊ |
2364 | ␊ |
2365 | FTextStream doxyRulesStream(&doxyRules);␊ |
2366 | doxyRulesStream <<␊ |
2367 | prefix << "DOXY_EXEC_PATH = " << pathDoxyExec << "\n" <<␊ |
2368 | prefix << "DOXYFILE = " << pathDoxyfile << "\n" <<␊ |
2369 | prefix << "DOXYDOCS_PM = " << pathDoxyDocsPM << "\n" <<␊ |
2370 | prefix << "DOXYSTRUCTURE_PM = " << pathDoxyStructurePM << "\n" <<␊ |
2371 | prefix << "DOXYRULES = " << pathDoxyRules << "\n";␊ |
2372 | if (perlmodLatex)␊ |
2373 | doxyRulesStream <<␊ |
2374 | prefix << "DOXYLATEX_PL = " << pathDoxyLatexPL << "\n" <<␊ |
2375 | prefix << "DOXYLATEXSTRUCTURE_PL = " << pathDoxyLatexStructurePL << "\n" <<␊ |
2376 | prefix << "DOXYSTRUCTURE_TEX = " << pathDoxyStructureTex << "\n" <<␊ |
2377 | prefix << "DOXYDOCS_TEX = " << pathDoxyDocsTex << "\n" <<␊ |
2378 | prefix << "DOXYFORMAT_TEX = " << pathDoxyFormatTex << "\n" <<␊ |
2379 | prefix << "DOXYLATEX_TEX = " << pathDoxyLatexTex << "\n" <<␊ |
2380 | prefix << "DOXYLATEX_DVI = " << pathDoxyLatexDVI << "\n" <<␊ |
2381 | prefix << "DOXYLATEX_PDF = " << pathDoxyLatexPDF << "\n";␊ |
2382 | ␊ |
2383 | doxyRulesStream <<␊ |
2384 | "\n"␊ |
2385 | ".PHONY: clean-perlmod\n"␊ |
2386 | "clean-perlmod::\n"␊ |
2387 | "\trm -f $(" << prefix << "DOXYSTRUCTURE_PM) \\\n"␊ |
2388 | "\t$(" << prefix << "DOXYDOCS_PM)";␊ |
2389 | if (perlmodLatex)␊ |
2390 | doxyRulesStream <<␊ |
2391 | " \\\n"␊ |
2392 | "\t$(" << prefix << "DOXYLATEX_PL) \\\n"␊ |
2393 | "\t$(" << prefix << "DOXYLATEXSTRUCTURE_PL) \\\n"␊ |
2394 | "\t$(" << prefix << "DOXYDOCS_TEX) \\\n"␊ |
2395 | "\t$(" << prefix << "DOXYSTRUCTURE_TEX) \\\n"␊ |
2396 | "\t$(" << prefix << "DOXYFORMAT_TEX) \\\n"␊ |
2397 | "\t$(" << prefix << "DOXYLATEX_TEX) \\\n"␊ |
2398 | "\t$(" << prefix << "DOXYLATEX_PDF) \\\n"␊ |
2399 | "\t$(" << prefix << "DOXYLATEX_DVI) \\\n"␊ |
2400 | "\t$(addprefix $(" << prefix << "DOXYLATEX_TEX:tex=),out aux log)";␊ |
2401 | doxyRulesStream << "\n\n";␊ |
2402 | ␊ |
2403 | doxyRulesStream <<␊ |
2404 | "$(" << prefix << "DOXYRULES) \\\n"␊ |
2405 | "$(" << prefix << "DOXYMAKEFILE) \\\n"␊ |
2406 | "$(" << prefix << "DOXYSTRUCTURE_PM) \\\n"␊ |
2407 | "$(" << prefix << "DOXYDOCS_PM)";␊ |
2408 | if (perlmodLatex) {␊ |
2409 | doxyRulesStream <<␊ |
2410 | " \\\n"␊ |
2411 | "$(" << prefix << "DOXYLATEX_PL) \\\n"␊ |
2412 | "$(" << prefix << "DOXYLATEXSTRUCTURE_PL) \\\n"␊ |
2413 | "$(" << prefix << "DOXYFORMAT_TEX) \\\n"␊ |
2414 | "$(" << prefix << "DOXYLATEX_TEX)";␊ |
2415 | }␊ |
2416 | doxyRulesStream <<␊ |
2417 | ": \\\n"␊ |
2418 | "\t$(" << prefix << "DOXYFILE)\n"␊ |
2419 | "\tcd $(" << prefix << "DOXY_EXEC_PATH) ; doxygen \"$<\"\n";␊ |
2420 | ␊ |
2421 | if (perlmodLatex) {␊ |
2422 | doxyRulesStream <<␊ |
2423 | "\n"␊ |
2424 | "$(" << prefix << "DOXYDOCS_TEX): \\\n"␊ |
2425 | "$(" << prefix << "DOXYLATEX_PL) \\\n"␊ |
2426 | "$(" << prefix << "DOXYDOCS_PM)\n"␊ |
2427 | "\tperl -I\"$(<D)\" \"$<\" >\"$@\"\n"␊ |
2428 | "\n"␊ |
2429 | "$(" << prefix << "DOXYSTRUCTURE_TEX): \\\n"␊ |
2430 | "$(" << prefix << "DOXYLATEXSTRUCTURE_PL) \\\n"␊ |
2431 | "$(" << prefix << "DOXYSTRUCTURE_PM)\n"␊ |
2432 | "\tperl -I\"$(<D)\" \"$<\" >\"$@\"\n"␊ |
2433 | "\n"␊ |
2434 | "$(" << prefix << "DOXYLATEX_PDF) \\\n"␊ |
2435 | "$(" << prefix << "DOXYLATEX_DVI): \\\n"␊ |
2436 | "$(" << prefix << "DOXYLATEX_TEX) \\\n"␊ |
2437 | "$(" << prefix << "DOXYFORMAT_TEX) \\\n"␊ |
2438 | "$(" << prefix << "DOXYSTRUCTURE_TEX) \\\n"␊ |
2439 | "$(" << prefix << "DOXYDOCS_TEX)\n"␊ |
2440 | "\n"␊ |
2441 | "$(" << prefix << "DOXYLATEX_PDF): \\\n"␊ |
2442 | "$(" << prefix << "DOXYLATEX_TEX)\n"␊ |
2443 | "\tpdflatex -interaction=nonstopmode \"$<\"\n"␊ |
2444 | "\n"␊ |
2445 | "$(" << prefix << "DOXYLATEX_DVI): \\\n"␊ |
2446 | "$(" << prefix << "DOXYLATEX_TEX)\n"␊ |
2447 | "\tlatex -interaction=nonstopmode \"$<\"\n";␊ |
2448 | }␊ |
2449 | ␊ |
2450 | return true;␊ |
2451 | }␊ |
2452 | ␊ |
2453 | bool PerlModGenerator::generateMakefile()␊ |
2454 | {␊ |
2455 | QFile makefile;␊ |
2456 | if (!createOutputFile(makefile, pathMakefile))␊ |
2457 | return false;␊ |
2458 | ␊ |
2459 | bool perlmodLatex = Config_getBool("PERLMOD_LATEX");␊ |
2460 | QCString prefix = Config_getString("PERLMOD_MAKEVAR_PREFIX");␊ |
2461 | ␊ |
2462 | FTextStream makefileStream(&makefile);␊ |
2463 | makefileStream <<␊ |
2464 | ".PHONY: default clean" << (perlmodLatex ? " pdf" : "") << "\n"␊ |
2465 | "default: " << (perlmodLatex ? "pdf" : "clean") << "\n"␊ |
2466 | "\n"␊ |
2467 | "include " << pathDoxyRules << "\n"␊ |
2468 | "\n"␊ |
2469 | "clean: clean-perlmod\n";␊ |
2470 | ␊ |
2471 | if (perlmodLatex) {␊ |
2472 | makefileStream <<␊ |
2473 | "pdf: $(" << prefix << "DOXYLATEX_PDF)\n"␊ |
2474 | "dvi: $(" << prefix << "DOXYLATEX_DVI)\n";␊ |
2475 | }␊ |
2476 | ␊ |
2477 | return true;␊ |
2478 | }␊ |
2479 | ␊ |
2480 | bool PerlModGenerator::generateDoxyLatexStructurePL()␊ |
2481 | {␊ |
2482 | QFile doxyLatexStructurePL;␊ |
2483 | if (!createOutputFile(doxyLatexStructurePL, pathDoxyLatexStructurePL))␊ |
2484 | return false;␊ |
2485 | ␊ |
2486 | FTextStream doxyLatexStructurePLStream(&doxyLatexStructurePL);␊ |
2487 | doxyLatexStructurePLStream << ␊ |
2488 | "use DoxyStructure;\n"␊ |
2489 | "\n"␊ |
2490 | "sub process($) {\n"␊ |
2491 | "\tmy $node = $_[0];\n"␊ |
2492 | "\tmy ($type, $name) = @$node[0, 1];\n"␊ |
2493 | "\tmy $command;\n"␊ |
2494 | "\tif ($type eq \"string\") { $command = \"String\" }\n"␊ |
2495 | "\telsif ($type eq \"doc\") { $command = \"Doc\" }\n"␊ |
2496 | "\telsif ($type eq \"hash\") {\n"␊ |
2497 | "\t\t$command = \"Hash\";\n"␊ |
2498 | "\t\tfor my $subnode (values %{$$node[2]}) {\n"␊ |
2499 | "\t\t\tprocess($subnode);\n"␊ |
2500 | "\t\t}\n"␊ |
2501 | "\t}\n"␊ |
2502 | "\telsif ($type eq \"list\") {\n"␊ |
2503 | "\t\t$command = \"List\";\n"␊ |
2504 | "\t\tprocess($$node[2]);\n"␊ |
2505 | "\t}\n"␊ |
2506 | "\tprint \"\\\\\" . $command . \"Node{\" . $name . \"}%\\n\";\n"␊ |
2507 | "}\n"␊ |
2508 | "\n"␊ |
2509 | "process($doxystructure);\n";␊ |
2510 | ␊ |
2511 | return true;␊ |
2512 | }␊ |
2513 | ␊ |
2514 | bool PerlModGenerator::generateDoxyLatexPL()␊ |
2515 | {␊ |
2516 | QFile doxyLatexPL;␊ |
2517 | if (!createOutputFile(doxyLatexPL, pathDoxyLatexPL))␊ |
2518 | return false;␊ |
2519 | ␊ |
2520 | FTextStream doxyLatexPLStream(&doxyLatexPL);␊ |
2521 | doxyLatexPLStream << ␊ |
2522 | "use DoxyStructure;\n"␊ |
2523 | "use DoxyDocs;\n"␊ |
2524 | "\n"␊ |
2525 | "sub latex_quote($) {\n"␊ |
2526 | "\tmy $text = $_[0];\n"␊ |
2527 | "\t$text =~ s/\\\\/\\\\textbackslash /g;\n"␊ |
2528 | "\t$text =~ s/\\|/\\\\textbar /g;\n"␊ |
2529 | "\t$text =~ s/</\\\\textless /g;\n"␊ |
2530 | "\t$text =~ s/>/\\\\textgreater /g;\n"␊ |
2531 | "\t$text =~ s/~/\\\\textasciitilde /g;\n"␊ |
2532 | "\t$text =~ s/\\^/\\\\textasciicircum /g;\n"␊ |
2533 | "\t$text =~ s/[\\$&%#_{}]/\\\\$&/g;\n"␊ |
2534 | "\tprint $text;\n"␊ |
2535 | "}\n"␊ |
2536 | "\n"␊ |
2537 | "sub generate_doc($) {\n"␊ |
2538 | "\tmy $doc = $_[0];\n"␊ |
2539 | "\tfor my $item (@$doc) {\n"␊ |
2540 | "\t\tmy $type = $$item{type};\n"␊ |
2541 | "\t\tif ($type eq \"text\") {\n"␊ |
2542 | "\t\t\tlatex_quote($$item{content});\n"␊ |
2543 | "\t\t} elsif ($type eq \"parbreak\") {\n"␊ |
2544 | "\t\t\tprint \"\\n\\n\";\n"␊ |
2545 | "\t\t} elsif ($type eq \"style\") {\n"␊ |
2546 | "\t\t\tmy $style = $$item{style};\n"␊ |
2547 | "\t\t\tif ($$item{enable} eq \"yes\") {\n"␊ |
2548 | "\t\t\t\tif ($style eq \"bold\") { print '\\bfseries'; }\n"␊ |
2549 | "\t\t\t\tif ($style eq \"italic\") { print '\\itshape'; }\n"␊ |
2550 | "\t\t\t\tif ($style eq \"code\") { print '\\ttfamily'; }\n"␊ |
2551 | "\t\t\t} else {\n"␊ |
2552 | "\t\t\t\tif ($style eq \"bold\") { print '\\mdseries'; }\n"␊ |
2553 | "\t\t\t\tif ($style eq \"italic\") { print '\\upshape'; }\n"␊ |
2554 | "\t\t\t\tif ($style eq \"code\") { print '\\rmfamily'; }\n"␊ |
2555 | "\t\t\t}\n"␊ |
2556 | "\t\t\tprint '{}';\n"␊ |
2557 | "\t\t} elsif ($type eq \"symbol\") {\n"␊ |
2558 | "\t\t\tmy $symbol = $$item{symbol};\n"␊ |
2559 | "\t\t\tif ($symbol eq \"copyright\") { print '\\copyright'; }\n"␊ |
2560 | "\t\t\telsif ($symbol eq \"szlig\") { print '\\ss'; }\n"␊ |
2561 | "\t\t\tprint '{}';\n"␊ |
2562 | "\t\t} elsif ($type eq \"accent\") {\n"␊ |
2563 | "\t\t\tmy ($accent) = $$item{accent};\n"␊ |
2564 | "\t\t\tif ($accent eq \"umlaut\") { print '\\\"'; }\n"␊ |
2565 | "\t\t\telsif ($accent eq \"acute\") { print '\\\\\\''; }\n"␊ |
2566 | "\t\t\telsif ($accent eq \"grave\") { print '\\`'; }\n"␊ |
2567 | "\t\t\telsif ($accent eq \"circ\") { print '\\^'; }\n"␊ |
2568 | "\t\t\telsif ($accent eq \"tilde\") { print '\\~'; }\n"␊ |
2569 | "\t\t\telsif ($accent eq \"cedilla\") { print '\\c'; }\n"␊ |
2570 | "\t\t\telsif ($accent eq \"ring\") { print '\\r'; }\n"␊ |
2571 | "\t\t\tprint \"{\" . $$item{letter} . \"}\"; \n"␊ |
2572 | "\t\t} elsif ($type eq \"list\") {\n"␊ |
2573 | "\t\t\tmy $env = ($$item{style} eq \"ordered\") ? \"enumerate\" : \"itemize\";\n"␊ |
2574 | "\t\t\tprint \"\\n\\\\begin{\" . $env .\"}\";\n"␊ |
2575 | "\t\t \tfor my $subitem (@{$$item{content}}) {\n"␊ |
2576 | "\t\t\t\tprint \"\\n\\\\item \";\n"␊ |
2577 | "\t\t\t\tgenerate_doc($subitem);\n"␊ |
2578 | "\t\t \t}\n"␊ |
2579 | "\t\t\tprint \"\\n\\\\end{\" . $env .\"}\";\n"␊ |
2580 | "\t\t} elsif ($type eq \"url\") {\n"␊ |
2581 | "\t\t\tlatex_quote($$item{content});\n"␊ |
2582 | "\t\t}\n"␊ |
2583 | "\t}\n"␊ |
2584 | "}\n"␊ |
2585 | "\n"␊ |
2586 | "sub generate($$) {\n"␊ |
2587 | "\tmy ($item, $node) = @_;\n"␊ |
2588 | "\tmy ($type, $name) = @$node[0, 1];\n"␊ |
2589 | "\tif ($type eq \"string\") {\n"␊ |
2590 | "\t\tprint \"\\\\\" . $name . \"{\";\n"␊ |
2591 | "\t\tlatex_quote($item);\n"␊ |
2592 | "\t\tprint \"}\";\n"␊ |
2593 | "\t} elsif ($type eq \"doc\") {\n"␊ |
2594 | "\t\tif (@$item) {\n"␊ |
2595 | "\t\t\tprint \"\\\\\" . $name . \"{\";\n"␊ |
2596 | "\t\t\tgenerate_doc($item);\n"␊ |
2597 | "\t\t\tprint \"}%\\n\";\n"␊ |
2598 | "\t\t} else {\n"␊ |
2599 | "#\t\t\tprint \"\\\\\" . $name . \"Empty%\\n\";\n"␊ |
2600 | "\t\t}\n"␊ |
2601 | "\t} elsif ($type eq \"hash\") {\n"␊ |
2602 | "\t\tmy ($key, $value);\n"␊ |
2603 | "\t\twhile (($key, $subnode) = each %{$$node[2]}) {\n"␊ |
2604 | "\t\t\tmy $subname = $$subnode[1];\n"␊ |
2605 | "\t\t\tprint \"\\\\Defcs{field\" . $subname . \"}{\";\n"␊ |
2606 | "\t\t\tif ($$item{$key}) {\n"␊ |
2607 | "\t\t\t\tgenerate($$item{$key}, $subnode);\n"␊ |
2608 | "\t\t\t} else {\n"␊ |
2609 | "#\t\t\t\t\tprint \"\\\\\" . $subname . \"Empty%\\n\";\n"␊ |
2610 | "\t\t\t}\n"␊ |
2611 | "\t\t\tprint \"}%\\n\";\n"␊ |
2612 | "\t\t}\n"␊ |
2613 | "\t\tprint \"\\\\\" . $name . \"%\\n\";\n"␊ |
2614 | "\t} elsif ($type eq \"list\") {\n"␊ |
2615 | "\t\tmy $index = 0;\n"␊ |
2616 | "\t\tif (@$item) {\n"␊ |
2617 | "\t\t\tprint \"\\\\\" . $name . \"{%\\n\";\n"␊ |
2618 | "\t\t\tfor my $subitem (@$item) {\n"␊ |
2619 | "\t\t\t\tif ($index) {\n"␊ |
2620 | "\t\t\t\t\tprint \"\\\\\" . $name . \"Sep%\\n\";\n"␊ |
2621 | "\t\t\t\t}\n"␊ |
2622 | "\t\t\t\tgenerate($subitem, $$node[2]);\n"␊ |
2623 | "\t\t\t\t$index++;\n"␊ |
2624 | "\t\t\t}\n"␊ |
2625 | "\t\t\tprint \"}%\\n\";\n"␊ |
2626 | "\t\t} else {\n"␊ |
2627 | "#\t\t\tprint \"\\\\\" . $name . \"Empty%\\n\";\n"␊ |
2628 | "\t\t}\n"␊ |
2629 | "\t}\n"␊ |
2630 | "}\n"␊ |
2631 | "\n"␊ |
2632 | "generate($doxydocs, $doxystructure);\n";␊ |
2633 | ␊ |
2634 | return true;␊ |
2635 | }␊ |
2636 | ␊ |
2637 | bool PerlModGenerator::generateDoxyFormatTex()␊ |
2638 | {␊ |
2639 | QFile doxyFormatTex;␊ |
2640 | if (!createOutputFile(doxyFormatTex, pathDoxyFormatTex))␊ |
2641 | return false;␊ |
2642 | ␊ |
2643 | FTextStream doxyFormatTexStream(&doxyFormatTex);␊ |
2644 | doxyFormatTexStream << ␊ |
2645 | "\\def\\Defcs#1{\\long\\expandafter\\def\\csname#1\\endcsname}\n"␊ |
2646 | "\\Defcs{Empty}{}\n"␊ |
2647 | "\\def\\IfEmpty#1{\\expandafter\\ifx\\csname#1\\endcsname\\Empty}\n"␊ |
2648 | "\n"␊ |
2649 | "\\def\\StringNode#1{\\Defcs{#1}##1{##1}}\n"␊ |
2650 | "\\def\\DocNode#1{\\Defcs{#1}##1{##1}}\n"␊ |
2651 | "\\def\\ListNode#1{\\Defcs{#1}##1{##1}\\Defcs{#1Sep}{}}\n"␊ |
2652 | "\\def\\HashNode#1{\\Defcs{#1}{}}\n"␊ |
2653 | "\n"␊ |
2654 | "\\input{" << pathDoxyStructureTex << "}\n"␊ |
2655 | "\n"␊ |
2656 | "\\newbox\\BoxA\n"␊ |
2657 | "\\dimendef\\DimenA=151\\relax\n"␊ |
2658 | "\\dimendef\\DimenB=152\\relax\n"␊ |
2659 | "\\countdef\\ZoneDepth=151\\relax\n"␊ |
2660 | "\n"␊ |
2661 | "\\def\\Cs#1{\\csname#1\\endcsname}\n"␊ |
2662 | "\\def\\Letcs#1{\\expandafter\\let\\csname#1\\endcsname}\n"␊ |
2663 | "\\def\\Heading#1{\\vskip 4mm\\relax\\textbf{#1}}\n"␊ |
2664 | "\\def\\See#1{\\begin{flushleft}\\Heading{See also: }#1\\end{flushleft}}\n"␊ |
2665 | "\n"␊ |
2666 | "\\def\\Frame#1{\\vskip 3mm\\relax\\fbox{ \\vbox{\\hsize0.95\\hsize\\vskip 1mm\\relax\n"␊ |
2667 | "\\raggedright#1\\vskip 0.5mm\\relax} }}\n"␊ |
2668 | "\n"␊ |
2669 | "\\def\\Zone#1#2#3{%\n"␊ |
2670 | "\\Defcs{Test#1}{#2}%\n"␊ |
2671 | "\\Defcs{Emit#1}{#3}%\n"␊ |
2672 | "\\Defcs{#1}{%\n"␊ |
2673 | "\\advance\\ZoneDepth1\\relax\n"␊ |
2674 | "\\Letcs{Mode\\number\\ZoneDepth}0\\relax\n"␊ |
2675 | "\\Letcs{Present\\number\\ZoneDepth}0\\relax\n"␊ |
2676 | "\\Cs{Test#1}\n"␊ |
2677 | "\\expandafter\\if\\Cs{Present\\number\\ZoneDepth}1%\n"␊ |
2678 | "\\advance\\ZoneDepth-1\\relax\n"␊ |
2679 | "\\Letcs{Present\\number\\ZoneDepth}1\\relax\n"␊ |
2680 | "\\expandafter\\if\\Cs{Mode\\number\\ZoneDepth}1%\n"␊ |
2681 | "\\advance\\ZoneDepth1\\relax\n"␊ |
2682 | "\\Letcs{Mode\\number\\ZoneDepth}1\\relax\n"␊ |
2683 | "\\Cs{Emit#1}\n"␊ |
2684 | "\\advance\\ZoneDepth-1\\relax\\fi\n"␊ |
2685 | "\\advance\\ZoneDepth1\\relax\\fi\n"␊ |
2686 | "\\advance\\ZoneDepth-1\\relax}}\n"␊ |
2687 | "\n"␊ |
2688 | "\\def\\Member#1#2{%\n"␊ |
2689 | "\\Defcs{Test#1}{\\Cs{field#1Detailed}\n"␊ |
2690 | "\\IfEmpty{field#1DetailedDoc}\\else\\Letcs{Present#1}1\\fi}\n"␊ |
2691 | "\\Defcs{#1}{\\Letcs{Present#1}0\\relax\n"␊ |
2692 | "\\Cs{Test#1}\\if1\\Cs{Present#1}\\Letcs{Present\\number\\ZoneDepth}1\\relax\n"␊ |
2693 | "\\if1\\Cs{Mode\\number\\ZoneDepth}#2\\fi\\fi}}\n"␊ |
2694 | "\n"␊ |
2695 | "\\def\\TypedefMemberList#1#2{%\n"␊ |
2696 | "\\Defcs{#1DetailedDoc}##1{\\vskip 5.5mm\\relax##1}%\n"␊ |
2697 | "\\Defcs{#1Name}##1{\\textbf{##1}}%\n"␊ |
2698 | "\\Defcs{#1See}##1{\\See{##1}}%\n"␊ |
2699 | "%\n"␊ |
2700 | "\\Zone{#1s}{\\Cs{field#1List}}{\\subsubsection{#2}\\Cs{field#1List}}%\n"␊ |
2701 | "\\Member{#1}{\\Frame{typedef \\Cs{field#1Type} \\Cs{field#1Name}}%\n"␊ |
2702 | "\\Cs{field#1DetailedDoc}\\Cs{field#1See}\\vskip 5mm\\relax}}%\n"␊ |
2703 | "\n"␊ |
2704 | "\\def\\VariableMemberList#1#2{%\n"␊ |
2705 | "\\Defcs{#1DetailedDoc}##1{\\vskip 5.5mm\\relax##1}%\n"␊ |
2706 | "\\Defcs{#1Name}##1{\\textbf{##1}}%\n"␊ |
2707 | "\\Defcs{#1See}##1{\\See{##1}}%\n"␊ |
2708 | "%\n"␊ |
2709 | "\\Zone{#1s}{\\Cs{field#1List}}{\\subsubsection{#2}\\Cs{field#1List}}%\n"␊ |
2710 | "\\Member{#1}{\\Frame{\\Cs{field#1Type}{} \\Cs{field#1Name}}%\n"␊ |
2711 | "\\Cs{field#1DetailedDoc}\\Cs{field#1See}\\vskip 5mm\\relax}}%\n"␊ |
2712 | "\n"␊ |
2713 | "\\def\\FunctionMemberList#1#2{%\n"␊ |
2714 | "\\Defcs{#1PDParamName}##1{\\textit{##1}}%\n"␊ |
2715 | "\\Defcs{#1PDParam}{\\Cs{field#1PDParamName}}%\n"␊ |
2716 | "\\Defcs{#1PDParamsSep}{, }%\n"␊ |
2717 | "\\Defcs{#1PDBlocksSep}{\\vskip 2mm\\relax}%\n"␊ |
2718 | "%\n"␊ |
2719 | "\\Defcs{#1PDBlocks}##1{%\n"␊ |
2720 | "\\Heading{Parameters:}\\vskip 1.5mm\\relax\n"␊ |
2721 | "\\DimenA0pt\\relax\n"␊ |
2722 | "\\Defcs{#1PDBlock}{\\setbox\\BoxA\\hbox{\\Cs{field#1PDParams}}%\n"␊ |
2723 | "\\ifdim\\DimenA<\\wd\\BoxA\\DimenA\\wd\\BoxA\\fi}%\n"␊ |
2724 | "##1%\n"␊ |
2725 | "\\advance\\DimenA3mm\\relax\n"␊ |
2726 | "\\DimenB\\hsize\\advance\\DimenB-\\DimenA\\relax\n"␊ |
2727 | "\\Defcs{#1PDBlock}{\\hbox to\\hsize{\\vtop{\\hsize\\DimenA\\relax\n"␊ |
2728 | "\\Cs{field#1PDParams}}\\hfill\n"␊ |
2729 | "\\vtop{\\hsize\\DimenB\\relax\\Cs{field#1PDDoc}}}}%\n"␊ |
2730 | "##1}\n"␊ |
2731 | "\n"␊ |
2732 | "\\Defcs{#1ParamName}##1{\\textit{##1}}\n"␊ |
2733 | "\\Defcs{#1Param}{\\Cs{field#1ParamType}{} \\Cs{field#1ParamName}}\n"␊ |
2734 | "\\Defcs{#1ParamsSep}{, }\n"␊ |
2735 | "\n"␊ |
2736 | "\\Defcs{#1Name}##1{\\textbf{##1}}\n"␊ |
2737 | "\\Defcs{#1See}##1{\\See{##1}}\n"␊ |
2738 | "\\Defcs{#1Return}##1{\\Heading{Returns: }##1}\n"␊ |
2739 | "\\Defcs{field#1Title}{\\Frame{\\Cs{field#1Type}{} \\Cs{field#1Name}(\\Cs{field#1Params})}}%\n"␊ |
2740 | "%\n"␊ |
2741 | "\\Zone{#1s}{\\Cs{field#1List}}{\\subsubsection{#2}\\Cs{field#1List}}%\n"␊ |
2742 | "\\Member{#1}{%\n"␊ |
2743 | "\\Cs{field#1Title}\\vskip 6mm\\relax\\Cs{field#1DetailedDoc}\n"␊ |
2744 | "\\Cs{field#1Return}\\Cs{field#1PDBlocks}\\Cs{field#1See}\\vskip 5mm\\relax}}\n"␊ |
2745 | "\n"␊ |
2746 | "\\def\\FileDetailed{\\fieldFileDetailedDoc\\par}\n"␊ |
2747 | "\\def\\ClassDetailed{\\fieldClassDetailedDoc\\par}\n"␊ |
2748 | "\n"␊ |
2749 | "\\def\\FileSubzones{\\fieldFileTypedefs\\fieldFileVariables\\fieldFileFunctions}\n"␊ |
2750 | "\n"␊ |
2751 | "\\def\\ClassSubzones{%\n"␊ |
2752 | "\\fieldClassPublicTypedefs\\fieldClassPublicMembers\\fieldClassPublicMethods\n"␊ |
2753 | "\\fieldClassProtectedTypedefs\\fieldClassProtectedMembers\\fieldClassProtectedMethods\n"␊ |
2754 | "\\fieldClassPrivateTypedefs\\fieldClassPrivateMembers\\fieldClassPrivateMethods}\n"␊ |
2755 | "\n"␊ |
2756 | "\\Member{Page}{\\subsection{\\fieldPageName}\\fieldPageDetailedDoc}\n"␊ |
2757 | "\n"␊ |
2758 | "\\TypedefMemberList{FileTypedef}{Typedefs}\n"␊ |
2759 | "\\VariableMemberList{FileVariable}{Variables}\n"␊ |
2760 | "\\FunctionMemberList{FileFunction}{Functions}\n"␊ |
2761 | "\\Zone{File}{\\FileSubzones}{\\subsection{\\fieldFileName}\\fieldFileDetailed\\FileSubzones}\n"␊ |
2762 | "\n"␊ |
2763 | "\\TypedefMemberList{ClassPublicTypedef}{Public Typedefs}\n"␊ |
2764 | "\\TypedefMemberList{ClassProtectedTypedef}{Protected Typedefs}\n"␊ |
2765 | "\\TypedefMemberList{ClassPrivateTypedef}{Private Typedefs}\n"␊ |
2766 | "\\VariableMemberList{ClassPublicMember}{Public Members}\n"␊ |
2767 | "\\VariableMemberList{ClassProtectedMember}{Protected Members}\n"␊ |
2768 | "\\VariableMemberList{ClassPrivateMember}{Private Members}\n"␊ |
2769 | "\\FunctionMemberList{ClassPublicMethod}{Public Methods}\n"␊ |
2770 | "\\FunctionMemberList{ClassProtectedMethod}{Protected Methods}\n"␊ |
2771 | "\\FunctionMemberList{ClassPrivateMethod}{Private Methods}\n"␊ |
2772 | "\\Zone{Class}{\\ClassSubzones}{\\subsection{\\fieldClassName}\\fieldClassDetailed\\ClassSubzones}\n"␊ |
2773 | "\n"␊ |
2774 | "\\Zone{AllPages}{\\fieldPages}{\\section{Pages}\\fieldPages}\n"␊ |
2775 | "\\Zone{AllFiles}{\\fieldFiles}{\\section{Files}\\fieldFiles}\n"␊ |
2776 | "\\Zone{AllClasses}{\\fieldClasses}{\\section{Classes}\\fieldClasses}\n"␊ |
2777 | "\n"␊ |
2778 | "\\newlength{\\oldparskip}\n"␊ |
2779 | "\\newlength{\\oldparindent}\n"␊ |
2780 | "\\newlength{\\oldfboxrule}\n"␊ |
2781 | "\n"␊ |
2782 | "\\ZoneDepth0\\relax\n"␊ |
2783 | "\\Letcs{Mode0}1\\relax\n"␊ |
2784 | "\n"␊ |
2785 | "\\def\\EmitDoxyDocs{%\n"␊ |
2786 | "\\setlength{\\oldparskip}{\\parskip}\n"␊ |
2787 | "\\setlength{\\oldparindent}{\\parindent}\n"␊ |
2788 | "\\setlength{\\oldfboxrule}{\\fboxrule}\n"␊ |
2789 | "\\setlength{\\parskip}{0cm}\n"␊ |
2790 | "\\setlength{\\parindent}{0cm}\n"␊ |
2791 | "\\setlength{\\fboxrule}{1pt}\n"␊ |
2792 | "\\AllPages\\AllFiles\\AllClasses\n"␊ |
2793 | "\\setlength{\\parskip}{\\oldparskip}\n"␊ |
2794 | "\\setlength{\\parindent}{\\oldparindent}\n"␊ |
2795 | "\\setlength{\\fboxrule}{\\oldfboxrule}}\n";␊ |
2796 | ␊ |
2797 | return true;␊ |
2798 | }␊ |
2799 | ␊ |
2800 | bool PerlModGenerator::generateDoxyLatexTex()␊ |
2801 | {␊ |
2802 | QFile doxyLatexTex;␊ |
2803 | if (!createOutputFile(doxyLatexTex, pathDoxyLatexTex))␊ |
2804 | return false;␊ |
2805 | ␊ |
2806 | FTextStream doxyLatexTexStream(&doxyLatexTex);␊ |
2807 | doxyLatexTexStream <<␊ |
2808 | "\\documentclass[a4paper,12pt]{article}\n"␊ |
2809 | "\\usepackage[latin1]{inputenc}\n"␊ |
2810 | "\\usepackage[none]{hyphenat}\n"␊ |
2811 | "\\usepackage[T1]{fontenc}\n"␊ |
2812 | "\\usepackage{hyperref}\n"␊ |
2813 | "\\usepackage{times}\n"␊ |
2814 | "\n"␊ |
2815 | "\\input{doxyformat}\n"␊ |
2816 | "\n"␊ |
2817 | "\\begin{document}\n"␊ |
2818 | "\\input{" << pathDoxyDocsTex << "}\n"␊ |
2819 | "\\sloppy\n"␊ |
2820 | "\\EmitDoxyDocs\n"␊ |
2821 | "\\end{document}\n";␊ |
2822 | ␊ |
2823 | return true;␊ |
2824 | }␊ |
2825 | ␊ |
2826 | void PerlModGenerator::generate()␊ |
2827 | {␊ |
2828 | // + classes␊ |
2829 | // + namespaces␊ |
2830 | // + files␊ |
2831 | // - packages␊ |
2832 | // + groups␊ |
2833 | // + related pages␊ |
2834 | // - examples␊ |
2835 | ␊ |
2836 | QDir perlModDir;␊ |
2837 | if (!createOutputDir(perlModDir))␊ |
2838 | return;␊ |
2839 | ␊ |
2840 | bool perlmodLatex = Config_getBool("PERLMOD_LATEX");␊ |
2841 | ␊ |
2842 | pathDoxyDocsPM = perlModDir.absPath() + "/DoxyDocs.pm";␊ |
2843 | pathDoxyStructurePM = perlModDir.absPath() + "/DoxyStructure.pm";␊ |
2844 | pathMakefile = perlModDir.absPath() + "/Makefile";␊ |
2845 | pathDoxyRules = perlModDir.absPath() + "/doxyrules.make";␊ |
2846 | ␊ |
2847 | if (perlmodLatex) {␊ |
2848 | pathDoxyStructureTex = perlModDir.absPath() + "/doxystructure.tex";␊ |
2849 | pathDoxyFormatTex = perlModDir.absPath() + "/doxyformat.tex";␊ |
2850 | pathDoxyLatexTex = perlModDir.absPath() + "/doxylatex.tex";␊ |
2851 | pathDoxyLatexDVI = perlModDir.absPath() + "/doxylatex.dvi";␊ |
2852 | pathDoxyLatexPDF = perlModDir.absPath() + "/doxylatex.pdf";␊ |
2853 | pathDoxyDocsTex = perlModDir.absPath() + "/doxydocs.tex";␊ |
2854 | pathDoxyLatexPL = perlModDir.absPath() + "/doxylatex.pl";␊ |
2855 | pathDoxyLatexStructurePL = perlModDir.absPath() + "/doxylatex-structure.pl";␊ |
2856 | }␊ |
2857 | ␊ |
2858 | if (!(generatePerlModOutput()␊ |
2859 | ␉&& generateDoxyStructurePM()␊ |
2860 | ␉&& generateMakefile()␊ |
2861 | ␉&& generateDoxyRules()))␊ |
2862 | return;␊ |
2863 | ␊ |
2864 | if (perlmodLatex) {␊ |
2865 | if (!(generateDoxyLatexStructurePL()␊ |
2866 | ␉ && generateDoxyLatexPL()␊ |
2867 | ␉ && generateDoxyLatexTex()␊ |
2868 | ␉ && generateDoxyFormatTex()))␊ |
2869 | return;␊ |
2870 | }␊ |
2871 | }␊ |
2872 | ␊ |
2873 | void generatePerlMod()␊ |
2874 | {␊ |
2875 | PerlModGenerator pmg(Config_getBool("PERLMOD_PRETTY"));␊ |
2876 | pmg.generate();␊ |
2877 | }␊ |
2878 | ␊ |
2879 | // Local Variables:␊ |
2880 | // c-basic-offset: 2␊ |
2881 | // End:␊ |
2882 | ␊ |
2883 | /* This elisp function for XEmacs makes Control-Z transform␊ |
2884 | the text in the region into a valid C string.␊ |
2885 | ␊ |
2886 | (global-set-key '(control z) (lambda () (interactive)␊ |
2887 | (save-excursion␊ |
2888 | (if (< (mark) (point)) (exchange-point-and-mark))␊ |
2889 | (let ((start (point)) (replacers ␊ |
2890 | '(("\\\\" "\\\\\\\\")␊ |
2891 | ("\"" "\\\\\"")␊ |
2892 | ("\t" "\\\\t")␊ |
2893 | ("^.*$" "\"\\&\\\\n\""))))␊ |
2894 | (while replacers ␊ |
2895 | (while (re-search-forward (caar replacers) (mark) t)␊ |
2896 | (replace-match (cadar replacers) t))␊ |
2897 | (goto-char start)␊ |
2898 | (setq replacers (cdr replacers)))))))␊ |
2899 | */␊ |
2900 |