My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
53  QCString m_s;
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 
81 void PerlModOutputStream::add(QCString &s)
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 
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');
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 
194  QStack<PerlModOutputStream> m_saved;
196 };
197 
199 {
200  m_saved.push(m_stream);
202 }
203 
204 void PerlModOutput::icloseSave(QCString &s)
205 {
206  s = m_stream->m_s;
207  delete m_stream;
208  m_stream = m_saved.pop();
209 }
210 
212 {
214  {
215  char *s = &m_spaces[m_indentation * 2];
216  *s++ = ' '; *s++ = ' '; *s = 0;
217  }
218  m_indentation++;
219 }
220 
222 {
223  m_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 
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 *);
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 *);
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 
427  QCString m_other;
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 
451 void PerlModDocVisitor::openItem(const char *name)
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 
482 void PerlModDocVisitor::singleItem(const char *name)
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  return;
657 #endif
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  if (s->hasCaption())
671  {
672  openSubBlock("caption");
673  QListIterator<DocNode> cli(s->children());
674  DocNode *n;
675  for (cli.toFirst();(n=cli.current());++cli) n->accept(this);
676  closeSubBlock();
677  }
678  m_output.addFieldQuotedString("content", s->text());
679  closeItem();
680 }
681 
683 {
684  QCString anchor = anc->file() + "_1" + anc->anchor();
685  openItem("anchor");
686  m_output.addFieldQuotedString("id", anchor);
687  closeItem();
688 }
689 
691 {
692  const char *type = 0;
693  switch(inc->type())
694  {
696  #if 0
697  {
698  m_t << "<div class=\"fragment\"><pre>";
699  QFileInfo cfi( inc->file() );
700  FileDef fd( cfi.dirPath(), cfi.fileName() );
701  parseCode(m_ci,inc->context(),inc->text().latin1(),inc->isExample(),inc->exampleFile(), &fd);
702  m_t << "</pre></div>";
703  }
704  break;
705  #endif
706  return;
707  case DocInclude::Include:
708 #if 0
709  m_output.add("<programlisting>");
710  parseCode(m_ci,inc->context(),inc->text(),FALSE,0);
711  m_output.add("</programlisting>");
712 #endif
713  return;
714  case DocInclude::DontInclude: return;
715  case DocInclude::HtmlInclude: type = "htmlonly"; break;
716  case DocInclude::LatexInclude: type = "latexonly"; break;
717  case DocInclude::VerbInclude: type = "preformatted"; break;
718  case DocInclude::Snippet: return;
721  err("Internal inconsistency: found switch SnippetDoc / IncludeDoc in file: %s"
722  "Please create a bug report\n",__FILE__);
723  break;
724  }
725  openItem(type);
726  m_output.addFieldQuotedString("content", inc->text());
727  closeItem();
728 }
729 
731 {
732 #if 0
733  //printf("DocIncOperator: type=%d first=%d, last=%d text=`%s'\n",
734  // op->type(),op->isFirst(),op->isLast(),op->text().data());
735  if (op->isFirst())
736  {
737  m_output.add("<programlisting>");
738  }
739  if (op->type()!=DocIncOperator::Skip)
740  {
741  parseCode(m_ci,op->context(),op->text(),FALSE,0);
742  }
743  if (op->isLast())
744  {
745  m_output.add("</programlisting>");
746  }
747  else
748  {
749  m_output.add('\n');
750  }
751 #endif
752 }
753 
755 {
756  openItem("formula");
757  QCString id;
758  id += f->id();
759  m_output.addFieldQuotedString("id", id).addFieldQuotedString("content", f->text());
760  closeItem();
761 }
762 
764 {
765 #if 0
766  m_output.add("<indexentry>"
767  "<primaryie>");
768  m_output.addQuoted(ie->entry());
769  m_output.add("</primaryie>"
770  "<secondaryie></secondaryie>"
771  "</indexentry>");
772 #endif
773 }
774 
776 {
777 }
778 
780 {
781  openItem("cite");
782  m_output.addFieldQuotedString("text", cite->text());
783  closeItem();
784 }
785 
786 
787 //--------------------------------------
788 // visitor functions for compound nodes
789 //--------------------------------------
790 
792 {
793  openItem("list");
794  m_output.addFieldQuotedString("style", l->isEnumList() ? "ordered" : "itemized");
795  openSubBlock("content");
796 }
797 
799 {
800  closeSubBlock();
801  closeItem();
802 }
803 
805 {
806  openSubBlock();
807 }
808 
810 {
811  closeSubBlock();
812 }
813 
815 {
816  if (m_textblockstart)
817  m_textblockstart = false;
818  else
819  singleItem("parbreak");
820  /*
821  openItem("para");
822  openSubBlock("content");
823  */
824 }
825 
827 {
828  /*
829  closeSubBlock();
830  closeItem();
831  */
832 }
833 
835 {
836 }
837 
839 {
840 }
841 
843 {
844  const char *type = 0;
845  switch (s->type())
846  {
847  case DocSimpleSect::See: type = "see"; break;
848  case DocSimpleSect::Return: type = "return"; break;
849  case DocSimpleSect::Author: type = "author"; break;
850  case DocSimpleSect::Authors: type = "authors"; break;
851  case DocSimpleSect::Version: type = "version"; break;
852  case DocSimpleSect::Since: type = "since"; break;
853  case DocSimpleSect::Date: type = "date"; break;
854  case DocSimpleSect::Note: type = "note"; break;
855  case DocSimpleSect::Warning: type = "warning"; break;
856  case DocSimpleSect::Pre: type = "pre"; break;
857  case DocSimpleSect::Post: type = "post"; break;
858  case DocSimpleSect::Copyright: type = "copyright"; break;
859  case DocSimpleSect::Invar: type = "invariant"; break;
860  case DocSimpleSect::Remark: type = "remark"; break;
861  case DocSimpleSect::Attention: type = "attention"; break;
862  case DocSimpleSect::User: type = "par"; break;
863  case DocSimpleSect::Rcs: type = "rcs"; break;
865  err("unknown simple section found\n");
866  break;
867  }
868  leaveText();
869  m_output.openHash();
870  openOther();
871  openSubBlock(type);
872 }
873 
875 {
876  closeSubBlock();
877  closeOther();
879 }
880 
882 {
883  openItem("title");
884  openSubBlock("content");
885 }
886 
888 {
889  closeSubBlock();
890  closeItem();
891 }
892 
894 {
895  openItem("list");
896  m_output.addFieldQuotedString("style", "itemized");
897  openSubBlock("content");
898 }
899 
901 {
902  closeSubBlock();
903  closeItem();
904 }
905 
908 
910 {
911  QCString sect = QCString().sprintf("sect%d",s->level());
912  openItem(sect);
913  m_output.addFieldQuotedString("title", s->title());
914  openSubBlock("content");
915 }
916 
918 {
919  closeSubBlock();
920  closeItem();
921 }
922 
924 {
925  openItem("list");
926  m_output.addFieldQuotedString("style", (l->type() == DocHtmlList::Ordered) ? "ordered" : "itemized");
927  openSubBlock("content");
928 }
929 
931 {
932  closeSubBlock();
933  closeItem();
934 }
935 
938 
939 //void PerlModDocVisitor::visitPre(DocHtmlPre *)
940 //{
941 // openItem("preformatted");
942 // openSubBlock("content");
943 // //m_insidePre=TRUE;
944 //}
945 
946 //void PerlModDocVisitor::visitPost(DocHtmlPre *)
947 //{
948 // //m_insidePre=FALSE;
949 // closeSubBlock();
950 // closeItem();
951 //}
952 
954 {
955 #if 0
956  m_output.add("<variablelist>\n");
957 #endif
958 }
959 
961 {
962 #if 0
963  m_output.add("</variablelist>\n");
964 #endif
965 }
966 
968 {
969 #if 0
970  m_output.add("<varlistentry><term>");
971 #endif
972 }
973 
975 {
976 #if 0
977  m_output.add("</term></varlistentry>\n");
978 #endif
979 }
980 
982 {
983 #if 0
984  m_output.add("<listitem>");
985 #endif
986 }
987 
989 {
990 #if 0
991  m_output.add("</listitem>\n");
992 #endif
993 }
994 
996 {
997 #if 0
998  m_output.add("<table rows=\""); m_output.add(t->numRows());
999  m_output.add("\" cols=\""); m_output.add(t->numCols()); m_output.add("\">");
1000 #endif
1001 }
1002 
1004 {
1005 #if 0
1006  m_output.add("</table>\n");
1007 #endif
1008 }
1009 
1011 {
1012 #if 0
1013  m_output.add("<row>\n");
1014 #endif
1015 }
1016 
1018 {
1019 #if 0
1020  m_output.add("</row>\n");
1021 #endif
1022 }
1023 
1025 {
1026 #if 0
1027  if (c->isHeading()) m_output.add("<entry thead=\"yes\">"); else m_output.add("<entry thead=\"no\">");
1028 #endif
1029 }
1030 
1032 {
1033 #if 0
1034  m_output.add("</entry>");
1035 #endif
1036 }
1037 
1039 {
1040 #if 0
1041  m_output.add("<caption>");
1042 #endif
1043 }
1044 
1046 {
1047 #if 0
1048  m_output.add("</caption>\n");
1049 #endif
1050 }
1051 
1053 {
1054 #if 0
1055  m_output.add("<internal>");
1056 #endif
1057 }
1058 
1060 {
1061 #if 0
1062  m_output.add("</internal>");
1063 #endif
1064 }
1065 
1067 {
1068 #if 0
1069  m_output.add("<ulink url=\""); m_output.add(href->url()); m_output.add("\">");
1070 #endif
1071 }
1072 
1074 {
1075 #if 0
1076  m_output.add("</ulink>");
1077 #endif
1078 }
1079 
1081 {
1082 #if 0
1083  m_output.add("<sect"); m_output.add(header->level()); m_output.add(">");
1084 #endif
1085 }
1086 
1088 {
1089 #if 0
1090  m_output.add("</sect"); m_output.add(header->level()); m_output.add(">\n");
1091 #endif
1092 }
1093 
1095 {
1096 #if 0
1097  m_output.add("<image type=\"");
1098  switch(img->type())
1099  {
1100  case DocImage::Html: m_output.add("html"); break;
1101  case DocImage::Latex: m_output.add("latex"); break;
1102  case DocImage::Rtf: m_output.add("rtf"); break;
1103  }
1104  m_output.add("\"");
1105 
1106  QCString baseName=img->name();
1107  int i;
1108  if ((i=baseName.findRev('/'))!=-1 || (i=baseName.findRev('\\'))!=-1)
1109  {
1110  baseName=baseName.right(baseName.length()-i-1);
1111  }
1112  m_output.add(" name=\""); m_output.add(baseName); m_output.add("\"");
1113  if (!img->width().isEmpty())
1114  {
1115  m_output.add(" width=\"");
1116  m_output.addQuoted(img->width());
1117  m_output.add("\"");
1118  }
1119  else if (!img->height().isEmpty())
1120  {
1121  m_output.add(" height=\"");
1122  m_output.addQuoted(img->height());
1123  m_output.add("\"");
1124  }
1125  m_output.add(">");
1126 #endif
1127 }
1128 
1130 {
1131 #if 0
1132  m_output.add("</image>");
1133 #endif
1134 }
1135 
1137 {
1138 #if 0
1139  m_output.add("<dotfile name=\""); m_output.add(df->file()); m_output.add("\">");
1140 #endif
1141 }
1142 
1144 {
1145 #if 0
1146  m_output.add("</dotfile>");
1147 #endif
1148 }
1150 {
1151 #if 0
1152  m_output.add("<mscfile name=\""); m_output.add(df->file()); m_output.add("\">");
1153 #endif
1154 }
1155 
1157 {
1158 #if 0
1159  m_output.add("<mscfile>");
1160 #endif
1161 }
1162 
1164 {
1165 #if 0
1166  m_output.add("<diafile name=\""); m_output.add(df->file()); m_output.add("\">");
1167 #endif
1168 }
1169 
1171 {
1172 #if 0
1173  m_output.add("</diafile>");
1174 #endif
1175 }
1176 
1177 
1179 {
1180  openItem("link");
1181  addLink(lnk->ref(), lnk->file(), lnk->anchor());
1182 }
1183 
1185 {
1186  closeItem();
1187 }
1188 
1190 {
1191  openItem("ref");
1192  if (!ref->hasLinkText())
1193  m_output.addFieldQuotedString("text", ref->targetTitle());
1194  openSubBlock("content");
1195 }
1196 
1198 {
1199  closeSubBlock();
1200  closeItem();
1201 }
1202 
1204 {
1205 #if 0
1206  m_output.add("<tocitem id=\""); m_output.add(ref->file()); m_output.add("_1"); m_output.add(ref->anchor()); m_output.add("\">");
1207 #endif
1208 }
1209 
1211 {
1212 #if 0
1213  m_output.add("</tocitem>");
1214 #endif
1215 }
1216 
1218 {
1219 #if 0
1220  m_output.add("<toclist>");
1221 #endif
1222 }
1223 
1225 {
1226 #if 0
1227  m_output.add("</toclist>");
1228 #endif
1229 }
1230 
1231 //void PerlModDocVisitor::visitPre(DocLanguage *l)
1232 //{
1233 // openItem("language");
1234 // m_output.addFieldQuotedString("id", l->id());
1235 //}
1236 //
1237 //void PerlModDocVisitor::visitPost(DocLanguage *)
1238 //{
1239 // closeItem();
1240 //}
1241 
1243 {
1244  leaveText();
1245  const char *type = 0;
1246  switch(s->type())
1247  {
1248  case DocParamSect::Param: type = "params"; break;
1249  case DocParamSect::RetVal: type = "retvals"; break;
1250  case DocParamSect::Exception: type = "exceptions"; break;
1251  case DocParamSect::TemplateParam: type = "templateparam"; break;
1252  case DocParamSect::Unknown:
1253  err("unknown parameter section found\n");
1254  break;
1255  }
1256  openOther();
1257  openSubBlock(type);
1258 }
1259 
1261 {
1262  closeSubBlock();
1263  closeOther();
1264 }
1265 
1267 {
1268  leaveText();
1269  m_output.openHash()
1270  .openList("parameters");
1271  //QStrListIterator li(pl->parameters());
1272  //const char *s;
1273  QListIterator<DocNode> li(pl->parameters());
1274  DocNode *param;
1275  for (li.toFirst();(param=li.current());++li)
1276  {
1277  QCString name;
1278  if (param->kind()==DocNode::Kind_Word)
1279  {
1280  name = ((DocWord*)param)->word();
1281  }
1282  else if (param->kind()==DocNode::Kind_LinkedWord)
1283  {
1284  name = ((DocLinkedWord*)param)->word();
1285  }
1286 
1287  QCString dir = "";
1288  DocParamSect *sect = 0;
1289  if (pl->parent()->kind()==DocNode::Kind_ParamSect)
1290  {
1291  sect=(DocParamSect*)pl->parent();
1292  }
1293  if (sect && sect->hasInOutSpecifier())
1294  {
1296  {
1297  if (pl->direction()==DocParamSect::In)
1298  {
1299  dir = "in";
1300  }
1301  else if (pl->direction()==DocParamSect::Out)
1302  {
1303  dir = "out";
1304  }
1305  else if (pl->direction()==DocParamSect::InOut)
1306  {
1307  dir = "in,out";
1308  }
1309  }
1310  }
1311 
1312  m_output.openHash()
1313  .addFieldQuotedString("name", name).addFieldQuotedString("dir", dir)
1314  .closeHash();
1315  }
1317  .openList("doc");
1318 }
1319 
1321 {
1322  leaveText();
1324  .closeHash();
1325 }
1326 
1328 {
1329 #if 0
1330  m_output.add("<xrefsect id=\"");
1331  m_output.add(x->file()); m_output.add("_1"); m_output.add(x->anchor());
1332  m_output.add("\">");
1333  m_output.add("<xreftitle>");
1334  m_output.addQuoted(x->title());
1335  m_output.add("</xreftitle>");
1336  m_output.add("<xrefdescription>");
1337 #endif
1338  if (x->title().isEmpty()) return;
1339  openItem("xrefitem");
1340  openSubBlock("content");
1341 }
1342 
1344 {
1345  if (x->title().isEmpty()) return;
1346  closeSubBlock();
1347  closeItem();
1348 #if 0
1349  m_output.add("</xrefdescription>");
1350  m_output.add("</xrefsect>");
1351 #endif
1352 }
1353 
1355 {
1356  openItem("ref");
1357  addLink(0,ref->file(),ref->anchor());
1358  openSubBlock("content");
1359 }
1360 
1362 {
1363  closeSubBlock();
1364  closeItem();
1365 }
1366 
1368 {
1369 }
1370 
1372 {
1373 }
1374 
1376 {
1377 }
1378 
1380 {
1381 }
1382 
1384 {
1385  openItem("blockquote");
1386  openSubBlock("content");
1387 }
1388 
1390 {
1391  closeSubBlock();
1392  closeItem();
1393 }
1394 
1396 {
1397 }
1398 
1400 {
1401 }
1402 
1404 {
1405 }
1406 
1408 {
1409 }
1410 
1411 
1412 static void addTemplateArgumentList(ArgumentList *al,PerlModOutput &output,const char *)
1413 {
1414  if (!al)
1415  return;
1416  output.openList("template_parameters");
1417  ArgumentListIterator ali(*al);
1418  Argument *a;
1419  for (ali.toFirst();(a=ali.current());++ali)
1420  {
1421  output.openHash();
1422  if (!a->type.isEmpty())
1423  output.addFieldQuotedString("type", a->type);
1424  if (!a->name.isEmpty())
1425  output.addFieldQuotedString("declaration_name", a->name)
1426  .addFieldQuotedString("definition_name", a->name);
1427  if (!a->defval.isEmpty())
1428  output.addFieldQuotedString("default", a->defval);
1429  output.closeHash();
1430  }
1431  output.closeList();
1432 }
1433 
1434 #if 0
1435 static void addMemberTemplateLists(MemberDef *md,PerlModOutput &output)
1436 {
1437  ClassDef *cd = md->getClassDef();
1438  const char *cname = cd ? cd->name().data() : 0;
1439  if (md->templateArguments()) // function template prefix
1440  addTemplateArgumentList(md->templateArguments(),output,cname);
1441 }
1442 #endif
1443 
1444 static void addTemplateList(ClassDef *cd,PerlModOutput &output)
1445 {
1446  addTemplateArgumentList(cd->templateArguments(),output,cd->name());
1447 }
1448 
1449 static void addPerlModDocBlock(PerlModOutput &output,
1450  const char *name,
1451  const QCString &fileName,
1452  int lineNr,
1453  Definition *scope,
1454  MemberDef *md,
1455  const QCString &text)
1456 {
1457  QCString stext = text.stripWhiteSpace();
1458  if (stext.isEmpty())
1459  output.addField(name).add("{}");
1460  else {
1461  DocNode *root = validatingParseDoc(fileName,lineNr,scope,md,stext,FALSE,0);
1462  output.openHash(name);
1463  PerlModDocVisitor *visitor = new PerlModDocVisitor(output);
1464  root->accept(visitor);
1465  visitor->finish();
1466  output.closeHash();
1467  delete visitor;
1468  delete root;
1469  }
1470 }
1471 
1472 static const char *getProtectionName(Protection prot)
1473 {
1474  switch (prot)
1475  {
1476  case Public: return "public";
1477  case Protected: return "protected";
1478  case Private: return "private";
1479  case Package: return "package";
1480  }
1481  return 0;
1482 }
1483 
1484 static const char *getVirtualnessName(Specifier virt)
1485 {
1486  switch(virt)
1487  {
1488  case Normal: return "non_virtual";
1489  case Virtual: return "virtual";
1490  case Pure: return "pure_virtual";
1491  }
1492  return 0;
1493 }
1494 
1495 static QCString pathDoxyfile;
1496 static QCString pathDoxyExec;
1497 
1498 void setPerlModDoxyfile(const QCString &qs)
1499 {
1500  pathDoxyfile = qs;
1501  pathDoxyExec = QDir::currentDirPath().utf8();
1502 }
1503 
1505 {
1506 public:
1507 
1509 
1517  QCString pathDoxyDocsPM;
1520  QCString pathDoxyRules;
1521  QCString pathMakefile;
1522 
1523  inline PerlModGenerator(bool pretty) : m_output(pretty) { }
1524 
1527  const char *name, const char *header=0);
1528  void addListOfAllMembers(ClassDef *cd);
1531  void generatePerlModForFile(FileDef *fd);
1533  void generatePerlModForPage(PageDef *pi);
1534 
1535  bool createOutputFile(QFile &f, const char *s);
1536  bool createOutputDir(QDir &perlModDir);
1537  bool generateDoxyLatexTex();
1538  bool generateDoxyFormatTex();
1539  bool generateDoxyStructurePM();
1540  bool generateDoxyLatexPL();
1542  bool generateDoxyRules();
1543  bool generateMakefile();
1544  bool generatePerlModOutput();
1545 
1546  void generate();
1547 };
1548 
1550 {
1551  // + declaration/definition arg lists
1552  // + reimplements
1553  // + reimplementedBy
1554  // + exceptions
1555  // + const/volatile specifiers
1556  // - examples
1557  // - source definition
1558  // - source references
1559  // - source referenced by
1560  // - body code
1561  // - template arguments
1562  // (templateArguments(), definitionTemplateParameterLists())
1563 
1564  QCString memType;
1565  bool isFunc=FALSE;
1566  switch (md->memberType())
1567  {
1568  case MemberType_Define: memType="define"; break;
1569  case MemberType_EnumValue: memType="enumvalue"; break;
1570  case MemberType_Property: memType="property"; break;
1571  case MemberType_Variable: memType="variable"; break;
1572  case MemberType_Typedef: memType="typedef"; break;
1573  case MemberType_Enumeration: memType="enum"; break;
1574  case MemberType_Function: memType="function"; isFunc=TRUE; break;
1575  case MemberType_Signal: memType="signal"; isFunc=TRUE; break;
1576  //case MemberType_Prototype: memType="prototype"; isFunc=TRUE; break;
1577  case MemberType_Friend: memType="friend"; isFunc=TRUE; break;
1578  case MemberType_DCOP: memType="dcop"; isFunc=TRUE; break;
1579  case MemberType_Slot: memType="slot"; isFunc=TRUE; break;
1580  case MemberType_Event: memType="event"; break;
1581  case MemberType_Interface: memType="interface"; break;
1582  case MemberType_Service: memType="service"; break;
1583  }
1584 
1585  m_output.openHash()
1586  .addFieldQuotedString("kind", memType)
1587  .addFieldQuotedString("name", md->name())
1588  .addFieldQuotedString("virtualness", getVirtualnessName(md->virtualness()))
1589  .addFieldQuotedString("protection", getProtectionName(md->protection()))
1590  .addFieldBoolean("static", md->isStatic());
1591 
1593  addPerlModDocBlock(m_output,"detailed",md->getDefFileName(),md->getDefLine(),md->getOuterScope(),md,md->documentation());
1594  if (md->memberType()!=MemberType_Define &&
1596  m_output.addFieldQuotedString("type", md->typeString());
1597 
1598  ArgumentList *al = md->argumentList();
1599  if (isFunc) //function
1600  {
1601  m_output.addFieldBoolean("const", al!=0 && al->constSpecifier)
1602  .addFieldBoolean("volatile", al!=0 && al->volatileSpecifier);
1603 
1604  m_output.openList("parameters");
1605  ArgumentList *declAl = md->declArgumentList();
1606  ArgumentList *defAl = md->argumentList();
1607  if (declAl && declAl->count()>0)
1608  {
1609  ArgumentListIterator declAli(*declAl);
1610  ArgumentListIterator defAli(*defAl);
1611  Argument *a;
1612  for (declAli.toFirst();(a=declAli.current());++declAli)
1613  {
1614  Argument *defArg = defAli.current();
1615  m_output.openHash();
1616 
1617  if (!a->name.isEmpty())
1618  m_output.addFieldQuotedString("declaration_name", a->name);
1619 
1620  if (defArg && !defArg->name.isEmpty() && defArg->name!=a->name)
1621  m_output.addFieldQuotedString("definition_name", defArg->name);
1622 
1623  if (!a->type.isEmpty())
1624  m_output.addFieldQuotedString("type", a->type);
1625 
1626  if (!a->array.isEmpty())
1627  m_output.addFieldQuotedString("array", a->array);
1628 
1629  if (!a->defval.isEmpty())
1630  m_output.addFieldQuotedString("default_value", a->defval);
1631 
1632  if (!a->attrib.isEmpty())
1633  m_output.addFieldQuotedString("attributes", a->attrib);
1634 
1635  m_output.closeHash();
1636  if (defArg) ++defAli;
1637  }
1638  }
1639  m_output.closeList();
1640  }
1641  else if (md->memberType()==MemberType_Define &&
1642  md->argsString()!=0) // define
1643  {
1644  m_output.openList("parameters");
1645  ArgumentListIterator ali(*al);
1646  Argument *a;
1647  for (ali.toFirst();(a=ali.current());++ali)
1648  {
1649  m_output.openHash()
1650  .addFieldQuotedString("name", a->type)
1651  .closeHash();
1652  }
1653  m_output.closeList();
1654  }
1655  else if (md->argsString()!=0)
1656  {
1657  m_output.addFieldQuotedString("arguments", md->argsString());
1658  }
1659 
1660  if (!md->initializer().isEmpty())
1661  m_output.addFieldQuotedString("initializer", md->initializer());
1662 
1663  if (md->excpString())
1664  m_output.addFieldQuotedString("exceptions", md->excpString());
1665 
1666  if (md->memberType()==MemberType_Enumeration) // enum
1667  {
1668  MemberList *enumFields = md->enumFieldList();
1669  if (enumFields)
1670  {
1671  m_output.openList("values");
1672  MemberListIterator emli(*enumFields);
1673  MemberDef *emd;
1674  for (emli.toFirst();(emd=emli.current());++emli)
1675  {
1676  m_output.openHash()
1677  .addFieldQuotedString("name", emd->name());
1678 
1679  if (!emd->initializer().isEmpty())
1680  m_output.addFieldQuotedString("initializer", emd->initializer());
1681 
1682  addPerlModDocBlock(m_output,"brief",emd->getDefFileName(),emd->getDefLine(),emd->getOuterScope(),emd,emd->briefDescription());
1683 
1684  addPerlModDocBlock(m_output,"detailed",emd->getDefFileName(),emd->getDefLine(),emd->getOuterScope(),emd,emd->documentation());
1685 
1686  m_output.closeHash();
1687  }
1688  m_output.closeList();
1689  }
1690  }
1691 
1692  MemberDef *rmd = md->reimplements();
1693  if (rmd)
1694  m_output.openHash("reimplements")
1695  .addFieldQuotedString("name", rmd->name())
1696  .closeHash();
1697 
1698  MemberList *rbml = md->reimplementedBy();
1699  if (rbml)
1700  {
1701  MemberListIterator mli(*rbml);
1702  m_output.openList("reimplemented_by");
1703  for (mli.toFirst();(rmd=mli.current());++mli)
1704  m_output.openHash()
1705  .addFieldQuotedString("name", rmd->name())
1706  .closeHash();
1707  m_output.closeList();
1708  }
1709 
1710  m_output.closeHash();
1711 }
1712 
1714  MemberList *ml,const char *name,const char *header)
1715 {
1716  if (ml==0) return; // empty list
1717 
1718  m_output.openHash(name);
1719 
1720  if (header)
1721  m_output.addFieldQuotedString("header", header);
1722 
1723  m_output.openList("members");
1724  MemberListIterator mli(*ml);
1725  MemberDef *md;
1726  for (mli.toFirst();(md=mli.current());++mli)
1727  {
1729  }
1731  .closeHash();
1732 }
1733 
1735 {
1736  m_output.openList("all_members");
1737  if (cd->memberNameInfoSDict())
1738  {
1740  MemberNameInfo *mni;
1741  for (mnii.toFirst();(mni=mnii.current());++mnii)
1742  {
1743  MemberNameInfoIterator mii(*mni);
1744  MemberInfo *mi;
1745  for (mii.toFirst();(mi=mii.current());++mii)
1746  {
1747  MemberDef *md=mi->memberDef;
1748  ClassDef *cd=md->getClassDef();
1749  Definition *d=md->getGroupDef();
1750  if (d==0) d = cd;
1751 
1752  m_output.openHash()
1753  .addFieldQuotedString("name", md->name())
1754  .addFieldQuotedString("virtualness", getVirtualnessName(md->virtualness()))
1755  .addFieldQuotedString("protection", getProtectionName(mi->prot));
1756 
1757  if (!mi->ambiguityResolutionScope.isEmpty())
1758  m_output.addFieldQuotedString("ambiguity_scope", mi->ambiguityResolutionScope);
1759 
1760  m_output.addFieldQuotedString("scope", cd->name())
1761  .closeHash();
1762  }
1763  }
1764  }
1765  m_output.closeList();
1766 }
1767 
1769 {
1770  // + brief description
1771  // + detailed description
1772  // + template argument list(s)
1773  // - include file
1774  // + member groups
1775  // + inheritance diagram
1776  // + list of direct super classes
1777  // + list of direct sub classes
1778  // + list of inner classes
1779  // + collaboration diagram
1780  // + list of all members
1781  // + user defined member sections
1782  // + standard member sections
1783  // + detailed member documentation
1784  // - examples using the class
1785 
1786  if (cd->isReference()) return; // skip external references.
1787  if (cd->name().find('@')!=-1) return; // skip anonymous compounds.
1788  if (cd->templateMaster()!=0) return; // skip generated template instances.
1789 
1790  m_output.openHash()
1791  .addFieldQuotedString("name", cd->name());
1792 
1793  if (cd->baseClasses())
1794  {
1795  m_output.openList("base");
1796  BaseClassListIterator bcli(*cd->baseClasses());
1797  BaseClassDef *bcd;
1798  for (bcli.toFirst();(bcd=bcli.current());++bcli)
1799  m_output.openHash()
1800  .addFieldQuotedString("name", bcd->classDef->displayName())
1801  .addFieldQuotedString("virtualness", getVirtualnessName(bcd->virt))
1802  .addFieldQuotedString("protection", getProtectionName(bcd->prot))
1803  .closeHash();
1804  m_output.closeList();
1805  }
1806 
1807  if (cd->subClasses())
1808  {
1809  m_output.openList("derived");
1810  BaseClassListIterator bcli(*cd->subClasses());
1811  BaseClassDef *bcd;
1812  for (bcli.toFirst();(bcd=bcli.current());++bcli)
1813  m_output.openHash()
1814  .addFieldQuotedString("name", bcd->classDef->displayName())
1815  .addFieldQuotedString("virtualness", getVirtualnessName(bcd->virt))
1816  .addFieldQuotedString("protection", getProtectionName(bcd->prot))
1817  .closeHash();
1818  m_output.closeList();
1819  }
1820 
1821  ClassSDict *cl = cd->getClassSDict();
1822  if (cl)
1823  {
1824  m_output.openList("inner");
1825  ClassSDict::Iterator cli(*cl);
1826  ClassDef *cd;
1827  for (cli.toFirst();(cd=cli.current());++cli)
1828  m_output.openHash()
1829  .addFieldQuotedString("name", cd->name())
1830  .closeHash();
1831  m_output.closeList();
1832  }
1833 
1834  IncludeInfo *ii=cd->includeInfo();
1835  if (ii)
1836  {
1837  QCString nm = ii->includeName;
1838  if (nm.isEmpty() && ii->fileDef) nm = ii->fileDef->docName();
1839  if (!nm.isEmpty())
1840  {
1841  m_output.openHash("includes");
1842 #if 0
1843  if (ii->fileDef && !ii->fileDef->isReference()) // TODO: support external references
1844  t << " id=\"" << ii->fileDef->getOutputFileBase() << "\"";
1845 #endif
1846  m_output.addFieldBoolean("local", ii->local)
1847  .addFieldQuotedString("name", nm)
1848  .closeHash();
1849  }
1850  }
1851 
1853  addListOfAllMembers(cd);
1854  if (cd->getMemberGroupSDict())
1855  {
1857  MemberGroup *mg;
1858  for (;(mg=mgli.current());++mgli)
1859  generatePerlModSection(cd,mg->members(),"user_defined",mg->header());
1860  }
1861 
1869  generatePerlModSection(cd,cd->getMemberList(MemberListType_pubStaticMethods),"public_static_methods");
1870  generatePerlModSection(cd,cd->getMemberList(MemberListType_pubStaticAttribs),"public_static_members");
1871  generatePerlModSection(cd,cd->getMemberList(MemberListType_proTypes),"protected_typedefs");
1872  generatePerlModSection(cd,cd->getMemberList(MemberListType_proMethods),"protected_methods");
1873  generatePerlModSection(cd,cd->getMemberList(MemberListType_proAttribs),"protected_members");
1875  generatePerlModSection(cd,cd->getMemberList(MemberListType_proStaticMethods),"protected_static_methods");
1876  generatePerlModSection(cd,cd->getMemberList(MemberListType_proStaticAttribs),"protected_static_members");
1877  generatePerlModSection(cd,cd->getMemberList(MemberListType_priTypes),"private_typedefs");
1881  generatePerlModSection(cd,cd->getMemberList(MemberListType_priStaticMethods),"private_static_methods");
1882  generatePerlModSection(cd,cd->getMemberList(MemberListType_priStaticAttribs),"private_static_members");
1884  generatePerlModSection(cd,cd->getMemberList(MemberListType_related),"related_methods");
1885 
1886  addPerlModDocBlock(m_output,"brief",cd->getDefFileName(),cd->getDefLine(),cd,0,cd->briefDescription());
1887  addPerlModDocBlock(m_output,"detailed",cd->getDefFileName(),cd->getDefLine(),cd,0,cd->documentation());
1888 
1889 #if 0
1890  DotClassGraph inheritanceGraph(cd,DotClassGraph::Inheritance);
1891  if (!inheritanceGraph.isTrivial())
1892  {
1893  t << " <inheritancegraph>" << endl;
1894  inheritanceGraph.writePerlMod(t);
1895  t << " </inheritancegraph>" << endl;
1896  }
1897  DotClassGraph collaborationGraph(cd,DotClassGraph::Implementation);
1898  if (!collaborationGraph.isTrivial())
1899  {
1900  t << " <collaborationgraph>" << endl;
1901  collaborationGraph.writePerlMod(t);
1902  t << " </collaborationgraph>" << endl;
1903  }
1904  t << " <location file=\""
1905  << cd->getDefFileName() << "\" line=\""
1906  << cd->getDefLine() << "\"";
1907  if (cd->getStartBodyLine()!=-1)
1908  {
1909  t << " bodystart=\"" << cd->getStartBodyLine() << "\" bodyend=\""
1910  << cd->getEndBodyLine() << "\"";
1911  }
1912  t << "/>" << endl;
1913 #endif
1914 
1915  m_output.closeHash();
1916 }
1917 
1919 {
1920  // + contained class definitions
1921  // + contained namespace definitions
1922  // + member groups
1923  // + normal members
1924  // + brief desc
1925  // + detailed desc
1926  // + location
1927  // - files containing (parts of) the namespace definition
1928 
1929  if (nd->isReference()) return; // skip external references
1930 
1931  m_output.openHash()
1932  .addFieldQuotedString("name", nd->name());
1933 
1934  ClassSDict *cl = nd->getClassSDict();
1935  if (cl)
1936  {
1937  m_output.openList("classes");
1938  ClassSDict::Iterator cli(*cl);
1939  ClassDef *cd;
1940  for (cli.toFirst();(cd=cli.current());++cli)
1941  m_output.openHash()
1942  .addFieldQuotedString("name", cd->name())
1943  .closeHash();
1944  m_output.closeList();
1945  }
1946 
1947  NamespaceSDict *nl = nd->getNamespaceSDict();
1948  if (nl)
1949  {
1950  m_output.openList("namespaces");
1951  NamespaceSDict::Iterator nli(*nl);
1952  NamespaceDef *nd;
1953  for (nli.toFirst();(nd=nli.current());++nli)
1954  m_output.openHash()
1955  .addFieldQuotedString("name", nd->name())
1956  .closeHash();
1957  m_output.closeList();
1958  }
1959 
1960  if (nd->getMemberGroupSDict())
1961  {
1963  MemberGroup *mg;
1964  for (;(mg=mgli.current());++mgli)
1965  generatePerlModSection(nd,mg->members(),"user-defined",mg->header());
1966  }
1967 
1974 
1975  addPerlModDocBlock(m_output,"brief",nd->getDefFileName(),nd->getDefLine(),0,0,nd->briefDescription());
1976  addPerlModDocBlock(m_output,"detailed",nd->getDefFileName(),nd->getDefLine(),0,0,nd->documentation());
1977 
1978  m_output.closeHash();
1979 }
1980 
1982 {
1983  // + includes files
1984  // + includedby files
1985  // - include graph
1986  // - included by graph
1987  // - contained class definitions
1988  // - contained namespace definitions
1989  // - member groups
1990  // + normal members
1991  // + brief desc
1992  // + detailed desc
1993  // - source code
1994  // - location
1995  // - number of lines
1996 
1997  if (fd->isReference()) return;
1998 
1999  m_output.openHash()
2000  .addFieldQuotedString("name", fd->name());
2001 
2002  IncludeInfo *inc;
2003  m_output.openList("includes");
2004  if (fd->includeFileList())
2005  {
2006  QListIterator<IncludeInfo> ili1(*fd->includeFileList());
2007  for (ili1.toFirst();(inc=ili1.current());++ili1)
2008  {
2009  m_output.openHash()
2010  .addFieldQuotedString("name", inc->includeName);
2011  if (inc->fileDef && !inc->fileDef->isReference())
2012  {
2014  }
2015  m_output.closeHash();
2016  }
2017  }
2018  m_output.closeList();
2019 
2020  m_output.openList("included_by");
2021  if (fd->includedByFileList())
2022  {
2023  QListIterator<IncludeInfo> ili2(*fd->includedByFileList());
2024  for (ili2.toFirst();(inc=ili2.current());++ili2)
2025  {
2026  m_output.openHash()
2027  .addFieldQuotedString("name", inc->includeName);
2028  if (inc->fileDef && !inc->fileDef->isReference())
2029  {
2031  }
2032  m_output.closeHash();
2033  }
2034  }
2035  m_output.closeList();
2036 
2043 
2044  addPerlModDocBlock(m_output,"brief",fd->getDefFileName(),fd->getDefLine(),0,0,fd->briefDescription());
2045  addPerlModDocBlock(m_output,"detailed",fd->getDefFileName(),fd->getDefLine(),0,0,fd->documentation());
2046 
2047  m_output.closeHash();
2048 }
2049 
2051 {
2052  // + members
2053  // + member groups
2054  // + files
2055  // + classes
2056  // + namespaces
2057  // - packages
2058  // + pages
2059  // + child groups
2060  // - examples
2061  // + brief description
2062  // + detailed description
2063 
2064  if (gd->isReference()) return; // skip external references
2065 
2066  m_output.openHash()
2067  .addFieldQuotedString("name", gd->name())
2068  .addFieldQuotedString("title", gd->groupTitle());
2069 
2070  FileList *fl = gd->getFiles();
2071  if (fl)
2072  {
2073  m_output.openList("files");
2074  QListIterator<FileDef> fli(*fl);
2075  FileDef *fd;
2076  for (fli.toFirst();(fd=fli.current());++fli)
2077  m_output.openHash()
2078  .addFieldQuotedString("name", fd->name())
2079  .closeHash();
2080  m_output.closeList();
2081  }
2082 
2083  ClassSDict *cl = gd->getClasses();
2084  if (cl)
2085  {
2086  m_output.openList("classes");
2087  ClassSDict::Iterator cli(*cl);
2088  ClassDef *cd;
2089  for (cli.toFirst();(cd=cli.current());++cli)
2090  m_output.openHash()
2091  .addFieldQuotedString("name", cd->name())
2092  .closeHash();
2093  m_output.closeList();
2094  }
2095 
2096  NamespaceSDict *nl = gd->getNamespaces();
2097  if (nl)
2098  {
2099  m_output.openList("namespaces");
2100  NamespaceSDict::Iterator nli(*nl);
2101  NamespaceDef *nd;
2102  for (nli.toFirst();(nd=nli.current());++nli)
2103  m_output.openHash()
2104  .addFieldQuotedString("name", nd->name())
2105  .closeHash();
2106  m_output.closeList();
2107  }
2108 
2109  PageSDict *pl = gd->getPages();
2110  if (pl)
2111  {
2112  m_output.openList("pages");
2113  PageSDict::Iterator pli(*pl);
2114  PageDef *pd;
2115  for (pli.toFirst();(pd=pli.current());++pli)
2116  m_output.openHash()
2117  .addFieldQuotedString("title", pd->title())
2118  .closeHash();
2119  m_output.closeList();
2120  }
2121 
2122  GroupList *gl = gd->getSubGroups();
2123  if (gl)
2124  {
2125  m_output.openList("groups");
2126  GroupListIterator gli(*gl);
2127  GroupDef *sgd;
2128  for (gli.toFirst();(sgd=gli.current());++gli)
2129  m_output.openHash()
2130  .addFieldQuotedString("title", sgd->groupTitle())
2131  .closeHash();
2132  m_output.closeList();
2133  }
2134 
2135  if (gd->getMemberGroupSDict())
2136  {
2138  MemberGroup *mg;
2139  for (;(mg=mgli.current());++mgli)
2140  generatePerlModSection(gd,mg->members(),"user-defined",mg->header());
2141  }
2142 
2149 
2150  addPerlModDocBlock(m_output,"brief",gd->getDefFileName(),gd->getDefLine(),0,0,gd->briefDescription());
2151  addPerlModDocBlock(m_output,"detailed",gd->getDefFileName(),gd->getDefLine(),0,0,gd->documentation());
2152 
2153  m_output.closeHash();
2154 }
2155 
2157 {
2158  // + name
2159  // + title
2160  // + documentation
2161 
2162  if (pd->isReference()) return;
2163 
2164  m_output.openHash()
2165  .addFieldQuotedString("name", pd->name());
2166 
2167  SectionInfo *si = Doxygen::sectionDict->find(pd->name());
2168  if (si)
2170 
2171  addPerlModDocBlock(m_output,"detailed",pd->docFile(),pd->docLine(),0,0,pd->documentation());
2172  m_output.closeHash();
2173 }
2174 
2176 {
2177  QFile outputFile;
2178  if (!createOutputFile(outputFile, pathDoxyDocsPM))
2179  return false;
2180 
2181  FTextStream outputTextStream(&outputFile);
2182  PerlModOutputStream outputStream(&outputTextStream);
2183  m_output.setPerlModOutputStream(&outputStream);
2184  m_output.add("$doxydocs=").openHash();
2185 
2186  m_output.openList("classes");
2188  ClassDef *cd;
2189  for (cli.toFirst();(cd=cli.current());++cli)
2191  m_output.closeList();
2192 
2193  m_output.openList("namespaces");
2195  NamespaceDef *nd;
2196  for (nli.toFirst();(nd=nli.current());++nli)
2198  m_output.closeList();
2199 
2200  m_output.openList("files");
2202  FileName *fn;
2203  for (;(fn=fnli.current());++fnli)
2204  {
2205  FileNameIterator fni(*fn);
2206  FileDef *fd;
2207  for (;(fd=fni.current());++fni)
2209  }
2210  m_output.closeList();
2211 
2212  m_output.openList("groups");
2214  GroupDef *gd;
2215  for (;(gd=gli.current());++gli)
2216  {
2218  }
2219  m_output.closeList();
2220 
2221  m_output.openList("pages");
2223  PageDef *pd=0;
2224  for (pdi.toFirst();(pd=pdi.current());++pdi)
2225  {
2227  }
2228  if (Doxygen::mainPage)
2229  {
2231  }
2232  m_output.closeList();
2233 
2234  m_output.closeHash().add(";\n1;\n");
2235  return true;
2236 }
2237 
2238 bool PerlModGenerator::createOutputFile(QFile &f, const char *s)
2239 {
2240  f.setName(s);
2241  if (!f.open(IO_WriteOnly))
2242  {
2243  err("Cannot open file %s for writing!\n", s);
2244  return false;
2245  }
2246  return true;
2247 }
2248 
2250 {
2251  QCString outputDirectory = Config_getString(OUTPUT_DIRECTORY);
2252  if (outputDirectory.isEmpty())
2253  {
2254  outputDirectory=QDir::currentDirPath().utf8();
2255  }
2256  else
2257  {
2258  QDir dir(outputDirectory);
2259  if (!dir.exists())
2260  {
2261  dir.setPath(QDir::currentDirPath());
2262  if (!dir.mkdir(outputDirectory))
2263  {
2264  err("tag OUTPUT_DIRECTORY: Output directory `%s' does not "
2265  "exist and cannot be created\n",outputDirectory.data());
2266  exit(1);
2267  }
2268  else
2269  {
2270  msg("Notice: Output directory `%s' does not exist. "
2271  "I have created it for you.\n", outputDirectory.data());
2272  }
2273  dir.cd(outputDirectory);
2274  }
2275  outputDirectory=dir.absPath().utf8();
2276  }
2277 
2278  QDir dir(outputDirectory);
2279  if (!dir.exists())
2280  {
2281  dir.setPath(QDir::currentDirPath());
2282  if (!dir.mkdir(outputDirectory))
2283  {
2284  err("Cannot create directory %s\n",outputDirectory.data());
2285  return false;
2286  }
2287  }
2288 
2289  perlModDir.setPath(outputDirectory+"/perlmod");
2290  if (!perlModDir.exists() && !perlModDir.mkdir(outputDirectory+"/perlmod"))
2291  {
2292  err("Could not create perlmod directory in %s\n",outputDirectory.data());
2293  return false;
2294  }
2295  return true;
2296 }
2297 
2299 {
2300  QFile doxyModelPM;
2301  if (!createOutputFile(doxyModelPM, pathDoxyStructurePM))
2302  return false;
2303 
2304  FTextStream doxyModelPMStream(&doxyModelPM);
2305  doxyModelPMStream <<
2306  "sub memberlist($) {\n"
2307  " my $prefix = $_[0];\n"
2308  " return\n"
2309  "\t[ \"hash\", $prefix . \"s\",\n"
2310  "\t {\n"
2311  "\t members =>\n"
2312  "\t [ \"list\", $prefix . \"List\",\n"
2313  "\t\t[ \"hash\", $prefix,\n"
2314  "\t\t {\n"
2315  "\t\t kind => [ \"string\", $prefix . \"Kind\" ],\n"
2316  "\t\t name => [ \"string\", $prefix . \"Name\" ],\n"
2317  "\t\t static => [ \"string\", $prefix . \"Static\" ],\n"
2318  "\t\t virtualness => [ \"string\", $prefix . \"Virtualness\" ],\n"
2319  "\t\t protection => [ \"string\", $prefix . \"Protection\" ],\n"
2320  "\t\t type => [ \"string\", $prefix . \"Type\" ],\n"
2321  "\t\t parameters =>\n"
2322  "\t\t [ \"list\", $prefix . \"Params\",\n"
2323  "\t\t\t[ \"hash\", $prefix . \"Param\",\n"
2324  "\t\t\t {\n"
2325  "\t\t\t declaration_name => [ \"string\", $prefix . \"ParamName\" ],\n"
2326  "\t\t\t type => [ \"string\", $prefix . \"ParamType\" ],\n"
2327  "\t\t\t },\n"
2328  "\t\t\t],\n"
2329  "\t\t ],\n"
2330  "\t\t detailed =>\n"
2331  "\t\t [ \"hash\", $prefix . \"Detailed\",\n"
2332  "\t\t\t{\n"
2333  "\t\t\t doc => [ \"doc\", $prefix . \"DetailedDoc\" ],\n"
2334  "\t\t\t return => [ \"doc\", $prefix . \"Return\" ],\n"
2335  "\t\t\t see => [ \"doc\", $prefix . \"See\" ],\n"
2336  "\t\t\t params =>\n"
2337  "\t\t\t [ \"list\", $prefix . \"PDBlocks\",\n"
2338  "\t\t\t [ \"hash\", $prefix . \"PDBlock\",\n"
2339  "\t\t\t\t{\n"
2340  "\t\t\t\t parameters =>\n"
2341  "\t\t\t\t [ \"list\", $prefix . \"PDParams\",\n"
2342  "\t\t\t\t [ \"hash\", $prefix . \"PDParam\",\n"
2343  "\t\t\t\t\t{\n"
2344  "\t\t\t\t\t name => [ \"string\", $prefix . \"PDParamName\" ],\n"
2345  "\t\t\t\t\t},\n"
2346  "\t\t\t\t ],\n"
2347  "\t\t\t\t ],\n"
2348  "\t\t\t\t doc => [ \"doc\", $prefix . \"PDDoc\" ],\n"
2349  "\t\t\t\t},\n"
2350  "\t\t\t ],\n"
2351  "\t\t\t ],\n"
2352  "\t\t\t},\n"
2353  "\t\t ],\n"
2354  "\t\t },\n"
2355  "\t\t],\n"
2356  "\t ],\n"
2357  "\t },\n"
2358  "\t];\n"
2359  "}\n"
2360  "\n"
2361  "$doxystructure =\n"
2362  " [ \"hash\", \"Root\",\n"
2363  " {\n"
2364  "\tfiles =>\n"
2365  "\t [ \"list\", \"Files\",\n"
2366  "\t [ \"hash\", \"File\",\n"
2367  "\t {\n"
2368  "\t\tname => [ \"string\", \"FileName\" ],\n"
2369  "\t\ttypedefs => memberlist(\"FileTypedef\"),\n"
2370  "\t\tvariables => memberlist(\"FileVariable\"),\n"
2371  "\t\tfunctions => memberlist(\"FileFunction\"),\n"
2372  "\t\tdetailed =>\n"
2373  "\t\t [ \"hash\", \"FileDetailed\",\n"
2374  "\t\t {\n"
2375  "\t\t doc => [ \"doc\", \"FileDetailedDoc\" ],\n"
2376  "\t\t },\n"
2377  "\t\t ],\n"
2378  "\t },\n"
2379  "\t ],\n"
2380  "\t ],\n"
2381  "\tpages =>\n"
2382  "\t [ \"list\", \"Pages\",\n"
2383  "\t [ \"hash\", \"Page\",\n"
2384  "\t {\n"
2385  "\t\tname => [ \"string\", \"PageName\" ],\n"
2386  "\t\tdetailed =>\n"
2387  "\t\t [ \"hash\", \"PageDetailed\",\n"
2388  "\t\t {\n"
2389  "\t\t doc => [ \"doc\", \"PageDetailedDoc\" ],\n"
2390  "\t\t },\n"
2391  "\t\t ],\n"
2392  "\t },\n"
2393  "\t ],\n"
2394  "\t ],\n"
2395  "\tclasses =>\n"
2396  "\t [ \"list\", \"Classes\",\n"
2397  "\t [ \"hash\", \"Class\",\n"
2398  "\t {\n"
2399  "\t\tname => [ \"string\", \"ClassName\" ],\n"
2400  "\t\tpublic_typedefs => memberlist(\"ClassPublicTypedef\"),\n"
2401  "\t\tpublic_methods => memberlist(\"ClassPublicMethod\"),\n"
2402  "\t\tpublic_members => memberlist(\"ClassPublicMember\"),\n"
2403  "\t\tprotected_typedefs => memberlist(\"ClassProtectedTypedef\"),\n"
2404  "\t\tprotected_methods => memberlist(\"ClassProtectedMethod\"),\n"
2405  "\t\tprotected_members => memberlist(\"ClassProtectedMember\"),\n"
2406  "\t\tprivate_typedefs => memberlist(\"ClassPrivateTypedef\"),\n"
2407  "\t\tprivate_methods => memberlist(\"ClassPrivateMethod\"),\n"
2408  "\t\tprivate_members => memberlist(\"ClassPrivateMember\"),\n"
2409  "\t\tdetailed =>\n"
2410  "\t\t [ \"hash\", \"ClassDetailed\",\n"
2411  "\t\t {\n"
2412  "\t\t doc => [ \"doc\", \"ClassDetailedDoc\" ],\n"
2413  "\t\t },\n"
2414  "\t\t ],\n"
2415  "\t },\n"
2416  "\t ],\n"
2417  "\t ],\n"
2418  "\tgroups =>\n"
2419  "\t [ \"list\", \"Groups\",\n"
2420  "\t [ \"hash\", \"Group\",\n"
2421  "\t {\n"
2422  "\t\tname => [ \"string\", \"GroupName\" ],\n"
2423  "\t\ttitle => [ \"string\", \"GroupTitle\" ],\n"
2424  "\t\tfiles =>\n"
2425  "\t\t [ \"list\", \"Files\",\n"
2426  "\t\t [ \"hash\", \"File\",\n"
2427  "\t\t {\n"
2428  "\t\t name => [ \"string\", \"Filename\" ]\n"
2429  "\t\t }\n"
2430  "\t\t ],\n"
2431  "\t\t ],\n"
2432  "\t\tclasses =>\n"
2433  "\t\t [ \"list\", \"Classes\",\n"
2434  "\t\t [ \"hash\", \"Class\",\n"
2435  "\t\t {\n"
2436  "\t\t name => [ \"string\", \"Classname\" ]\n"
2437  "\t\t }\n"
2438  "\t\t ],\n"
2439  "\t\t ],\n"
2440  "\t\tnamespaces =>\n"
2441  "\t\t [ \"list\", \"Namespaces\",\n"
2442  "\t\t [ \"hash\", \"Namespace\",\n"
2443  "\t\t {\n"
2444  "\t\t name => [ \"string\", \"NamespaceName\" ]\n"
2445  "\t\t }\n"
2446  "\t\t ],\n"
2447  "\t\t ],\n"
2448  "\t\tpages =>\n"
2449  "\t\t [ \"list\", \"Pages\",\n"
2450  "\t\t [ \"hash\", \"Page\","
2451  "\t\t {\n"
2452  "\t\t title => [ \"string\", \"PageName\" ]\n"
2453  "\t\t }\n"
2454  "\t\t ],\n"
2455  "\t\t ],\n"
2456  "\t\tgroups =>\n"
2457  "\t\t [ \"list\", \"Groups\",\n"
2458  "\t\t [ \"hash\", \"Group\",\n"
2459  "\t\t {\n"
2460  "\t\t title => [ \"string\", \"GroupName\" ]\n"
2461  "\t\t }\n"
2462  "\t\t ],\n"
2463  "\t\t ],\n"
2464  "\t\tfunctions => memberlist(\"GroupFunction\"),\n"
2465  "\t\tdetailed =>\n"
2466  "\t\t [ \"hash\", \"GroupDetailed\",\n"
2467  "\t\t {\n"
2468  "\t\t doc => [ \"doc\", \"GroupDetailedDoc\" ],\n"
2469  "\t\t },\n"
2470  "\t\t ],\n"
2471  "\t }\n"
2472  "\t ],\n"
2473  "\t ],\n"
2474  " },\n"
2475  " ];\n"
2476  "\n"
2477  "1;\n";
2478 
2479  return true;
2480 }
2481 
2483 {
2484  QFile doxyRules;
2485  if (!createOutputFile(doxyRules, pathDoxyRules))
2486  return false;
2487 
2488  bool perlmodLatex = Config_getBool(PERLMOD_LATEX);
2489  QCString prefix = Config_getString(PERLMOD_MAKEVAR_PREFIX);
2490 
2491  FTextStream doxyRulesStream(&doxyRules);
2492  doxyRulesStream <<
2493  prefix << "DOXY_EXEC_PATH = " << pathDoxyExec << "\n" <<
2494  prefix << "DOXYFILE = " << pathDoxyfile << "\n" <<
2495  prefix << "DOXYDOCS_PM = " << pathDoxyDocsPM << "\n" <<
2496  prefix << "DOXYSTRUCTURE_PM = " << pathDoxyStructurePM << "\n" <<
2497  prefix << "DOXYRULES = " << pathDoxyRules << "\n";
2498  if (perlmodLatex)
2499  doxyRulesStream <<
2500  prefix << "DOXYLATEX_PL = " << pathDoxyLatexPL << "\n" <<
2501  prefix << "DOXYLATEXSTRUCTURE_PL = " << pathDoxyLatexStructurePL << "\n" <<
2502  prefix << "DOXYSTRUCTURE_TEX = " << pathDoxyStructureTex << "\n" <<
2503  prefix << "DOXYDOCS_TEX = " << pathDoxyDocsTex << "\n" <<
2504  prefix << "DOXYFORMAT_TEX = " << pathDoxyFormatTex << "\n" <<
2505  prefix << "DOXYLATEX_TEX = " << pathDoxyLatexTex << "\n" <<
2506  prefix << "DOXYLATEX_DVI = " << pathDoxyLatexDVI << "\n" <<
2507  prefix << "DOXYLATEX_PDF = " << pathDoxyLatexPDF << "\n";
2508 
2509  doxyRulesStream <<
2510  "\n"
2511  ".PHONY: clean-perlmod\n"
2512  "clean-perlmod::\n"
2513  "\trm -f $(" << prefix << "DOXYSTRUCTURE_PM) \\\n"
2514  "\t$(" << prefix << "DOXYDOCS_PM)";
2515  if (perlmodLatex)
2516  doxyRulesStream <<
2517  " \\\n"
2518  "\t$(" << prefix << "DOXYLATEX_PL) \\\n"
2519  "\t$(" << prefix << "DOXYLATEXSTRUCTURE_PL) \\\n"
2520  "\t$(" << prefix << "DOXYDOCS_TEX) \\\n"
2521  "\t$(" << prefix << "DOXYSTRUCTURE_TEX) \\\n"
2522  "\t$(" << prefix << "DOXYFORMAT_TEX) \\\n"
2523  "\t$(" << prefix << "DOXYLATEX_TEX) \\\n"
2524  "\t$(" << prefix << "DOXYLATEX_PDF) \\\n"
2525  "\t$(" << prefix << "DOXYLATEX_DVI) \\\n"
2526  "\t$(addprefix $(" << prefix << "DOXYLATEX_TEX:tex=),out aux log)";
2527  doxyRulesStream << "\n\n";
2528 
2529  doxyRulesStream <<
2530  "$(" << prefix << "DOXYRULES) \\\n"
2531  "$(" << prefix << "DOXYMAKEFILE) \\\n"
2532  "$(" << prefix << "DOXYSTRUCTURE_PM) \\\n"
2533  "$(" << prefix << "DOXYDOCS_PM)";
2534  if (perlmodLatex) {
2535  doxyRulesStream <<
2536  " \\\n"
2537  "$(" << prefix << "DOXYLATEX_PL) \\\n"
2538  "$(" << prefix << "DOXYLATEXSTRUCTURE_PL) \\\n"
2539  "$(" << prefix << "DOXYFORMAT_TEX) \\\n"
2540  "$(" << prefix << "DOXYLATEX_TEX)";
2541  }
2542  doxyRulesStream <<
2543  ": \\\n"
2544  "\t$(" << prefix << "DOXYFILE)\n"
2545  "\tcd $(" << prefix << "DOXY_EXEC_PATH) ; doxygen \"$<\"\n";
2546 
2547  if (perlmodLatex) {
2548  doxyRulesStream <<
2549  "\n"
2550  "$(" << prefix << "DOXYDOCS_TEX): \\\n"
2551  "$(" << prefix << "DOXYLATEX_PL) \\\n"
2552  "$(" << prefix << "DOXYDOCS_PM)\n"
2553  "\tperl -I\"$(<D)\" \"$<\" >\"$@\"\n"
2554  "\n"
2555  "$(" << prefix << "DOXYSTRUCTURE_TEX): \\\n"
2556  "$(" << prefix << "DOXYLATEXSTRUCTURE_PL) \\\n"
2557  "$(" << prefix << "DOXYSTRUCTURE_PM)\n"
2558  "\tperl -I\"$(<D)\" \"$<\" >\"$@\"\n"
2559  "\n"
2560  "$(" << prefix << "DOXYLATEX_PDF) \\\n"
2561  "$(" << prefix << "DOXYLATEX_DVI): \\\n"
2562  "$(" << prefix << "DOXYLATEX_TEX) \\\n"
2563  "$(" << prefix << "DOXYFORMAT_TEX) \\\n"
2564  "$(" << prefix << "DOXYSTRUCTURE_TEX) \\\n"
2565  "$(" << prefix << "DOXYDOCS_TEX)\n"
2566  "\n"
2567  "$(" << prefix << "DOXYLATEX_PDF): \\\n"
2568  "$(" << prefix << "DOXYLATEX_TEX)\n"
2569  "\tpdflatex -interaction=nonstopmode \"$<\"\n"
2570  "\n"
2571  "$(" << prefix << "DOXYLATEX_DVI): \\\n"
2572  "$(" << prefix << "DOXYLATEX_TEX)\n"
2573  "\tlatex -interaction=nonstopmode \"$<\"\n";
2574  }
2575 
2576  return true;
2577 }
2578 
2580 {
2581  QFile makefile;
2582  if (!createOutputFile(makefile, pathMakefile))
2583  return false;
2584 
2585  bool perlmodLatex = Config_getBool(PERLMOD_LATEX);
2586  QCString prefix = Config_getString(PERLMOD_MAKEVAR_PREFIX);
2587 
2588  FTextStream makefileStream(&makefile);
2589  makefileStream <<
2590  ".PHONY: default clean" << (perlmodLatex ? " pdf" : "") << "\n"
2591  "default: " << (perlmodLatex ? "pdf" : "clean") << "\n"
2592  "\n"
2593  "include " << pathDoxyRules << "\n"
2594  "\n"
2595  "clean: clean-perlmod\n";
2596 
2597  if (perlmodLatex) {
2598  makefileStream <<
2599  "pdf: $(" << prefix << "DOXYLATEX_PDF)\n"
2600  "dvi: $(" << prefix << "DOXYLATEX_DVI)\n";
2601  }
2602 
2603  return true;
2604 }
2605 
2607 {
2608  QFile doxyLatexStructurePL;
2609  if (!createOutputFile(doxyLatexStructurePL, pathDoxyLatexStructurePL))
2610  return false;
2611 
2612  FTextStream doxyLatexStructurePLStream(&doxyLatexStructurePL);
2613  doxyLatexStructurePLStream <<
2614  "use DoxyStructure;\n"
2615  "\n"
2616  "sub process($) {\n"
2617  "\tmy $node = $_[0];\n"
2618  "\tmy ($type, $name) = @$node[0, 1];\n"
2619  "\tmy $command;\n"
2620  "\tif ($type eq \"string\") { $command = \"String\" }\n"
2621  "\telsif ($type eq \"doc\") { $command = \"Doc\" }\n"
2622  "\telsif ($type eq \"hash\") {\n"
2623  "\t\t$command = \"Hash\";\n"
2624  "\t\tfor my $subnode (values %{$$node[2]}) {\n"
2625  "\t\t\tprocess($subnode);\n"
2626  "\t\t}\n"
2627  "\t}\n"
2628  "\telsif ($type eq \"list\") {\n"
2629  "\t\t$command = \"List\";\n"
2630  "\t\tprocess($$node[2]);\n"
2631  "\t}\n"
2632  "\tprint \"\\\\\" . $command . \"Node{\" . $name . \"}%\\n\";\n"
2633  "}\n"
2634  "\n"
2635  "process($doxystructure);\n";
2636 
2637  return true;
2638 }
2639 
2641 {
2642  QFile doxyLatexPL;
2643  if (!createOutputFile(doxyLatexPL, pathDoxyLatexPL))
2644  return false;
2645 
2646  FTextStream doxyLatexPLStream(&doxyLatexPL);
2647  doxyLatexPLStream <<
2648  "use DoxyStructure;\n"
2649  "use DoxyDocs;\n"
2650  "\n"
2651  "sub latex_quote($) {\n"
2652  "\tmy $text = $_[0];\n"
2653  "\t$text =~ s/\\\\/\\\\textbackslash /g;\n"
2654  "\t$text =~ s/\\|/\\\\textbar /g;\n"
2655  "\t$text =~ s/</\\\\textless /g;\n"
2656  "\t$text =~ s/>/\\\\textgreater /g;\n"
2657  "\t$text =~ s/~/\\\\textasciitilde /g;\n"
2658  "\t$text =~ s/\\^/\\\\textasciicircum /g;\n"
2659  "\t$text =~ s/[\\$&%#_{}]/\\\\$&/g;\n"
2660  "\tprint $text;\n"
2661  "}\n"
2662  "\n"
2663  "sub generate_doc($) {\n"
2664  "\tmy $doc = $_[0];\n"
2665  "\tfor my $item (@$doc) {\n"
2666  "\t\tmy $type = $$item{type};\n"
2667  "\t\tif ($type eq \"text\") {\n"
2668  "\t\t\tlatex_quote($$item{content});\n"
2669  "\t\t} elsif ($type eq \"parbreak\") {\n"
2670  "\t\t\tprint \"\\n\\n\";\n"
2671  "\t\t} elsif ($type eq \"style\") {\n"
2672  "\t\t\tmy $style = $$item{style};\n"
2673  "\t\t\tif ($$item{enable} eq \"yes\") {\n"
2674  "\t\t\t\tif ($style eq \"bold\") { print '\\bfseries'; }\n"
2675  "\t\t\t\tif ($style eq \"italic\") { print '\\itshape'; }\n"
2676  "\t\t\t\tif ($style eq \"code\") { print '\\ttfamily'; }\n"
2677  "\t\t\t} else {\n"
2678  "\t\t\t\tif ($style eq \"bold\") { print '\\mdseries'; }\n"
2679  "\t\t\t\tif ($style eq \"italic\") { print '\\upshape'; }\n"
2680  "\t\t\t\tif ($style eq \"code\") { print '\\rmfamily'; }\n"
2681  "\t\t\t}\n"
2682  "\t\t\tprint '{}';\n"
2683  "\t\t} elsif ($type eq \"symbol\") {\n"
2684  "\t\t\tmy $symbol = $$item{symbol};\n"
2685  "\t\t\tif ($symbol eq \"copyright\") { print '\\copyright'; }\n"
2686  "\t\t\telsif ($symbol eq \"szlig\") { print '\\ss'; }\n"
2687  "\t\t\tprint '{}';\n"
2688  "\t\t} elsif ($type eq \"accent\") {\n"
2689  "\t\t\tmy ($accent) = $$item{accent};\n"
2690  "\t\t\tif ($accent eq \"umlaut\") { print '\\\"'; }\n"
2691  "\t\t\telsif ($accent eq \"acute\") { print '\\\\\\''; }\n"
2692  "\t\t\telsif ($accent eq \"grave\") { print '\\`'; }\n"
2693  "\t\t\telsif ($accent eq \"circ\") { print '\\^'; }\n"
2694  "\t\t\telsif ($accent eq \"tilde\") { print '\\~'; }\n"
2695  "\t\t\telsif ($accent eq \"cedilla\") { print '\\c'; }\n"
2696  "\t\t\telsif ($accent eq \"ring\") { print '\\r'; }\n"
2697  "\t\t\tprint \"{\" . $$item{letter} . \"}\"; \n"
2698  "\t\t} elsif ($type eq \"list\") {\n"
2699  "\t\t\tmy $env = ($$item{style} eq \"ordered\") ? \"enumerate\" : \"itemize\";\n"
2700  "\t\t\tprint \"\\n\\\\begin{\" . $env .\"}\";\n"
2701  "\t\t \tfor my $subitem (@{$$item{content}}) {\n"
2702  "\t\t\t\tprint \"\\n\\\\item \";\n"
2703  "\t\t\t\tgenerate_doc($subitem);\n"
2704  "\t\t \t}\n"
2705  "\t\t\tprint \"\\n\\\\end{\" . $env .\"}\";\n"
2706  "\t\t} elsif ($type eq \"url\") {\n"
2707  "\t\t\tlatex_quote($$item{content});\n"
2708  "\t\t}\n"
2709  "\t}\n"
2710  "}\n"
2711  "\n"
2712  "sub generate($$) {\n"
2713  "\tmy ($item, $node) = @_;\n"
2714  "\tmy ($type, $name) = @$node[0, 1];\n"
2715  "\tif ($type eq \"string\") {\n"
2716  "\t\tprint \"\\\\\" . $name . \"{\";\n"
2717  "\t\tlatex_quote($item);\n"
2718  "\t\tprint \"}\";\n"
2719  "\t} elsif ($type eq \"doc\") {\n"
2720  "\t\tif (@$item) {\n"
2721  "\t\t\tprint \"\\\\\" . $name . \"{\";\n"
2722  "\t\t\tgenerate_doc($item);\n"
2723  "\t\t\tprint \"}%\\n\";\n"
2724  "\t\t} else {\n"
2725  "#\t\t\tprint \"\\\\\" . $name . \"Empty%\\n\";\n"
2726  "\t\t}\n"
2727  "\t} elsif ($type eq \"hash\") {\n"
2728  "\t\tmy ($key, $value);\n"
2729  "\t\twhile (($key, $subnode) = each %{$$node[2]}) {\n"
2730  "\t\t\tmy $subname = $$subnode[1];\n"
2731  "\t\t\tprint \"\\\\Defcs{field\" . $subname . \"}{\";\n"
2732  "\t\t\tif ($$item{$key}) {\n"
2733  "\t\t\t\tgenerate($$item{$key}, $subnode);\n"
2734  "\t\t\t} else {\n"
2735  "#\t\t\t\t\tprint \"\\\\\" . $subname . \"Empty%\\n\";\n"
2736  "\t\t\t}\n"
2737  "\t\t\tprint \"}%\\n\";\n"
2738  "\t\t}\n"
2739  "\t\tprint \"\\\\\" . $name . \"%\\n\";\n"
2740  "\t} elsif ($type eq \"list\") {\n"
2741  "\t\tmy $index = 0;\n"
2742  "\t\tif (@$item) {\n"
2743  "\t\t\tprint \"\\\\\" . $name . \"{%\\n\";\n"
2744  "\t\t\tfor my $subitem (@$item) {\n"
2745  "\t\t\t\tif ($index) {\n"
2746  "\t\t\t\t\tprint \"\\\\\" . $name . \"Sep%\\n\";\n"
2747  "\t\t\t\t}\n"
2748  "\t\t\t\tgenerate($subitem, $$node[2]);\n"
2749  "\t\t\t\t$index++;\n"
2750  "\t\t\t}\n"
2751  "\t\t\tprint \"}%\\n\";\n"
2752  "\t\t} else {\n"
2753  "#\t\t\tprint \"\\\\\" . $name . \"Empty%\\n\";\n"
2754  "\t\t}\n"
2755  "\t}\n"
2756  "}\n"
2757  "\n"
2758  "generate($doxydocs, $doxystructure);\n";
2759 
2760  return true;
2761 }
2762 
2764 {
2765  QFile doxyFormatTex;
2766  if (!createOutputFile(doxyFormatTex, pathDoxyFormatTex))
2767  return false;
2768 
2769  FTextStream doxyFormatTexStream(&doxyFormatTex);
2770  doxyFormatTexStream <<
2771  "\\def\\Defcs#1{\\long\\expandafter\\def\\csname#1\\endcsname}\n"
2772  "\\Defcs{Empty}{}\n"
2773  "\\def\\IfEmpty#1{\\expandafter\\ifx\\csname#1\\endcsname\\Empty}\n"
2774  "\n"
2775  "\\def\\StringNode#1{\\Defcs{#1}##1{##1}}\n"
2776  "\\def\\DocNode#1{\\Defcs{#1}##1{##1}}\n"
2777  "\\def\\ListNode#1{\\Defcs{#1}##1{##1}\\Defcs{#1Sep}{}}\n"
2778  "\\def\\HashNode#1{\\Defcs{#1}{}}\n"
2779  "\n"
2780  "\\input{" << pathDoxyStructureTex << "}\n"
2781  "\n"
2782  "\\newbox\\BoxA\n"
2783  "\\dimendef\\DimenA=151\\relax\n"
2784  "\\dimendef\\DimenB=152\\relax\n"
2785  "\\countdef\\ZoneDepth=151\\relax\n"
2786  "\n"
2787  "\\def\\Cs#1{\\csname#1\\endcsname}\n"
2788  "\\def\\Letcs#1{\\expandafter\\let\\csname#1\\endcsname}\n"
2789  "\\def\\Heading#1{\\vskip 4mm\\relax\\textbf{#1}}\n"
2790  "\\def\\See#1{\\begin{flushleft}\\Heading{See also: }#1\\end{flushleft}}\n"
2791  "\n"
2792  "\\def\\Frame#1{\\vskip 3mm\\relax\\fbox{ \\vbox{\\hsize0.95\\hsize\\vskip 1mm\\relax\n"
2793  "\\raggedright#1\\vskip 0.5mm\\relax} }}\n"
2794  "\n"
2795  "\\def\\Zone#1#2#3{%\n"
2796  "\\Defcs{Test#1}{#2}%\n"
2797  "\\Defcs{Emit#1}{#3}%\n"
2798  "\\Defcs{#1}{%\n"
2799  "\\advance\\ZoneDepth1\\relax\n"
2800  "\\Letcs{Mode\\number\\ZoneDepth}0\\relax\n"
2801  "\\Letcs{Present\\number\\ZoneDepth}0\\relax\n"
2802  "\\Cs{Test#1}\n"
2803  "\\expandafter\\if\\Cs{Present\\number\\ZoneDepth}1%\n"
2804  "\\advance\\ZoneDepth-1\\relax\n"
2805  "\\Letcs{Present\\number\\ZoneDepth}1\\relax\n"
2806  "\\expandafter\\if\\Cs{Mode\\number\\ZoneDepth}1%\n"
2807  "\\advance\\ZoneDepth1\\relax\n"
2808  "\\Letcs{Mode\\number\\ZoneDepth}1\\relax\n"
2809  "\\Cs{Emit#1}\n"
2810  "\\advance\\ZoneDepth-1\\relax\\fi\n"
2811  "\\advance\\ZoneDepth1\\relax\\fi\n"
2812  "\\advance\\ZoneDepth-1\\relax}}\n"
2813  "\n"
2814  "\\def\\Member#1#2{%\n"
2815  "\\Defcs{Test#1}{\\Cs{field#1Detailed}\n"
2816  "\\IfEmpty{field#1DetailedDoc}\\else\\Letcs{Present#1}1\\fi}\n"
2817  "\\Defcs{#1}{\\Letcs{Present#1}0\\relax\n"
2818  "\\Cs{Test#1}\\if1\\Cs{Present#1}\\Letcs{Present\\number\\ZoneDepth}1\\relax\n"
2819  "\\if1\\Cs{Mode\\number\\ZoneDepth}#2\\fi\\fi}}\n"
2820  "\n"
2821  "\\def\\TypedefMemberList#1#2{%\n"
2822  "\\Defcs{#1DetailedDoc}##1{\\vskip 5.5mm\\relax##1}%\n"
2823  "\\Defcs{#1Name}##1{\\textbf{##1}}%\n"
2824  "\\Defcs{#1See}##1{\\See{##1}}%\n"
2825  "%\n"
2826  "\\Zone{#1s}{\\Cs{field#1List}}{\\subsubsection{#2}\\Cs{field#1List}}%\n"
2827  "\\Member{#1}{\\Frame{typedef \\Cs{field#1Type} \\Cs{field#1Name}}%\n"
2828  "\\Cs{field#1DetailedDoc}\\Cs{field#1See}\\vskip 5mm\\relax}}%\n"
2829  "\n"
2830  "\\def\\VariableMemberList#1#2{%\n"
2831  "\\Defcs{#1DetailedDoc}##1{\\vskip 5.5mm\\relax##1}%\n"
2832  "\\Defcs{#1Name}##1{\\textbf{##1}}%\n"
2833  "\\Defcs{#1See}##1{\\See{##1}}%\n"
2834  "%\n"
2835  "\\Zone{#1s}{\\Cs{field#1List}}{\\subsubsection{#2}\\Cs{field#1List}}%\n"
2836  "\\Member{#1}{\\Frame{\\Cs{field#1Type}{} \\Cs{field#1Name}}%\n"
2837  "\\Cs{field#1DetailedDoc}\\Cs{field#1See}\\vskip 5mm\\relax}}%\n"
2838  "\n"
2839  "\\def\\FunctionMemberList#1#2{%\n"
2840  "\\Defcs{#1PDParamName}##1{\\textit{##1}}%\n"
2841  "\\Defcs{#1PDParam}{\\Cs{field#1PDParamName}}%\n"
2842  "\\Defcs{#1PDParamsSep}{, }%\n"
2843  "\\Defcs{#1PDBlocksSep}{\\vskip 2mm\\relax}%\n"
2844  "%\n"
2845  "\\Defcs{#1PDBlocks}##1{%\n"
2846  "\\Heading{Parameters:}\\vskip 1.5mm\\relax\n"
2847  "\\DimenA0pt\\relax\n"
2848  "\\Defcs{#1PDBlock}{\\setbox\\BoxA\\hbox{\\Cs{field#1PDParams}}%\n"
2849  "\\ifdim\\DimenA<\\wd\\BoxA\\DimenA\\wd\\BoxA\\fi}%\n"
2850  "##1%\n"
2851  "\\advance\\DimenA3mm\\relax\n"
2852  "\\DimenB\\hsize\\advance\\DimenB-\\DimenA\\relax\n"
2853  "\\Defcs{#1PDBlock}{\\hbox to\\hsize{\\vtop{\\hsize\\DimenA\\relax\n"
2854  "\\Cs{field#1PDParams}}\\hfill\n"
2855  "\\vtop{\\hsize\\DimenB\\relax\\Cs{field#1PDDoc}}}}%\n"
2856  "##1}\n"
2857  "\n"
2858  "\\Defcs{#1ParamName}##1{\\textit{##1}}\n"
2859  "\\Defcs{#1Param}{\\Cs{field#1ParamType}{} \\Cs{field#1ParamName}}\n"
2860  "\\Defcs{#1ParamsSep}{, }\n"
2861  "\n"
2862  "\\Defcs{#1Name}##1{\\textbf{##1}}\n"
2863  "\\Defcs{#1See}##1{\\See{##1}}\n"
2864  "\\Defcs{#1Return}##1{\\Heading{Returns: }##1}\n"
2865  "\\Defcs{field#1Title}{\\Frame{\\Cs{field#1Type}{} \\Cs{field#1Name}(\\Cs{field#1Params})}}%\n"
2866  "%\n"
2867  "\\Zone{#1s}{\\Cs{field#1List}}{\\subsubsection{#2}\\Cs{field#1List}}%\n"
2868  "\\Member{#1}{%\n"
2869  "\\Cs{field#1Title}\\vskip 6mm\\relax\\Cs{field#1DetailedDoc}\n"
2870  "\\Cs{field#1Return}\\Cs{field#1PDBlocks}\\Cs{field#1See}\\vskip 5mm\\relax}}\n"
2871  "\n"
2872  "\\def\\FileDetailed{\\fieldFileDetailedDoc\\par}\n"
2873  "\\def\\ClassDetailed{\\fieldClassDetailedDoc\\par}\n"
2874  "\n"
2875  "\\def\\FileSubzones{\\fieldFileTypedefs\\fieldFileVariables\\fieldFileFunctions}\n"
2876  "\n"
2877  "\\def\\ClassSubzones{%\n"
2878  "\\fieldClassPublicTypedefs\\fieldClassPublicMembers\\fieldClassPublicMethods\n"
2879  "\\fieldClassProtectedTypedefs\\fieldClassProtectedMembers\\fieldClassProtectedMethods\n"
2880  "\\fieldClassPrivateTypedefs\\fieldClassPrivateMembers\\fieldClassPrivateMethods}\n"
2881  "\n"
2882  "\\Member{Page}{\\subsection{\\fieldPageName}\\fieldPageDetailedDoc}\n"
2883  "\n"
2884  "\\TypedefMemberList{FileTypedef}{Typedefs}\n"
2885  "\\VariableMemberList{FileVariable}{Variables}\n"
2886  "\\FunctionMemberList{FileFunction}{Functions}\n"
2887  "\\Zone{File}{\\FileSubzones}{\\subsection{\\fieldFileName}\\fieldFileDetailed\\FileSubzones}\n"
2888  "\n"
2889  "\\TypedefMemberList{ClassPublicTypedef}{Public Typedefs}\n"
2890  "\\TypedefMemberList{ClassProtectedTypedef}{Protected Typedefs}\n"
2891  "\\TypedefMemberList{ClassPrivateTypedef}{Private Typedefs}\n"
2892  "\\VariableMemberList{ClassPublicMember}{Public Members}\n"
2893  "\\VariableMemberList{ClassProtectedMember}{Protected Members}\n"
2894  "\\VariableMemberList{ClassPrivateMember}{Private Members}\n"
2895  "\\FunctionMemberList{ClassPublicMethod}{Public Methods}\n"
2896  "\\FunctionMemberList{ClassProtectedMethod}{Protected Methods}\n"
2897  "\\FunctionMemberList{ClassPrivateMethod}{Private Methods}\n"
2898  "\\Zone{Class}{\\ClassSubzones}{\\subsection{\\fieldClassName}\\fieldClassDetailed\\ClassSubzones}\n"
2899  "\n"
2900  "\\Zone{AllPages}{\\fieldPages}{\\section{Pages}\\fieldPages}\n"
2901  "\\Zone{AllFiles}{\\fieldFiles}{\\section{Files}\\fieldFiles}\n"
2902  "\\Zone{AllClasses}{\\fieldClasses}{\\section{Classes}\\fieldClasses}\n"
2903  "\n"
2904  "\\newlength{\\oldparskip}\n"
2905  "\\newlength{\\oldparindent}\n"
2906  "\\newlength{\\oldfboxrule}\n"
2907  "\n"
2908  "\\ZoneDepth0\\relax\n"
2909  "\\Letcs{Mode0}1\\relax\n"
2910  "\n"
2911  "\\def\\EmitDoxyDocs{%\n"
2912  "\\setlength{\\oldparskip}{\\parskip}\n"
2913  "\\setlength{\\oldparindent}{\\parindent}\n"
2914  "\\setlength{\\oldfboxrule}{\\fboxrule}\n"
2915  "\\setlength{\\parskip}{0cm}\n"
2916  "\\setlength{\\parindent}{0cm}\n"
2917  "\\setlength{\\fboxrule}{1pt}\n"
2918  "\\AllPages\\AllFiles\\AllClasses\n"
2919  "\\setlength{\\parskip}{\\oldparskip}\n"
2920  "\\setlength{\\parindent}{\\oldparindent}\n"
2921  "\\setlength{\\fboxrule}{\\oldfboxrule}}\n";
2922 
2923  return true;
2924 }
2925 
2927 {
2928  QFile doxyLatexTex;
2929  if (!createOutputFile(doxyLatexTex, pathDoxyLatexTex))
2930  return false;
2931 
2932  FTextStream doxyLatexTexStream(&doxyLatexTex);
2933  doxyLatexTexStream <<
2934  "\\documentclass[a4paper,12pt]{article}\n"
2935  "\\usepackage[latin1]{inputenc}\n"
2936  "\\usepackage[none]{hyphenat}\n"
2937  "\\usepackage[T1]{fontenc}\n"
2938  "\\usepackage{hyperref}\n"
2939  "\\usepackage{times}\n"
2940  "\n"
2941  "\\input{doxyformat}\n"
2942  "\n"
2943  "\\begin{document}\n"
2944  "\\input{" << pathDoxyDocsTex << "}\n"
2945  "\\sloppy\n"
2946  "\\EmitDoxyDocs\n"
2947  "\\end{document}\n";
2948 
2949  return true;
2950 }
2951 
2953 {
2954  // + classes
2955  // + namespaces
2956  // + files
2957  // - packages
2958  // + groups
2959  // + related pages
2960  // - examples
2961 
2962  QDir perlModDir;
2963  if (!createOutputDir(perlModDir))
2964  return;
2965 
2966  bool perlmodLatex = Config_getBool(PERLMOD_LATEX);
2967 
2968  QCString perlModAbsPath = perlModDir.absPath().utf8();
2969  pathDoxyDocsPM = perlModAbsPath + "/DoxyDocs.pm";
2970  pathDoxyStructurePM = perlModAbsPath + "/DoxyStructure.pm";
2971  pathMakefile = perlModAbsPath + "/Makefile";
2972  pathDoxyRules = perlModAbsPath + "/doxyrules.make";
2973 
2974  if (perlmodLatex) {
2975  pathDoxyStructureTex = perlModAbsPath + "/doxystructure.tex";
2976  pathDoxyFormatTex = perlModAbsPath + "/doxyformat.tex";
2977  pathDoxyLatexTex = perlModAbsPath + "/doxylatex.tex";
2978  pathDoxyLatexDVI = perlModAbsPath + "/doxylatex.dvi";
2979  pathDoxyLatexPDF = perlModAbsPath + "/doxylatex.pdf";
2980  pathDoxyDocsTex = perlModAbsPath + "/doxydocs.tex";
2981  pathDoxyLatexPL = perlModAbsPath + "/doxylatex.pl";
2982  pathDoxyLatexStructurePL = perlModAbsPath + "/doxylatex-structure.pl";
2983  }
2984 
2985  if (!(generatePerlModOutput()
2987  && generateMakefile()
2988  && generateDoxyRules()))
2989  return;
2990 
2991  if (perlmodLatex) {
2993  && generateDoxyLatexPL()
2995  && generateDoxyFormatTex()))
2996  return;
2997  }
2998 }
2999 
3001 {
3002  PerlModGenerator pmg(Config_getBool(PERLMOD_PRETTY));
3003  pmg.generate();
3004 }
3005 
3006 // Local Variables:
3007 // c-basic-offset: 2
3008 // End:
3009 
3010 /* This elisp function for XEmacs makes Control-Z transform
3011  the text in the region into a valid C string.
3012 
3013  (global-set-key '(control z) (lambda () (interactive)
3014  (save-excursion
3015  (if (< (mark) (point)) (exchange-point-and-mark))
3016  (let ((start (point)) (replacers
3017  '(("\\\\" "\\\\\\\\")
3018  ("\"" "\\\\\"")
3019  ("\t" "\\\\t")
3020  ("^.*$" "\"\\&\\\\n\""))))
3021  (while replacers
3022  (while (re-search-forward (caar replacers) (mark) t)
3023  (replace-match (cadar replacers) t))
3024  (goto-char start)
3025  (setq replacers (cdr replacers)))))))
3026 */