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