Doxygen
Loading...
Searching...
No Matches
perlmodgen.cpp
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * Copyright (C) 1997-2022 by Dimitri van Heesch.
4 * Authors: Dimitri van Heesch, Miguel Lobo.
5 *
6 * Permission to use, copy, modify, and distribute this software and its
7 * documentation under the terms of the GNU General Public License is hereby
8 * granted. No representations are made about the suitability of this software
9 * for any purpose. It is provided "as is" without express or implied warranty.
10 * See the GNU General Public License for more details.
11 *
12 * Documents produced by Doxygen are derivative works derived from the
13 * input used in their production; they are not affected by this license.
14 *
15 */
16
17// own header
18#include "perlmodgen.h"
19
20// standard includes
21#include <iostream>
22#include <variant>
23
24// other includes
25#include "arguments.h"
26#include "classdef.h"
27#include "classlist.h"
28#include "conceptdef.h"
29#include "config.h"
30#include "construct.h"
31#include "dir.h"
32#include "docnode.h"
33#include "docparser.h"
34#include "docvisitor.h"
35#include "doxygen.h"
36#include "emoji.h"
37#include "filename.h"
38#include "groupdef.h"
39#include "htmlentity.h"
40#include "membergroup.h"
41#include "memberlist.h"
42#include "membername.h"
43#include "message.h"
44#include "moduledef.h"
45#include "namespacedef.h"
46#include "pagedef.h"
47#include "portable.h"
48#include "util.h"
49
50#define PERLOUTPUT_MAX_INDENTATION 40
51
53{
54 public:
55 std::ostream *m_t = nullptr;
56
57 PerlModOutputStream(std::ostream &t) : m_t(&t) { }
58
59 void add(char c);
60 void add(const DString &s);
61 void add(int n);
62 void add(unsigned int n);
63};
64
66{
67 *m_t << c;
68}
69
71{
72 *m_t << s;
73}
74
76{
77 *m_t << n;
78}
79
80void PerlModOutputStream::add(unsigned int n)
81{
82 *m_t << n;
83}
84
86{
87public:
88
90
91 inline PerlModOutput(bool pretty)
92 : m_pretty(pretty), m_stream(nullptr), m_indentation(false), m_blockstart(true)
93 {
94 m_spaces[0] = 0;
95 }
96
97 virtual ~PerlModOutput() { reset(); }
99
100 void reset() { m_stream=nullptr; }
101
103
104 //inline PerlModOutput &openSave() { iopenSave(); return *this; }
105 //inline PerlModOutput &closeSave(DString &s) { icloseSave(s); return *this; }
106
108 {
109 if (m_blockstart)
110 m_blockstart = false;
111 else
112 m_stream->add(',');
113 indent();
114 return *this;
115 }
116
117 inline PerlModOutput &add(char c) { m_stream->add(c); return *this; }
118 inline PerlModOutput &add(const DString &s) { m_stream->add(s); return *this; }
119 inline PerlModOutput &add(DString &s) { m_stream->add(s); return *this; }
120 inline PerlModOutput &add(int n) { m_stream->add(n); return *this; }
121 inline PerlModOutput &add(unsigned int n) { m_stream->add(n); return *this; }
122
123 PerlModOutput &addQuoted(const DString &s) { iaddQuoted(s); return *this; }
124
126 {
127 if (m_pretty) {
128 m_stream->add('\n');
130 }
131 return *this;
132 }
133
134 inline PerlModOutput &open(char c, const DString &s = DString()) { iopen(c, s); return *this; }
135 inline PerlModOutput &close(char c = 0) { iclose(c); return *this; }
136
137 inline PerlModOutput &addField(const DString &s) { iaddField(s); return *this; }
138 inline PerlModOutput &addFieldQuotedChar(const DString &field, char content)
139 {
140 iaddFieldQuotedChar(field, content); return *this;
141 }
142 inline PerlModOutput &addFieldQuotedString(const DString &field, const DString &content)
143 {
144 iaddFieldQuotedString(field, content); return *this;
145 }
146 inline PerlModOutput &addFieldBoolean(const DString &field, bool content)
147 {
148 return addFieldQuotedString(field, content ? "yes" : "no");
149 }
150 inline PerlModOutput &openList(const DString &s = DString()) { open('[', s); return *this; }
151 inline PerlModOutput &closeList() { close(']'); return *this; }
152 inline PerlModOutput &openHash(const DString &s = DString() ) { open('{', s); return *this; }
153 inline PerlModOutput &closeHash() { close('}'); return *this; }
154
155protected:
156
157 //void iopenSave();
158 //void icloseSave(DString &);
159
160 void incIndent();
161 void decIndent();
162
163 void iaddQuoted(const DString &);
164 void iaddFieldQuotedChar(const DString &, char);
165 void iaddFieldQuotedString(const DString &, const DString &);
166 void iaddField(const DString &);
167
168 void iopen(char, const DString &);
169 void iclose(char);
170
171private:
172
176
178};
179
180//void PerlModOutput::iopenSave()
181//{
182// m_saved.push(m_stream);
183// m_stream = new PerlModOutputStream();
184//}
185
186//void PerlModOutput::icloseSave(DString &s)
187//{
188// s = m_stream->m_s;
189// delete m_stream;
190// m_stream = m_saved.top();
191// m_saved.pop();
192//}
193
195{
197 {
198 char *s = &m_spaces[m_indentation * 2];
199 *s++ = ' '; *s++ = ' '; *s = 0;
200 }
202}
203
210
212{
213 if (str.empty()) return;
214 const char *s = str.data();
215 char c = 0;
216 while ((c = *s++) != 0)
217 {
218 if ((c == '\'') || (c == '\\'))
219 {
220 m_stream->add('\\');
221 }
222 m_stream->add(c);
223 }
224}
225
227{
229 m_stream->add(s);
230 m_stream->add(m_pretty ? " => " : "=>");
231}
232
233void PerlModOutput::iaddFieldQuotedChar(const DString &field, char content)
234{
235 iaddField(field);
236 m_stream->add('\'');
237 if ((content == '\'') || (content == '\\'))
238 m_stream->add('\\');
239 m_stream->add(content);
240 m_stream->add('\'');
241}
242
243void PerlModOutput::iaddFieldQuotedString(const DString &field, const DString &content)
244{
245 if (content == nullptr)
246 return;
247 iaddField(field);
248 m_stream->add('\'');
249 iaddQuoted(content);
250 m_stream->add('\'');
251}
252
253void PerlModOutput::iopen(char c, const DString &s)
254{
255 if (s != nullptr)
256 iaddField(s);
257 else
259 m_stream->add(c);
260 incIndent();
261 m_blockstart = true;
262}
263
265{
266 decIndent();
267 indent();
268 if (c != 0)
269 m_stream->add(c);
270 m_blockstart = false;
271}
272
273/*! @brief Concrete visitor implementation for PerlMod output. */
274class PerlModDocVisitor final : public DocVisitor
275{
276 public:
278
279 void finish();
280
281 //--------------------------------------
282 // visitor functions for leaf nodes
283 //--------------------------------------
284
285 void operator()(const DocWord &);
286 void operator()(const DocLinkedWord &);
287 void operator()(const DocWhiteSpace &);
288 void operator()(const DocSymbol &);
289 void operator()(const DocEmoji &);
290 void operator()(const DocURL &);
291 void operator()(const DocLineBreak &);
292 void operator()(const DocHorRuler &);
293 void operator()(const DocStyleChange &);
294 void operator()(const DocVerbatim &);
295 void operator()(const DocAnchor &);
296 void operator()(const DocInclude &);
297 void operator()(const DocIncOperator &);
298 void operator()(const DocFormula &);
299 void operator()(const DocIndexEntry &);
300 void operator()(const DocSimpleSectSep &);
301 void operator()(const DocCite &);
302 void operator()(const DocSeparator &);
303
304 //--------------------------------------
305 // visitor functions for compound nodes
306 //--------------------------------------
307
308 void operator()(const DocAutoList &);
309 void operator()(const DocAutoListItem &);
310 void operator()(const DocPara &) ;
311 void operator()(const DocRoot &);
312 void operator()(const DocSimpleSect &);
313 void operator()(const DocTitle &);
314 void operator()(const DocSimpleList &);
315 void operator()(const DocSimpleListItem &);
316 void operator()(const DocSection &);
317 void operator()(const DocHtmlList &);
318 void operator()(const DocHtmlListItem &);
319 void operator()(const DocHtmlDescList &);
320 void operator()(const DocHtmlDescTitle &);
321 void operator()(const DocHtmlDescData &);
322 void operator()(const DocHtmlTable &);
323 void operator()(const DocHtmlRow &);
324 void operator()(const DocHtmlCell &);
325 void operator()(const DocHtmlCaption &);
326 void operator()(const DocInternal &);
327 void operator()(const DocHRef &);
328 void operator()(const DocHtmlSummary &);
329 void operator()(const DocHtmlDetails &);
330 void operator()(const DocHtmlHeader &);
331 void operator()(const DocImage &);
332 void operator()(const DocDotFile &);
333 void operator()(const DocMscFile &);
334 void operator()(const DocDiaFile &);
335 void operator()(const DocPlantUmlFile &);
336 void operator()(const DocMermaidFile &);
337 void operator()(const DocLink &);
338 void operator()(const DocRef &);
339 void operator()(const DocSecRefItem &);
340 void operator()(const DocSecRefList &);
341 void operator()(const DocParamSect &);
342 void operator()(const DocParamList &);
343 void operator()(const DocXRefItem &);
344 void operator()(const DocInternalRef &);
345 void operator()(const DocText &);
346 void operator()(const DocHtmlBlockQuote &);
347 void operator()(const DocVhdlFlow &);
348 void operator()(const DocParBlock &);
349
350 private:
351 template<class T>
352 void visitChildren(const T &t)
353 {
354 for (const auto &child : t.children())
355 {
356 std::visit(*this, child);
357 }
358 }
359
360 //--------------------------------------
361 // helper functions
362 //--------------------------------------
363
364 void addLink(const DString &ref, const DString &file,
365 const DString &anchor);
366
367 void enterText();
368 void leaveText();
369
370 void openItem(const DString &);
371 void closeItem();
372 void singleItem(const DString &);
373 void openSubBlock(const DString & = DString());
374 void closeSubBlock();
375
376 //--------------------------------------
377 // state variables
378 //--------------------------------------
379
384};
385
391
398
399void PerlModDocVisitor::addLink(const DString &,const DString &file,const DString &anchor)
400{
401 DString link = file;
402 if (!anchor.empty())
403 (link += "_1") += anchor;
404 m_output.addFieldQuotedString("link", link);
405}
406
408{
409 leaveText();
410 m_output.openHash().addFieldQuotedString("type", name);
411}
412
418
420{
421 if (m_textmode)
422 return;
423 openItem("text");
424 m_output.addField("content").add('\'');
425 m_textmode = true;
426}
427
429{
430 if (!m_textmode)
431 return;
432 m_textmode = false;
434 .add('\'')
435 .closeHash();
436}
437
439{
440 openItem(name);
441 closeItem();
442}
443
445{
446 leaveText();
448 m_textblockstart = true;
449}
450
456
457//void PerlModDocVisitor::openOther()
458//{
459 // Using a secondary text stream will corrupt the perl file. Instead of
460 // printing doc => [ data => [] ], it will print doc => [] data => [].
461 /*
462 leaveText();
463 m_output.openSave();
464 */
465//}
466
467//void PerlModDocVisitor::closeOther()
468//{
469 // Using a secondary text stream will corrupt the perl file. Instead of
470 // printing doc => [ data => [] ], it will print doc => [] data => [].
471 /*
472 DString other;
473 leaveText();
474 m_output.closeSave(other);
475 m_other += other;
476 */
477//}
478
480{
481 enterText();
483}
484
486{
487 openItem("url");
488 addLink(w.ref(), w.file(), w.anchor());
489 m_output.addFieldQuotedString("content", w.word());
490 closeItem();
491}
492
494{
495 enterText();
496 m_output.add(' ');
497}
498
500{
502 const char *accent=nullptr;
503 if (res->symb)
504 {
505 switch (res->type)
506 {
508 enterText();
509 m_output.add(res->symb);
510 break;
512 enterText();
513 m_output.add(res->symb[0]);
514 break;
516 leaveText();
517 openItem("symbol");
518 m_output.addFieldQuotedString("symbol", res->symb);
519 closeItem();
520 break;
521 default:
522 switch(res->type)
523 {
525 accent = "umlaut";
526 break;
528 accent = "acute";
529 break;
531 accent = "grave";
532 break;
534 accent = "circ";
535 break;
537 accent = "slash";
538 break;
540 accent = "tilde";
541 break;
543 accent = "cedilla";
544 break;
546 accent = "ring";
547 break;
548 default:
549 break;
550 }
551 leaveText();
552 if (accent)
553 {
554 openItem("accent");
556 .addFieldQuotedString("accent", accent)
557 .addFieldQuotedChar("letter", res->symb[0]);
558 closeItem();
559 }
560 break;
561 }
562 }
563 else
564 {
565 err("perl: non supported HTML-entity found: {}\n",HtmlEntityMapper::instance().html(sy.symbol(),true));
566 }
567}
568
570{
571 enterText();
572 const char *name = EmojiEntityMapper::instance().name(sy.index());
573 if (name)
574 {
575 m_output.add(name);
576 }
577 else
578 {
579 m_output.add(sy.name());
580 }
581}
582
584{
585 openItem("url");
586 m_output.addFieldQuotedString("content", u.url());
587 closeItem();
588}
589
591{
592 singleItem("linebreak");
593}
594
596{
597 singleItem("hruler");
598}
599
601{
602 const char *style = nullptr;
603 switch (s.style())
604 {
605 case DocStyleChange::Bold: style = "bold"; break;
606 case DocStyleChange::S: style = "s"; break;
607 case DocStyleChange::Strike: style = "strike"; break;
608 case DocStyleChange::Del: style = "del"; break;
609 case DocStyleChange::Underline: style = "underline"; break;
610 case DocStyleChange::Ins: style = "ins"; break;
611 case DocStyleChange::Italic: style = "italic"; break;
612 case DocStyleChange::Code: style = "code"; break;
613 case DocStyleChange::Subscript: style = "subscript"; break;
614 case DocStyleChange::Superscript: style = "superscript"; break;
615 case DocStyleChange::Center: style = "center"; break;
616 case DocStyleChange::Small: style = "small"; break;
617 case DocStyleChange::Cite: style = "cite"; break;
618 case DocStyleChange::Preformatted: style = "preformatted"; break;
619 case DocStyleChange::Div: style = "div"; break;
620 case DocStyleChange::Span: style = "span"; break;
621 case DocStyleChange::Kbd: style = "kbd"; break;
622 case DocStyleChange::Typewriter: style = "typewriter"; break;
623 }
624 openItem("style");
625 m_output.addFieldQuotedString("style", style)
626 .addFieldBoolean("enable", s.enable());
627 closeItem();
628}
629
631{
632 const char *type = nullptr;
633 switch (s.type())
634 {
636#if 0
637 m_output.add("<programlisting>");
638 parseCode(m_ci,s->context(),s->text(),false,0);
639 m_output.add("</programlisting>");
640 return;
641#endif
644 case DocVerbatim::Verbatim: type = "preformatted"; break;
645 case DocVerbatim::HtmlOnly: type = "htmlonly"; break;
646 case DocVerbatim::RtfOnly: type = "rtfonly"; break;
647 case DocVerbatim::ManOnly: type = "manonly"; break;
648 case DocVerbatim::LatexOnly: type = "latexonly"; break;
649 case DocVerbatim::XmlOnly: type = "xmlonly"; break;
650 case DocVerbatim::DocbookOnly: type = "docbookonly"; break;
651 case DocVerbatim::Dot: type = "dot"; break;
652 case DocVerbatim::Msc: type = "msc"; break;
653 case DocVerbatim::PlantUML: type = "plantuml"; break;
654 case DocVerbatim::Mermaid: type = "mermaid"; break;
655 }
656 openItem(type);
657 if (s.hasCaption())
658 {
659 openSubBlock("caption");
660 visitChildren(s);
662 }
663 m_output.addFieldQuotedString("content", s.text());
664 closeItem();
665}
666
668{
669 DString anchor = anc.file() + "_1" + anc.anchor();
670 openItem("anchor");
671 m_output.addFieldQuotedString("id", anchor);
672 closeItem();
673}
674
676{
677 const char *type = nullptr;
678 switch (inc.type())
679 {
681 return;
683 return;
684 case DocInclude::DontInclude: return;
685 case DocInclude::DontIncWithLines: return;
686 case DocInclude::HtmlInclude: type = "htmlonly"; break;
687 case DocInclude::LatexInclude: type = "latexonly"; break;
688 case DocInclude::RtfInclude: type = "rtfonly"; break;
689 case DocInclude::ManInclude: type = "manonly"; break;
690 case DocInclude::XmlInclude: type = "xmlonly"; break;
691 case DocInclude::DocbookInclude: type = "docbookonly"; break;
692 case DocInclude::VerbInclude: type = "preformatted"; break;
693 case DocInclude::Snippet: return;
694 case DocInclude::SnippetWithLines: return;
695 }
696 openItem(type);
697 m_output.addFieldQuotedString("content", inc.text());
698 closeItem();
699}
700
702{
703#if 0
704 //printf("DocIncOperator: type=%d first=%d, last=%d text='%s'\n",
705 // op.type(),op.isFirst(),op.isLast(),op.text().data());
706 if (op.isFirst())
707 {
708 m_output.add("<programlisting>");
709 }
710 if (op.type()!=DocIncOperator::Skip)
711 {
712 parseCode(m_ci,op.context(),op.text(),false,0);
713 }
714 if (op.isLast())
715 {
716 m_output.add("</programlisting>");
717 }
718 else
719 {
720 m_output.add('\n');
721 }
722#endif
723}
724
726{
727 openItem("formula");
728 DString id;
729 id += DString().setNum(f.id());
730 m_output.addFieldQuotedString("id", id).addFieldQuotedString("content", f.text());
731 closeItem();
732}
733
735{
736#if 0
737 m_output.add("<indexentry>"
738 "<primaryie>");
739 m_output.addQuoted(ie->entry());
740 m_output.add("</primaryie>"
741 "<secondaryie></secondaryie>"
742 "</indexentry>");
743#endif
744}
745
749
751{
752 openItem("cite");
753 auto opt = cite.option();
754 DString txt;
755 if (!cite.file().empty())
756 {
757 txt = cite.getText();
758 }
759 else
760 {
761 if (!opt.noPar()) txt += "[";
762 txt += cite.target();
763 if (!opt.noPar()) txt += "]";
764 }
765 m_output.addFieldQuotedString("text", txt);
766 closeItem();
767}
768
769
770//--------------------------------------
771// visitor functions for compound nodes
772//--------------------------------------
773
775{
776 openItem("list");
777 m_output.addFieldQuotedString("style", l.isEnumList() ? "ordered" : (l.isCheckedList() ? "check" :"itemized"));
778 openSubBlock("content");
779 visitChildren(l);
781 closeItem();
782}
783
785{
786 openSubBlock();
787 switch (li.itemNumber())
788 {
789 case DocAutoList::Unchecked: // unchecked
790 m_output.addFieldQuotedString("style", "Unchecked");
791 break;
792 case DocAutoList::Checked_x: // checked with x
793 case DocAutoList::Checked_X: // checked with X
794 m_output.addFieldQuotedString("style", "Checked");
795 break;
796 default:
797 break;
798 }
799 visitChildren(li);
801}
802
804{
806 m_textblockstart = false;
807 else
808 singleItem("parbreak");
809 /*
810 openItem("para");
811 openSubBlock("content");
812 */
813 visitChildren(p);
814 /*
815 closeSubBlock();
816 closeItem();
817 */
818}
819
821{
822 visitChildren(r);
823}
824
826{
827 const char *type = nullptr;
828 switch (s.type())
829 {
830 case DocSimpleSect::See: type = "see"; break;
831 case DocSimpleSect::Return: type = "return"; break;
832 case DocSimpleSect::Author: type = "author"; break;
833 case DocSimpleSect::Authors: type = "authors"; break;
834 case DocSimpleSect::Version: type = "version"; break;
835 case DocSimpleSect::Since: type = "since"; break;
836 case DocSimpleSect::Date: type = "date"; break;
837 case DocSimpleSect::Note: type = "note"; break;
838 case DocSimpleSect::Warning: type = "warning"; break;
839 case DocSimpleSect::Pre: type = "pre"; break;
840 case DocSimpleSect::Post: type = "post"; break;
841 case DocSimpleSect::Copyright: type = "copyright"; break;
842 case DocSimpleSect::Invar: type = "invariant"; break;
843 case DocSimpleSect::Remark: type = "remark"; break;
844 case DocSimpleSect::Attention: type = "attention"; break;
845 case DocSimpleSect::Important: type = "important"; break;
846 case DocSimpleSect::User: type = "par"; break;
847 case DocSimpleSect::Rcs: type = "rcs"; break;
849 err("unknown simple section found\n");
850 break;
851 }
852 leaveText();
854 //openOther();
855 openSubBlock(type);
856 if (s.title())
857 {
858 std::visit(*this,*s.title());
859 }
860 visitChildren(s);
862 //closeOther();
864}
865
867{
868 openItem("title");
869 openSubBlock("content");
870 visitChildren(t);
872 closeItem();
873}
874
876{
877 openItem("list");
878 m_output.addFieldQuotedString("style", "itemized");
879 openSubBlock("content");
880 visitChildren(l);
882 closeItem();
883}
884
886{
887 openSubBlock();
888 if (li.paragraph())
889 {
890 std::visit(*this,*li.paragraph());
891 }
893}
894
896{
897 DString sect = DString().sprintf("sect%d",s.level());
898 openItem(sect);
899 //m_output.addFieldQuotedString("title", s.title());
900 if (s.title())
901 {
902 std::visit(*this,*s.title());
903 }
904 openSubBlock("content");
905 visitChildren(s);
907 closeItem();
908}
909
911{
912 openItem("list");
913 m_output.addFieldQuotedString("style", (l.type() == DocHtmlList::Ordered) ? "ordered" : "itemized");
914 for (const auto &opt : l.attribs())
915 {
916 if (opt.name=="type")
917 {
918 m_output.addFieldQuotedString("list_type", qPrint(opt.value));
919 }
920 if (opt.name=="start")
921 {
922 m_output.addFieldQuotedString("start", qPrint(opt.value));
923 }
924 }
925 openSubBlock("content");
926 visitChildren(l);
928 closeItem();
929}
930
932{
933 for (const auto &opt : l.attribs())
934 {
935 if (opt.name=="value")
936 {
937 m_output.addFieldQuotedString("item_value", qPrint(opt.value));
938 }
939 }
940 openSubBlock();
941 visitChildren(l);
943}
944
946{
947#if 0
948 m_output.add("<variablelist>\n");
949#endif
950 visitChildren(dl);
951#if 0
952 m_output.add("</variablelist>\n");
953#endif
954}
955
957{
958#if 0
959 m_output.add("<varlistentry><term>");
960#endif
961 visitChildren(dt);
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 visitChildren(dd);
973#if 0
974 m_output.add("</listitem>\n");
975#endif
976}
977
979{
980#if 0
981 m_output.add("<table rows=\""); m_output.add(t.numRows());
982 m_output.add("\" cols=\""); m_output.add(t.numCols()); m_output.add("\">");
983#endif
984 if (t.caption())
985 {
986 std::visit(*this,*t.caption());
987 }
988 visitChildren(t);
989#if 0
990 m_output.add("</table>\n");
991#endif
992}
993
995{
996#if 0
997 m_output.add("<row>\n");
998#endif
999 visitChildren(r);
1000#if 0
1001 m_output.add("</row>\n");
1002#endif
1003}
1004
1006{
1007#if 0
1008 if (c.isHeading()) m_output.add("<entry thead=\"yes\">"); else m_output.add("<entry thead=\"no\">");
1009#endif
1010 visitChildren(c);
1011#if 0
1012 m_output.add("</entry>");
1013#endif
1014}
1015
1017{
1018#if 0
1019 m_output.add("<caption>");
1020#endif
1021 visitChildren(c);
1022#if 0
1023 m_output.add("</caption>\n");
1024#endif
1025}
1026
1028{
1029#if 0
1030 m_output.add("<internal>");
1031#endif
1032 visitChildren(i);
1033#if 0
1034 m_output.add("</internal>");
1035#endif
1036}
1037
1039{
1040#if 0
1041 m_output.add("<ulink url=\""); m_output.add(href.url()); m_output.add("\">");
1042#endif
1043 visitChildren(href);
1044#if 0
1045 m_output.add("</ulink>");
1046#endif
1047}
1048
1050{
1051 openItem("summary");
1052 openSubBlock("content");
1053 visitChildren(summary);
1054 closeSubBlock();
1055 closeItem();
1056}
1057
1059{
1060 openItem("details");
1061 auto summary = details.summary();
1062 if (summary)
1063 {
1064 std::visit(*this,*summary);
1065 }
1066 openSubBlock("content");
1068 closeSubBlock();
1069 closeItem();
1070}
1071
1073{
1074#if 0
1075 m_output.add("<sect"); m_output.add(header.level()); m_output.add(">");
1076#endif
1077 visitChildren(header);
1078#if 0
1079 m_output.add("</sect"); m_output.add(header.level()); m_output.add(">\n");
1080#endif
1081}
1082
1084{
1085#if 0
1086 m_output.add("<image type=\"");
1087 switch(img.type())
1088 {
1089 case DocImage::Html: m_output.add("html"); break;
1090 case DocImage::Latex: m_output.add("latex"); break;
1091 case DocImage::Rtf: m_output.add("rtf"); break;
1092 }
1093 m_output.add("\"");
1094
1095 DString baseName=img.name();
1096 int i;
1097 if ((i=baseName.findRev('/'))!=-1 || (i=baseName.findRev('\\'))!=-1)
1098 {
1099 baseName=baseName.mid(i+1);
1100 }
1101 m_output.add(" name=\""); m_output.add(baseName); m_output.add("\"");
1102 if (!img.width().empty())
1103 {
1104 m_output.add(" width=\"");
1105 m_output.addQuoted(img.width());
1106 m_output.add("\"");
1107 }
1108 else if (!img.height().empty())
1109 {
1110 m_output.add(" height=\"");
1111 m_output.addQuoted(img.height());
1112 m_output.add("\"");
1113 }
1114 m_output.add(">");
1115#endif
1116 visitChildren(img);
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 visitChildren(df);
1128#if 0
1129 m_output.add("</dotfile>");
1130#endif
1131}
1133{
1134#if 0
1135 m_output.add("<mscfile name=\""); m_output.add(df->file()); m_output.add("\">");
1136#endif
1137 visitChildren(df);
1138#if 0
1139 m_output.add("<mscfile>");
1140#endif
1141}
1142
1144{
1145#if 0
1146 m_output.add("<diafile name=\""); m_output.add(df->file()); m_output.add("\">");
1147#endif
1148 visitChildren(df);
1149#if 0
1150 m_output.add("</diafile>");
1151#endif
1152}
1153
1155{
1156#if 0
1157 m_output.add("<plantumlfile name=\""); m_output.add(df->file()); m_output.add("\">");
1158#endif
1159 visitChildren(df);
1160#if 0
1161 m_output.add("</plantumlfile>");
1162#endif
1163}
1164
1166{
1167#if 0
1168 m_output.add("<mermaidfile name=\""); m_output.add(df->file()); m_output.add("\">");
1169#endif
1170 visitChildren(df);
1171#if 0
1172 m_output.add("</mermaidfile>");
1173#endif
1174}
1175
1177{
1178 openItem("link");
1179 addLink(lnk.ref(), lnk.file(), lnk.anchor());
1180 visitChildren(lnk);
1181 closeItem();
1182}
1183
1185{
1186 openItem("ref");
1187 if (!ref.hasLinkText())
1189 openSubBlock("content");
1190 visitChildren(ref);
1191 closeSubBlock();
1192 closeItem();
1193}
1194
1196{
1197#if 0
1198 m_output.add("<tocitem id=\""); m_output.add(ref->file()); m_output.add("_1"); m_output.add(ref->anchor()); m_output.add("\">");
1199#endif
1200 visitChildren(ref);
1201#if 0
1202 m_output.add("</tocitem>");
1203#endif
1204}
1205
1207{
1208#if 0
1209 m_output.add("<toclist>");
1210#endif
1211 visitChildren(l);
1212#if 0
1213 m_output.add("</toclist>");
1214#endif
1215}
1216
1218{
1219 leaveText();
1220 const char *type = nullptr;
1221 switch(s.type())
1222 {
1223 case DocParamSect::Param: type = "params"; break;
1224 case DocParamSect::RetVal: type = "retvals"; break;
1225 case DocParamSect::Exception: type = "exceptions"; break;
1226 case DocParamSect::TemplateParam: type = "templateparam"; break;
1228 err("unknown parameter section found\n");
1229 break;
1230 }
1232 //openOther();
1233 openSubBlock(type);
1234 visitChildren(s);
1235 closeSubBlock();
1236 //closeOther();
1238}
1239
1243
1245{
1246 leaveText();
1247 m_output.openHash().openList("parameters");
1248 for (const auto &param : pl.parameters())
1249 {
1250 DString name;
1251 const DocWord *word = std::get_if<DocWord>(&param);
1252 const DocLinkedWord *linkedWord = std::get_if<DocLinkedWord>(&param);
1253 if (word)
1254 {
1255 name = word->word();
1256 }
1257 else if (linkedWord)
1258 {
1259 name = linkedWord->word();
1260 }
1261
1262 DString dir = "";
1263 const DocParamSect *sect = std::get_if<DocParamSect>(pl.parent());
1264 if (sect && sect->hasInOutSpecifier())
1265 {
1267 {
1268 if (pl.direction()==DocParamSect::In)
1269 {
1270 dir = "in";
1271 }
1272 else if (pl.direction()==DocParamSect::Out)
1273 {
1274 dir = "out";
1275 }
1276 else if (pl.direction()==DocParamSect::InOut)
1277 {
1278 dir = "in,out";
1279 }
1280 }
1281 }
1282
1284 .addFieldQuotedString("name", name).addFieldQuotedString("dir", dir)
1285 .closeHash();
1286 }
1288 .openList("doc");
1289 for (const auto &par : pl.paragraphs())
1290 {
1291 std::visit(*this,par);
1292 }
1293 leaveText();
1295 .closeHash();
1296}
1297
1299{
1300#if 0
1301 m_output.add("<xrefsect id=\"");
1302 m_output.add(x->file()); m_output.add("_1"); m_output.add(x->anchor());
1303 m_output.add("\">");
1304 m_output.add("<xreftitle>");
1305 m_output.addQuoted(x->title());
1306 m_output.add("</xreftitle>");
1307 m_output.add("<xrefdescription>");
1308#endif
1309 if (x.title().empty()) return;
1310 openItem("xrefitem");
1311 openSubBlock("content");
1312 visitChildren(x);
1313 if (x.title().empty()) return;
1314 closeSubBlock();
1315 closeItem();
1316#if 0
1317 m_output.add("</xrefdescription>");
1318 m_output.add("</xrefsect>");
1319#endif
1320}
1321
1323{
1324 openItem("ref");
1325 addLink(DString(),ref.file(),ref.anchor());
1326 openSubBlock("content");
1327 visitChildren(ref);
1328 closeSubBlock();
1329 closeItem();
1330}
1331
1333{
1334 visitChildren(t);
1335}
1336
1338{
1339 openItem("blockquote");
1340 openSubBlock("content");
1341 visitChildren(q);
1342 closeSubBlock();
1343 closeItem();
1344}
1345
1349
1351{
1352 visitChildren(pb);
1353}
1354
1355
1356static void addTemplateArgumentList(const ArgumentList &al,PerlModOutput &output,const DString &,
1357 const ArgumentList &typeConstraints=ArgumentList())
1358{
1359 if (!al.hasParameters()) return;
1360 output.openList("template_parameters");
1361 for (const Argument &a : al)
1362 {
1363 output.openHash();
1364 if (!a.type.empty())
1365 output.addFieldQuotedString("type", a.type);
1366 if (!a.name.empty())
1367 output.addFieldQuotedString("declaration_name", a.name)
1368 .addFieldQuotedString("definition_name", a.name);
1369 if (!a.defval.empty())
1370 output.addFieldQuotedString("default", a.defval);
1371 DString typeConstraint = a.typeConstraint;
1372 // C# where clauses, with one entry per constraint. A C# type parameter has its name in type.
1373 const DString &paramName = a.name.empty() ? a.type : a.name;
1374 for (const Argument &tc : typeConstraints)
1375 {
1376 if (tc.name==paramName && !tc.type.empty())
1377 {
1378 if (!typeConstraint.empty()) typeConstraint+=", ";
1379 typeConstraint+=tc.type;
1380 }
1381 }
1382 if (!typeConstraint.empty())
1383 output.addFieldQuotedString("type_constraint", typeConstraint);
1384 output.closeHash();
1385 }
1386 output.closeList();
1387}
1388
1389static void addTemplateList(const ClassDef *cd,PerlModOutput &output)
1390{
1392}
1393
1394static void addTemplateList(const ConceptDef *cd,PerlModOutput &output)
1395{
1397}
1398
1400 const DString &name,
1401 const DString &fileName,
1402 int lineNr,
1403 const Definition *scope,
1404 const MemberDef *md,
1405 const DString &text)
1406{
1407 DString stext = text.stripWhiteSpace();
1408 if (stext.empty())
1409 {
1410 output.addField(name).add("{}");
1411 }
1412 else
1413 {
1414 auto parser { createDocParser() };
1415 auto ast { validatingParseDoc(*parser.get(),
1416 fileName,
1417 lineNr,
1418 scope,
1419 md,
1420 stext,
1421 DocOptions())
1422 };
1423 output.openHash(name);
1424 auto astImpl = dynamic_cast<const DocNodeAST*>(ast.get());
1425 if (astImpl)
1426 {
1427 PerlModDocVisitor visitor(output);
1428 std::visit(visitor,astImpl->root);
1429 visitor.finish();
1430 }
1431 output.closeHash();
1432 }
1433}
1434
1435static const char *getProtectionName(Protection prot)
1436{
1437 return to_string_lower(prot);
1438}
1439
1440static const char *getVirtualnessName(Specifier virt)
1441{
1442 return to_string_lower(virt);
1443}
1444
1447
1449{
1450 pathDoxyfile = qs;
1452}
1453
1455{
1456public:
1457
1459
1472
1473 inline PerlModGenerator(bool pretty) : m_output(pretty) { }
1474
1475 void generatePerlModForMember(const MemberDef *md, const Definition *);
1477 void generatePerlModSection(const Definition *d, MemberList *ml,
1478 const DString &name, const DString &header=DString());
1479 void addListOfAllMembers(const ClassDef *cd);
1480 void addIncludeInfo(const IncludeInfo *ii);
1481 void generatePerlModForClass(const ClassDef *cd);
1482 void generatePerlModForConcept(const ConceptDef *cd);
1483 void generatePerlModForModule(const ModuleDef *mod);
1485 void generatePerlModForFile(const FileDef *fd);
1486 void generatePerlModForGroup(const GroupDef *gd);
1488
1489 bool createOutputFile(std::ofstream &f, const DString &s);
1490 bool createOutputDir(Dir &perlModDir);
1491 bool generateDoxyLatexTex();
1492 bool generateDoxyFormatTex();
1494 bool generateDoxyLatexPL();
1496 bool generateDoxyRules();
1497 bool generateMakefile();
1498 bool generatePerlModOutput();
1499
1500 void generate();
1501};
1502
1504{
1505 // + declaration/definition arg lists
1506 // + reimplements
1507 // + reimplementedBy
1508 // + exceptions
1509 // + const/volatile specifiers
1510 // - examples
1511 // - source definition
1512 // - source references
1513 // - source referenced by
1514 // - body code
1515 // - template arguments
1516 // (templateArguments(), definitionTemplateParameterLists())
1517
1518 DString memType = to_string_lower(md->memberType());
1519 DString name;
1520 bool isFunc=to_isFunction(md->memberType());
1521
1522 bool isFortran = md->getLanguage()==SrcLangExt::Fortran;
1523 name = md->name();
1524 if (md->isAnonymous()) name = "__unnamed" + name.mid(1)+"__";
1525
1527 .addFieldQuotedString("kind", memType)
1528 .addFieldQuotedString("name", name)
1531 .addFieldBoolean("static", md->isStatic());
1532
1533 if (md->memberType()==MemberType::Property)
1534 {
1535 m_output.addFieldBoolean("readable", md->isReadable())
1536 .addFieldBoolean("writable", md->isWritable())
1537 .addFieldBoolean("gettable", md->isGettable())
1538 .addFieldBoolean("private_gettable", md->isPrivateGettable())
1539 .addFieldBoolean("protected_gettable", md->isProtectedGettable())
1540 .addFieldBoolean("settable", md->isSettable())
1541 .addFieldBoolean("private_settable", md->isPrivateSettable())
1542 .addFieldBoolean("protected_settable", md->isProtectedSettable())
1543 .addFieldBoolean("initonly", md->isInitonly());
1544 }
1545
1547 addPerlModDocBlock(m_output,"detailed",md->docFile(),md->docLine(),md->getOuterScope(),md,md->documentation());
1548 if (md->memberType()!=MemberType::Define &&
1549 md->memberType()!=MemberType::Enumeration)
1551
1552 const ArgumentList &al = md->argumentList();
1553 if (isFunc) //function
1554 {
1556 .addFieldBoolean("volatile", al.volatileSpecifier());
1557
1558 m_output.openList("parameters");
1559 const ArgumentList &declAl = md->declArgumentList();
1560 if (!declAl.empty())
1561 {
1562 auto defIt = al.begin();
1563 for (const Argument &a : declAl)
1564 {
1565 const Argument *defArg = nullptr;
1566 if (defIt!=al.end())
1567 {
1568 defArg = &(*defIt);
1569 ++defIt;
1570 }
1572
1573 if (!a.name.empty())
1574 m_output.addFieldQuotedString("declaration_name", a.name);
1575
1576 if (defArg && !defArg->name.empty() && defArg->name!=a.name)
1577 m_output.addFieldQuotedString("definition_name", defArg->name);
1578
1579 if (isFortran && defArg && !defArg->type.empty())
1580 m_output.addFieldQuotedString("type", defArg->type);
1581 else if (!a.type.empty())
1582 m_output.addFieldQuotedString("type", a.type);
1583
1584 if (!a.array.empty())
1585 m_output.addFieldQuotedString("array", a.array);
1586
1587 if (!a.defval.empty())
1588 m_output.addFieldQuotedString("default_value", a.defval);
1589
1590 if (!a.attrib.empty())
1591 m_output.addFieldQuotedString("attributes", a.attrib);
1592
1594 }
1595 }
1597 }
1598 else if (md->memberType()==MemberType::Define &&
1599 md->argsString()!=nullptr) // define
1600 {
1601 m_output.openList("parameters");
1602 for (const Argument &a : al)
1603 {
1605 .addFieldQuotedString("name", a.type)
1606 .closeHash();
1607 }
1609 }
1610 else if (md->argsString()!=nullptr)
1611 {
1612 m_output.addFieldQuotedString("arguments", md->argsString());
1613 }
1614
1615 if (!md->initializer().empty())
1616 m_output.addFieldQuotedString("initializer", md->initializer());
1617
1618 if (!md->excpString().empty())
1619 m_output.addFieldQuotedString("exceptions", md->excpString());
1620
1621 if (md->memberType()==MemberType::Enumeration) // enum
1622 {
1623 const MemberVector &enumFields = md->enumFieldList();
1625 if (!enumFields.empty())
1626 {
1627 m_output.openList("values");
1628 for (const auto &emd : enumFields)
1629 {
1631 .addFieldQuotedString("name", emd->name());
1632
1633 if (!emd->initializer().empty())
1634 m_output.addFieldQuotedString("initializer", emd->initializer());
1635
1636 addPerlModDocBlock(m_output,"brief",emd->briefFile(),emd->briefLine(),emd->getOuterScope(),emd,emd->briefDescription());
1637
1638 addPerlModDocBlock(m_output,"detailed",emd->docFile(),emd->docLine(),emd->getOuterScope(),emd,emd->documentation());
1639
1641 }
1643 }
1644 }
1645
1646 if (md->memberType() == MemberType::Variable && !md->bitfieldString().empty())
1647 {
1648 DString bitfield = md->bitfieldString();
1649 if (bitfield.at(0) == ':') bitfield = bitfield.mid(1);
1650 m_output.addFieldQuotedString("bitfield", bitfield);
1651 }
1652
1653 const MemberDef *rmd = md->reimplements();
1654 if (rmd)
1655 m_output.openHash("reimplements")
1656 .addFieldQuotedString("name", rmd->name())
1657 .closeHash();
1658
1659 const MemberVector &rbml = md->reimplementedBy();
1660 if (!rbml.empty())
1661 {
1662 m_output.openList("reimplemented_by");
1663 for (const auto &rbmd : rbml)
1665 .addFieldQuotedString("name", rbmd->name())
1666 .closeHash();
1668 }
1669
1671}
1672
1674 MemberList *ml,const DString &name,const DString &header)
1675{
1676 if (ml==nullptr) return; // empty list
1677
1678 m_output.openHash(name);
1679
1680 if (!header.empty())
1681 m_output.addFieldQuotedString("header", header);
1682
1683 m_output.openList("members");
1684 for (const auto &md : *ml)
1685 {
1687 }
1689 .closeHash();
1690}
1691
1693{
1694 m_output.openList("all_members");
1695 for (auto &mni : cd->memberNameInfoLinkedMap())
1696 {
1697 for (auto &mi : *mni)
1698 {
1699 const MemberDef *md=mi->memberDef();
1700 const ClassDef *mcd=md->getClassDef();
1701
1703 .addFieldQuotedString("name", md->name())
1705 .addFieldQuotedString("protection", getProtectionName(mi->prot()));
1706
1707 if (!mi->ambiguityResolutionScope().empty())
1708 m_output.addFieldQuotedString("ambiguity_scope", mi->ambiguityResolutionScope());
1709
1710 m_output.addFieldQuotedString("scope", mcd->name())
1711 .closeHash();
1712 }
1713 }
1715}
1716
1718{
1719 if (!mgl.empty())
1720 {
1721 m_output.openList("user_defined");
1722 for (const auto &mg : mgl)
1723 {
1725 if (!mg->header().empty())
1726 {
1727 m_output.addFieldQuotedString("header", mg->header());
1728 }
1729
1730 if (!mg->members().empty())
1731 {
1732 m_output.openList("members");
1733 for (const auto &md : mg->members())
1734 {
1736 }
1738 }
1740 }
1742 }
1743}
1744
1746{
1747 if (ii)
1748 {
1749 DString nm = ii->includeName;
1750 if (nm.empty() && ii->fileDef) nm = ii->fileDef->docName();
1751 if (!nm.empty())
1752 {
1753 m_output.openHash("includes");
1755 .addFieldQuotedString("name", nm)
1756 .closeHash();
1757 }
1758 }
1759}
1760
1762{
1763 // + brief description
1764 // + detailed description
1765 // + template argument list(s)
1766 // - include file
1767 // + member groups
1768 // + inheritance diagram
1769 // + list of direct super classes
1770 // + list of direct sub classes
1771 // + list of inner classes
1772 // + collaboration diagram
1773 // + list of all members
1774 // + user defined member sections
1775 // + standard member sections
1776 // + detailed member documentation
1777 // - examples using the class
1778
1779 if (cd->isReference()) return; // skip external references.
1780 if (cd->isAnonymous()) return; // skip anonymous compounds.
1781 if (cd->isImplicitTemplateInstance()) return; // skip generated template instances.
1782
1784 .addFieldQuotedString("name", cd->name());
1785 /* DGA: fix # #7547 Perlmod does not generate "kind" information to discriminate struct/union */
1787 m_output.addFieldBoolean("final", cd->isFinal())
1788 .addFieldBoolean("sealed", cd->isSealed())
1789 .addFieldBoolean("abstract", cd->isAbstract())
1790 .addFieldBoolean("ref", cd->isRef());
1791
1792 if (!cd->baseClasses().empty())
1793 {
1794 m_output.openList("base");
1795 for (const auto &bcd : cd->baseClasses())
1796 {
1798 .addFieldQuotedString("name", bcd.classDef->displayName())
1799 .addFieldQuotedString("virtualness", getVirtualnessName(bcd.virt))
1800 .addFieldQuotedString("protection", getProtectionName(bcd.prot))
1801 .closeHash();
1802 }
1804 }
1805
1806 if (!cd->subClasses().empty())
1807 {
1808 m_output.openList("derived");
1809 for (const auto &bcd : cd->subClasses())
1810 {
1812 .addFieldQuotedString("name", bcd.classDef->displayName())
1813 .addFieldQuotedString("virtualness", getVirtualnessName(bcd.virt))
1814 .addFieldQuotedString("protection", getProtectionName(bcd.prot))
1815 .closeHash();
1816 }
1818 }
1819
1820 {
1821 m_output.openList("inner");
1822 for (const auto &icd : cd->getClasses())
1824 .addFieldQuotedString("name", icd->name())
1825 .closeHash();
1827 }
1828
1830
1834
1835 generatePerlModSection(cd,cd->getMemberList(MemberListType::PubTypes()),"public_typedefs");
1836 generatePerlModSection(cd,cd->getMemberList(MemberListType::PubMethods()),"public_methods");
1837 generatePerlModSection(cd,cd->getMemberList(MemberListType::PubAttribs()),"public_members");
1838 generatePerlModSection(cd,cd->getMemberList(MemberListType::PubSlots()),"public_slots");
1839 generatePerlModSection(cd,cd->getMemberList(MemberListType::Signals()),"signals");
1840 generatePerlModSection(cd,cd->getMemberList(MemberListType::DcopMethods()),"dcop_methods");
1841 generatePerlModSection(cd,cd->getMemberList(MemberListType::Properties()),"properties");
1842 generatePerlModSection(cd,cd->getMemberList(MemberListType::PubStaticMethods()),"public_static_methods");
1843 generatePerlModSection(cd,cd->getMemberList(MemberListType::PubStaticAttribs()),"public_static_members");
1844 generatePerlModSection(cd,cd->getMemberList(MemberListType::ProTypes()),"protected_typedefs");
1845 generatePerlModSection(cd,cd->getMemberList(MemberListType::ProMethods()),"protected_methods");
1846 generatePerlModSection(cd,cd->getMemberList(MemberListType::ProAttribs()),"protected_members");
1847 generatePerlModSection(cd,cd->getMemberList(MemberListType::ProSlots()),"protected_slots");
1848 generatePerlModSection(cd,cd->getMemberList(MemberListType::ProStaticMethods()),"protected_static_methods");
1849 generatePerlModSection(cd,cd->getMemberList(MemberListType::ProStaticAttribs()),"protected_static_members");
1850 generatePerlModSection(cd,cd->getMemberList(MemberListType::PriTypes()),"private_typedefs");
1851 generatePerlModSection(cd,cd->getMemberList(MemberListType::PriMethods()),"private_methods");
1852 generatePerlModSection(cd,cd->getMemberList(MemberListType::PriAttribs()),"private_members");
1853 generatePerlModSection(cd,cd->getMemberList(MemberListType::PriSlots()),"private_slots");
1854 generatePerlModSection(cd,cd->getMemberList(MemberListType::PriStaticMethods()),"private_static_methods");
1855 generatePerlModSection(cd,cd->getMemberList(MemberListType::PriStaticAttribs()),"private_static_members");
1856 generatePerlModSection(cd,cd->getMemberList(MemberListType::Friends()),"friend_methods");
1857 generatePerlModSection(cd,cd->getMemberList(MemberListType::Related()),"related_methods");
1858
1859 addPerlModDocBlock(m_output,"brief",cd->briefFile(),cd->briefLine(),cd,nullptr,cd->briefDescription());
1860 addPerlModDocBlock(m_output,"detailed",cd->docFile(),cd->docLine(),cd,nullptr,cd->documentation());
1861
1862#if 0
1863 DotClassGraph inheritanceGraph(cd,DotClassGraph::Inheritance);
1864 if (!inheritanceGraph.isTrivial())
1865 {
1866 t << " <inheritancegraph>" << endl;
1867 inheritanceGraph.writePerlMod(t);
1868 t << " </inheritancegraph>" << endl;
1869 }
1870 DotClassGraph collaborationGraph(cd,DotClassGraph::Implementation);
1871 if (!collaborationGraph.isTrivial())
1872 {
1873 t << " <collaborationgraph>" << endl;
1874 collaborationGraph.writePerlMod(t);
1875 t << " </collaborationgraph>" << endl;
1876 }
1877 t << " <location file=\""
1878 << cd->getDefFileName() << "\" line=\""
1879 << cd->getDefLine() << "\"";
1880 if (cd->getStartBodyLine()!=-1)
1881 {
1882 t << " bodystart=\"" << cd->getStartBodyLine() << "\" bodyend=\""
1883 << cd->getEndBodyLine() << "\"";
1884 }
1885 t << "/>" << endl;
1886#endif
1887
1889}
1890
1892{
1893 if (cd->isReference()) return; // skip external references
1894
1896 .addFieldQuotedString("name", cd->name());
1897
1900 m_output.addFieldQuotedString("initializer", cd->initializer());
1901 addPerlModDocBlock(m_output,"brief",cd->briefFile(),cd->briefLine(),nullptr,nullptr,cd->briefDescription());
1902 addPerlModDocBlock(m_output,"detailed",cd->docFile(),cd->docLine(),nullptr,nullptr,cd->documentation());
1903
1905}
1906
1908{
1909 // + contained class definitions
1910 // + contained concept definitions
1911 // + member groups
1912 // + normal members
1913 // + brief desc
1914 // + detailed desc
1915 // + location (file_id, line, column)
1916 // - exports
1917 // + used files
1918
1919 if (mod->isReference()) return; // skip external references
1920
1922 .addFieldQuotedString("name", mod->name());
1923
1925
1926 if (!mod->getClasses().empty())
1927 {
1928 m_output.openList("classes");
1929 for (const auto &cd : mod->getClasses())
1931 .addFieldQuotedString("name", cd->name())
1932 .closeHash();
1934 }
1935
1936 if (!mod->getConcepts().empty())
1937 {
1938 m_output.openList("concepts");
1939 for (const auto &cd : mod->getConcepts())
1941 .addFieldQuotedString("name", cd->name())
1942 .closeHash();
1944 }
1945
1946 generatePerlModSection(mod,mod->getMemberList(MemberListType::DecTypedefMembers()),"typedefs");
1947 generatePerlModSection(mod,mod->getMemberList(MemberListType::DecEnumMembers()),"enums");
1948 generatePerlModSection(mod,mod->getMemberList(MemberListType::DecFuncMembers()),"functions");
1949 generatePerlModSection(mod,mod->getMemberList(MemberListType::DecVarMembers()),"variables");
1950
1951 addPerlModDocBlock(m_output,"brief",mod->briefFile(),mod->briefLine(),nullptr,nullptr,mod->briefDescription());
1952 addPerlModDocBlock(m_output,"detailed",mod->docFile(),mod->docLine(),nullptr,nullptr,mod->documentation());
1953
1954 if (!mod->getUsedFiles().empty())
1955 {
1956 m_output.openList("files");
1957 for (const auto &fd : mod->getUsedFiles())
1959 .addFieldQuotedString("name", fd->name())
1960 .closeHash();
1962 }
1963
1965}
1966
1968{
1969 // + contained class definitions
1970 // + contained namespace definitions
1971 // + member groups
1972 // + normal members
1973 // + brief desc
1974 // + detailed desc
1975 // + location
1976 // - files containing (parts of) the namespace definition
1977
1978 if (nd->isReference()) return; // skip external references
1979
1981 .addFieldQuotedString("name", nd->name());
1982
1983 if (!nd->getClasses().empty())
1984 {
1985 m_output.openList("classes");
1986 for (const auto &cd : nd->getClasses())
1988 .addFieldQuotedString("name", cd->name())
1989 .closeHash();
1991 }
1992
1993 if (!nd->getNamespaces().empty())
1994 {
1995 m_output.openList("namespaces");
1996 for (const auto &ind : nd->getNamespaces())
1998 .addFieldQuotedString("name", ind->name())
1999 .closeHash();
2001 }
2002
2004
2005 generatePerlModSection(nd,nd->getMemberList(MemberListType::DecDefineMembers()),"defines");
2006 generatePerlModSection(nd,nd->getMemberList(MemberListType::DecProtoMembers()),"prototypes");
2007 generatePerlModSection(nd,nd->getMemberList(MemberListType::DecTypedefMembers()),"typedefs");
2008 generatePerlModSection(nd,nd->getMemberList(MemberListType::DecEnumMembers()),"enums");
2009 generatePerlModSection(nd,nd->getMemberList(MemberListType::DecFuncMembers()),"functions");
2010 generatePerlModSection(nd,nd->getMemberList(MemberListType::DecVarMembers()),"variables");
2011
2012 addPerlModDocBlock(m_output,"brief",nd->briefFile(),nd->briefLine(),nullptr,nullptr,nd->briefDescription());
2013 addPerlModDocBlock(m_output,"detailed",nd->docFile(),nd->docLine(),nullptr,nullptr,nd->documentation());
2014
2016}
2017
2019{
2020 // + includes files
2021 // + includedby files
2022 // - include graph
2023 // - included by graph
2024 // - contained class definitions
2025 // - contained namespace definitions
2026 // - member groups
2027 // + normal members
2028 // + brief desc
2029 // + detailed desc
2030 // - source code
2031 // - location
2032 // - number of lines
2033
2034 if (fd->isReference()) return;
2035
2037 .addFieldQuotedString("name", fd->name());
2038
2039 m_output.openList("includes");
2040 for (const auto &inc: fd->includeFileList())
2041 {
2043 .addFieldQuotedString("name", inc.includeName);
2044 if (inc.fileDef && !inc.fileDef->isReference())
2045 {
2046 m_output.addFieldQuotedString("ref", inc.fileDef->getOutputFileBase());
2047 }
2049 }
2051
2052 m_output.openList("included_by");
2053 for (const auto &inc : fd->includedByFileList())
2054 {
2056 .addFieldQuotedString("name", inc.includeName);
2057 if (inc.fileDef && !inc.fileDef->isReference())
2058 {
2059 m_output.addFieldQuotedString("ref", inc.fileDef->getOutputFileBase());
2060 }
2062 }
2064
2066
2067 generatePerlModSection(fd,fd->getMemberList(MemberListType::DecDefineMembers()),"defines");
2068 generatePerlModSection(fd,fd->getMemberList(MemberListType::DecProtoMembers()),"prototypes");
2069 generatePerlModSection(fd,fd->getMemberList(MemberListType::DecTypedefMembers()),"typedefs");
2070 generatePerlModSection(fd,fd->getMemberList(MemberListType::DecEnumMembers()),"enums");
2071 generatePerlModSection(fd,fd->getMemberList(MemberListType::DecFuncMembers()),"functions");
2072 generatePerlModSection(fd,fd->getMemberList(MemberListType::DecVarMembers()),"variables");
2073
2074 addPerlModDocBlock(m_output,"brief",fd->briefFile(),fd->briefLine(),nullptr,nullptr,fd->briefDescription());
2075 addPerlModDocBlock(m_output,"detailed",fd->docFile(),fd->docLine(),nullptr,nullptr,fd->documentation());
2076
2078}
2079
2081{
2082 // + members
2083 // + member groups
2084 // + files
2085 // + classes
2086 // + namespaces
2087 // - packages
2088 // + pages
2089 // + child groups
2090 // - examples
2091 // + brief description
2092 // + detailed description
2093
2094 if (gd->isReference()) return; // skip external references
2095
2097 .addFieldQuotedString("name", gd->name())
2098 .addFieldQuotedString("title", gd->groupTitle());
2099
2100 if (!gd->getFiles().empty())
2101 {
2102 m_output.openList("files");
2103 for (const auto &fd : gd->getFiles())
2105 .addFieldQuotedString("name", fd->name())
2106 .closeHash();
2108 }
2109
2110 if (!gd->getClasses().empty())
2111 {
2112 m_output.openList("classes");
2113 for (const auto &cd : gd->getClasses())
2115 .addFieldQuotedString("name", cd->name())
2116 .closeHash();
2118 }
2119
2120 if (!gd->getConcepts().empty())
2121 {
2122 m_output.openList("concepts");
2123 for (const auto &cd : gd->getConcepts())
2125 .addFieldQuotedString("name", cd->name())
2126 .closeHash();
2128 }
2129
2130 if (!gd->getModules().empty())
2131 {
2132 m_output.openList("modules");
2133 for (const auto &mod : gd->getModules())
2135 .addFieldQuotedString("name", mod->name())
2136 .closeHash();
2138 }
2139
2140 if (!gd->getNamespaces().empty())
2141 {
2142 m_output.openList("namespaces");
2143 for (const auto &nd : gd->getNamespaces())
2145 .addFieldQuotedString("name", nd->name())
2146 .closeHash();
2148 }
2149
2150 if (!gd->getPages().empty())
2151 {
2152 m_output.openList("pages");
2153 for (const auto &pd : gd->getPages())
2155 .addFieldQuotedString("title", pd->title())
2156 .closeHash();
2158 }
2159
2160 if (!gd->getSubGroups().empty())
2161 {
2162 m_output.openList("groups");
2163 for (const auto &sgd : gd->getSubGroups())
2165 .addFieldQuotedString("title", sgd->groupTitle())
2166 .closeHash();
2168 }
2169
2171
2172 generatePerlModSection(gd,gd->getMemberList(MemberListType::DecDefineMembers()),"defines");
2173 generatePerlModSection(gd,gd->getMemberList(MemberListType::DecProtoMembers()),"prototypes");
2174 generatePerlModSection(gd,gd->getMemberList(MemberListType::DecTypedefMembers()),"typedefs");
2175 generatePerlModSection(gd,gd->getMemberList(MemberListType::DecEnumMembers()),"enums");
2176 generatePerlModSection(gd,gd->getMemberList(MemberListType::DecFuncMembers()),"functions");
2177 generatePerlModSection(gd,gd->getMemberList(MemberListType::DecVarMembers()),"variables");
2178
2179 addPerlModDocBlock(m_output,"brief",gd->briefFile(),gd->briefLine(),nullptr,nullptr,gd->briefDescription());
2180 addPerlModDocBlock(m_output,"detailed",gd->docFile(),gd->docLine(),nullptr,nullptr,gd->documentation());
2181
2183}
2184
2186{
2187 // + name
2188 // + title
2189 // + documentation
2190
2191 if (pd->isReference()) return;
2192
2194 .addFieldQuotedString("name", pd->name());
2195
2196 const SectionInfo *si = SectionManager::instance().find(pd->name());
2197 if (si)
2199
2200 addPerlModDocBlock(m_output,"detailed",pd->docFile(),pd->docLine(),nullptr,nullptr,pd->documentation());
2202}
2203
2205{
2206 std::ofstream outputFileStream;
2207 if (!createOutputFile(outputFileStream, pathDoxyDocsPM))
2208 return false;
2209
2210 PerlModOutputStream outputStream(outputFileStream);
2211 m_output.setPerlModOutputStream(&outputStream);
2212 m_output.add("$doxydocs=").openHash();
2213
2214 m_output.openList("classes");
2215 for (const auto &cd : *Doxygen::classLinkedMap)
2216 generatePerlModForClass(cd.get());
2218
2219 m_output.openList("concepts");
2220 for (const auto &cd : *Doxygen::conceptLinkedMap)
2221 generatePerlModForConcept(cd.get());
2223
2224 m_output.openList("modules");
2225 for (const auto &mod : ModuleManager::instance().modules())
2226 generatePerlModForModule(mod.get());
2228
2229 m_output.openList("namespaces");
2230 for (const auto &nd : *Doxygen::namespaceLinkedMap)
2233
2234 m_output.openList("files");
2235 for (const auto &fn : *Doxygen::inputNameLinkedMap)
2236 {
2237 for (const auto &fd : *fn)
2238 {
2239 generatePerlModForFile(fd.get());
2240 }
2241 }
2243
2244 m_output.openList("groups");
2245 for (const auto &gd : *Doxygen::groupLinkedMap)
2246 {
2247 generatePerlModForGroup(gd.get());
2248 }
2250
2251 m_output.openList("pages");
2252 for (const auto &pd : *Doxygen::pageLinkedMap)
2253 {
2254 generatePerlModForPage(pd.get());
2255 }
2257 {
2259 }
2261
2262 m_output.closeHash().add(";\n1;\n");
2263 m_output.reset();
2264 return true;
2265}
2266
2267bool PerlModGenerator::createOutputFile(std::ofstream &f, const DString &s)
2268{
2270 if (!f.is_open())
2271 {
2272 err("Cannot open file {} for writing!\n", s);
2273 return false;
2274 }
2275 return true;
2276}
2277
2279{
2280 std::string outputDirectory = Config_getString(OUTPUT_DIRECTORY).str();
2281 perlModDir.setPath(outputDirectory+"/perlmod");
2282 if (!perlModDir.exists() && !perlModDir.mkdir(outputDirectory+"/perlmod"))
2283 {
2284 err("Could not create perlmod directory in {}\n",outputDirectory);
2285 return false;
2286 }
2287 return true;
2288}
2289
2291{
2292 std::ofstream doxyModelPMStream;
2293 if (!createOutputFile(doxyModelPMStream, pathDoxyStructurePM))
2294 return false;
2295
2296 doxyModelPMStream <<
2297 "sub memberlist($) {\n"
2298 " my $prefix = $_[0];\n"
2299 " return\n"
2300 "\t[ \"hash\", $prefix . \"s\",\n"
2301 "\t {\n"
2302 "\t members =>\n"
2303 "\t [ \"list\", $prefix . \"List\",\n"
2304 "\t\t[ \"hash\", $prefix,\n"
2305 "\t\t {\n"
2306 "\t\t kind => [ \"string\", $prefix . \"Kind\" ],\n"
2307 "\t\t name => [ \"string\", $prefix . \"Name\" ],\n"
2308 "\t\t static => [ \"string\", $prefix . \"Static\" ],\n"
2309 "\t\t virtualness => [ \"string\", $prefix . \"Virtualness\" ],\n"
2310 "\t\t protection => [ \"string\", $prefix . \"Protection\" ],\n"
2311 "\t\t type => [ \"string\", $prefix . \"Type\" ],\n"
2312 "\t\t parameters =>\n"
2313 "\t\t [ \"list\", $prefix . \"Params\",\n"
2314 "\t\t\t[ \"hash\", $prefix . \"Param\",\n"
2315 "\t\t\t {\n"
2316 "\t\t\t declaration_name => [ \"string\", $prefix . \"ParamName\" ],\n"
2317 "\t\t\t type => [ \"string\", $prefix . \"ParamType\" ],\n"
2318 "\t\t\t },\n"
2319 "\t\t\t],\n"
2320 "\t\t ],\n"
2321 "\t\t detailed =>\n"
2322 "\t\t [ \"hash\", $prefix . \"Detailed\",\n"
2323 "\t\t\t{\n"
2324 "\t\t\t doc => [ \"doc\", $prefix . \"DetailedDoc\" ],\n"
2325 "\t\t\t return => [ \"doc\", $prefix . \"Return\" ],\n"
2326 "\t\t\t see => [ \"doc\", $prefix . \"See\" ],\n"
2327 "\t\t\t params =>\n"
2328 "\t\t\t [ \"list\", $prefix . \"PDBlocks\",\n"
2329 "\t\t\t [ \"hash\", $prefix . \"PDBlock\",\n"
2330 "\t\t\t\t{\n"
2331 "\t\t\t\t parameters =>\n"
2332 "\t\t\t\t [ \"list\", $prefix . \"PDParams\",\n"
2333 "\t\t\t\t [ \"hash\", $prefix . \"PDParam\",\n"
2334 "\t\t\t\t\t{\n"
2335 "\t\t\t\t\t name => [ \"string\", $prefix . \"PDParamName\" ],\n"
2336 "\t\t\t\t\t},\n"
2337 "\t\t\t\t ],\n"
2338 "\t\t\t\t ],\n"
2339 "\t\t\t\t doc => [ \"doc\", $prefix . \"PDDoc\" ],\n"
2340 "\t\t\t\t},\n"
2341 "\t\t\t ],\n"
2342 "\t\t\t ],\n"
2343 "\t\t\t},\n"
2344 "\t\t ],\n"
2345 "\t\t },\n"
2346 "\t\t],\n"
2347 "\t ],\n"
2348 "\t },\n"
2349 "\t];\n"
2350 "}\n"
2351 "\n"
2352 "$doxystructure =\n"
2353 " [ \"hash\", \"Root\",\n"
2354 " {\n"
2355 "\tfiles =>\n"
2356 "\t [ \"list\", \"Files\",\n"
2357 "\t [ \"hash\", \"File\",\n"
2358 "\t {\n"
2359 "\t\tname => [ \"string\", \"FileName\" ],\n"
2360 "\t\ttypedefs => memberlist(\"FileTypedef\"),\n"
2361 "\t\tvariables => memberlist(\"FileVariable\"),\n"
2362 "\t\tfunctions => memberlist(\"FileFunction\"),\n"
2363 "\t\tdetailed =>\n"
2364 "\t\t [ \"hash\", \"FileDetailed\",\n"
2365 "\t\t {\n"
2366 "\t\t doc => [ \"doc\", \"FileDetailedDoc\" ],\n"
2367 "\t\t },\n"
2368 "\t\t ],\n"
2369 "\t },\n"
2370 "\t ],\n"
2371 "\t ],\n"
2372 "\tpages =>\n"
2373 "\t [ \"list\", \"Pages\",\n"
2374 "\t [ \"hash\", \"Page\",\n"
2375 "\t {\n"
2376 "\t\tname => [ \"string\", \"PageName\" ],\n"
2377 "\t\tdetailed =>\n"
2378 "\t\t [ \"hash\", \"PageDetailed\",\n"
2379 "\t\t {\n"
2380 "\t\t doc => [ \"doc\", \"PageDetailedDoc\" ],\n"
2381 "\t\t },\n"
2382 "\t\t ],\n"
2383 "\t },\n"
2384 "\t ],\n"
2385 "\t ],\n"
2386 "\tclasses =>\n"
2387 "\t [ \"list\", \"Classes\",\n"
2388 "\t [ \"hash\", \"Class\",\n"
2389 "\t {\n"
2390 "\t\tname => [ \"string\", \"ClassName\" ],\n"
2391 "\t\tpublic_typedefs => memberlist(\"ClassPublicTypedef\"),\n"
2392 "\t\tpublic_methods => memberlist(\"ClassPublicMethod\"),\n"
2393 "\t\tpublic_members => memberlist(\"ClassPublicMember\"),\n"
2394 "\t\tprotected_typedefs => memberlist(\"ClassProtectedTypedef\"),\n"
2395 "\t\tprotected_methods => memberlist(\"ClassProtectedMethod\"),\n"
2396 "\t\tprotected_members => memberlist(\"ClassProtectedMember\"),\n"
2397 "\t\tprivate_typedefs => memberlist(\"ClassPrivateTypedef\"),\n"
2398 "\t\tprivate_methods => memberlist(\"ClassPrivateMethod\"),\n"
2399 "\t\tprivate_members => memberlist(\"ClassPrivateMember\"),\n"
2400 "\t\tdetailed =>\n"
2401 "\t\t [ \"hash\", \"ClassDetailed\",\n"
2402 "\t\t {\n"
2403 "\t\t doc => [ \"doc\", \"ClassDetailedDoc\" ],\n"
2404 "\t\t },\n"
2405 "\t\t ],\n"
2406 "\t },\n"
2407 "\t ],\n"
2408 "\t ],\n"
2409 "\tgroups =>\n"
2410 "\t [ \"list\", \"Groups\",\n"
2411 "\t [ \"hash\", \"Group\",\n"
2412 "\t {\n"
2413 "\t\tname => [ \"string\", \"GroupName\" ],\n"
2414 "\t\ttitle => [ \"string\", \"GroupTitle\" ],\n"
2415 "\t\tfiles =>\n"
2416 "\t\t [ \"list\", \"Files\",\n"
2417 "\t\t [ \"hash\", \"File\",\n"
2418 "\t\t {\n"
2419 "\t\t name => [ \"string\", \"Filename\" ]\n"
2420 "\t\t }\n"
2421 "\t\t ],\n"
2422 "\t\t ],\n"
2423 "\t\tclasses =>\n"
2424 "\t\t [ \"list\", \"Classes\",\n"
2425 "\t\t [ \"hash\", \"Class\",\n"
2426 "\t\t {\n"
2427 "\t\t name => [ \"string\", \"Classname\" ]\n"
2428 "\t\t }\n"
2429 "\t\t ],\n"
2430 "\t\t ],\n"
2431 "\t\tnamespaces =>\n"
2432 "\t\t [ \"list\", \"Namespaces\",\n"
2433 "\t\t [ \"hash\", \"Namespace\",\n"
2434 "\t\t {\n"
2435 "\t\t name => [ \"string\", \"NamespaceName\" ]\n"
2436 "\t\t }\n"
2437 "\t\t ],\n"
2438 "\t\t ],\n"
2439 "\t\tpages =>\n"
2440 "\t\t [ \"list\", \"Pages\",\n"
2441 "\t\t [ \"hash\", \"Page\","
2442 "\t\t {\n"
2443 "\t\t title => [ \"string\", \"PageName\" ]\n"
2444 "\t\t }\n"
2445 "\t\t ],\n"
2446 "\t\t ],\n"
2447 "\t\tgroups =>\n"
2448 "\t\t [ \"list\", \"Groups\",\n"
2449 "\t\t [ \"hash\", \"Group\",\n"
2450 "\t\t {\n"
2451 "\t\t title => [ \"string\", \"GroupName\" ]\n"
2452 "\t\t }\n"
2453 "\t\t ],\n"
2454 "\t\t ],\n"
2455 "\t\tfunctions => memberlist(\"GroupFunction\"),\n"
2456 "\t\tdetailed =>\n"
2457 "\t\t [ \"hash\", \"GroupDetailed\",\n"
2458 "\t\t {\n"
2459 "\t\t doc => [ \"doc\", \"GroupDetailedDoc\" ],\n"
2460 "\t\t },\n"
2461 "\t\t ],\n"
2462 "\t }\n"
2463 "\t ],\n"
2464 "\t ],\n"
2465 " },\n"
2466 " ];\n"
2467 "\n"
2468 "1;\n";
2469
2470 return true;
2471}
2472
2474{
2475 std::ofstream doxyRulesStream;
2476 if (!createOutputFile(doxyRulesStream, pathDoxyRules))
2477 return false;
2478
2479 bool perlmodLatex = Config_getBool(PERLMOD_LATEX);
2480 DString prefix = Config_getString(PERLMOD_MAKEVAR_PREFIX);
2481
2482 doxyRulesStream <<
2483 prefix << "DOXY_EXEC_PATH = " << pathDoxyExec << "\n" <<
2484 prefix << "DOXYFILE = " << pathDoxyfile << "\n" <<
2485 prefix << "DOXYDOCS_PM = " << pathDoxyDocsPM << "\n" <<
2486 prefix << "DOXYSTRUCTURE_PM = " << pathDoxyStructurePM << "\n" <<
2487 prefix << "DOXYRULES = " << pathDoxyRules << "\n";
2488 if (perlmodLatex)
2489 doxyRulesStream <<
2490 prefix << "DOXYLATEX_PL = " << pathDoxyLatexPL << "\n" <<
2491 prefix << "DOXYLATEXSTRUCTURE_PL = " << pathDoxyLatexStructurePL << "\n" <<
2492 prefix << "DOXYSTRUCTURE_TEX = " << pathDoxyStructureTex << "\n" <<
2493 prefix << "DOXYDOCS_TEX = " << pathDoxyDocsTex << "\n" <<
2494 prefix << "DOXYFORMAT_TEX = " << pathDoxyFormatTex << "\n" <<
2495 prefix << "DOXYLATEX_TEX = " << pathDoxyLatexTex << "\n" <<
2496 prefix << "DOXYLATEX_DVI = " << pathDoxyLatexDVI << "\n" <<
2497 prefix << "DOXYLATEX_PDF = " << pathDoxyLatexPDF << "\n";
2498
2499 doxyRulesStream <<
2500 "\n"
2501 ".PHONY: clean-perlmod\n"
2502 "clean-perlmod::\n"
2503 "\trm -f $(" << prefix << "DOXYSTRUCTURE_PM) \\\n"
2504 "\t$(" << prefix << "DOXYDOCS_PM)";
2505 if (perlmodLatex)
2506 doxyRulesStream <<
2507 " \\\n"
2508 "\t$(" << prefix << "DOXYLATEX_PL) \\\n"
2509 "\t$(" << prefix << "DOXYLATEXSTRUCTURE_PL) \\\n"
2510 "\t$(" << prefix << "DOXYDOCS_TEX) \\\n"
2511 "\t$(" << prefix << "DOXYSTRUCTURE_TEX) \\\n"
2512 "\t$(" << prefix << "DOXYFORMAT_TEX) \\\n"
2513 "\t$(" << prefix << "DOXYLATEX_TEX) \\\n"
2514 "\t$(" << prefix << "DOXYLATEX_PDF) \\\n"
2515 "\t$(" << prefix << "DOXYLATEX_DVI) \\\n"
2516 "\t$(addprefix $(" << prefix << "DOXYLATEX_TEX:tex=),out aux log)";
2517 doxyRulesStream << "\n\n";
2518
2519 doxyRulesStream <<
2520 "$(" << prefix << "DOXYRULES) \\\n"
2521 "$(" << prefix << "DOXYMAKEFILE) \\\n"
2522 "$(" << prefix << "DOXYSTRUCTURE_PM) \\\n"
2523 "$(" << prefix << "DOXYDOCS_PM)";
2524 if (perlmodLatex) {
2525 doxyRulesStream <<
2526 " \\\n"
2527 "$(" << prefix << "DOXYLATEX_PL) \\\n"
2528 "$(" << prefix << "DOXYLATEXSTRUCTURE_PL) \\\n"
2529 "$(" << prefix << "DOXYFORMAT_TEX) \\\n"
2530 "$(" << prefix << "DOXYLATEX_TEX)";
2531 }
2532 doxyRulesStream <<
2533 ": \\\n"
2534 "\t$(" << prefix << "DOXYFILE)\n"
2535 "\tcd $(" << prefix << "DOXY_EXEC_PATH) ; doxygen \"$<\"\n";
2536
2537 if (perlmodLatex) {
2538 doxyRulesStream <<
2539 "\n"
2540 "$(" << prefix << "DOXYDOCS_TEX): \\\n"
2541 "$(" << prefix << "DOXYLATEX_PL) \\\n"
2542 "$(" << prefix << "DOXYDOCS_PM)\n"
2543 "\tperl -I\"$(<D)\" \"$<\" >\"$@\"\n"
2544 "\n"
2545 "$(" << prefix << "DOXYSTRUCTURE_TEX): \\\n"
2546 "$(" << prefix << "DOXYLATEXSTRUCTURE_PL) \\\n"
2547 "$(" << prefix << "DOXYSTRUCTURE_PM)\n"
2548 "\tperl -I\"$(<D)\" \"$<\" >\"$@\"\n"
2549 "\n"
2550 "$(" << prefix << "DOXYLATEX_PDF) \\\n"
2551 "$(" << prefix << "DOXYLATEX_DVI): \\\n"
2552 "$(" << prefix << "DOXYLATEX_TEX) \\\n"
2553 "$(" << prefix << "DOXYFORMAT_TEX) \\\n"
2554 "$(" << prefix << "DOXYSTRUCTURE_TEX) \\\n"
2555 "$(" << prefix << "DOXYDOCS_TEX)\n"
2556 "\n"
2557 "$(" << prefix << "DOXYLATEX_PDF): \\\n"
2558 "$(" << prefix << "DOXYLATEX_TEX)\n"
2559 "\tpdflatex -interaction=nonstopmode \"$<\"\n"
2560 "\n"
2561 "$(" << prefix << "DOXYLATEX_DVI): \\\n"
2562 "$(" << prefix << "DOXYLATEX_TEX)\n"
2563 "\tlatex -interaction=nonstopmode \"$<\"\n";
2564 }
2565
2566 return true;
2567}
2568
2570{
2571 std::ofstream makefileStream;
2572 if (!createOutputFile(makefileStream, pathMakefile))
2573 return false;
2574
2575 bool perlmodLatex = Config_getBool(PERLMOD_LATEX);
2576 DString prefix = Config_getString(PERLMOD_MAKEVAR_PREFIX);
2577
2578 makefileStream <<
2579 ".PHONY: default clean" << (perlmodLatex ? " pdf" : "") << "\n"
2580 "default: " << (perlmodLatex ? "pdf" : "clean") << "\n"
2581 "\n"
2582 "include " << pathDoxyRules << "\n"
2583 "\n"
2584 "clean: clean-perlmod\n";
2585
2586 if (perlmodLatex) {
2587 makefileStream <<
2588 "pdf: $(" << prefix << "DOXYLATEX_PDF)\n"
2589 "dvi: $(" << prefix << "DOXYLATEX_DVI)\n";
2590 }
2591
2592 return true;
2593}
2594
2596{
2597 std::ofstream doxyLatexStructurePLStream;
2598 if (!createOutputFile(doxyLatexStructurePLStream, pathDoxyLatexStructurePL))
2599 return false;
2600
2601 doxyLatexStructurePLStream <<
2602 "use DoxyStructure;\n"
2603 "\n"
2604 "sub process($) {\n"
2605 "\tmy $node = $_[0];\n"
2606 "\tmy ($type, $name) = @$node[0, 1];\n"
2607 "\tmy $command;\n"
2608 "\tif ($type eq \"string\") { $command = \"String\" }\n"
2609 "\telsif ($type eq \"doc\") { $command = \"Doc\" }\n"
2610 "\telsif ($type eq \"hash\") {\n"
2611 "\t\t$command = \"Hash\";\n"
2612 "\t\tfor my $subnode (values %{$$node[2]}) {\n"
2613 "\t\t\tprocess($subnode);\n"
2614 "\t\t}\n"
2615 "\t}\n"
2616 "\telsif ($type eq \"list\") {\n"
2617 "\t\t$command = \"List\";\n"
2618 "\t\tprocess($$node[2]);\n"
2619 "\t}\n"
2620 "\tprint \"\\\\\" . $command . \"Node{\" . $name . \"}%\\n\";\n"
2621 "}\n"
2622 "\n"
2623 "process($doxystructure);\n";
2624
2625 return true;
2626}
2627
2629{
2630 std::ofstream doxyLatexPLStream;
2631 if (!createOutputFile(doxyLatexPLStream, pathDoxyLatexPL))
2632 return false;
2633
2634 doxyLatexPLStream <<
2635 "use DoxyStructure;\n"
2636 "use DoxyDocs;\n"
2637 "\n"
2638 "sub latex_quote($) {\n"
2639 "\tmy $text = $_[0];\n"
2640 "\t$text =~ s/\\\\/\\\\textbackslash /g;\n"
2641 "\t$text =~ s/\\|/\\\\textbar /g;\n"
2642 "\t$text =~ s/</\\\\textless /g;\n"
2643 "\t$text =~ s/>/\\\\textgreater /g;\n"
2644 "\t$text =~ s/~/\\\\textasciitilde /g;\n"
2645 "\t$text =~ s/\\^/\\\\textasciicircum /g;\n"
2646 "\t$text =~ s/[\\$&%#_{}]/\\\\$&/g;\n"
2647 "\tprint $text;\n"
2648 "}\n"
2649 "\n"
2650 "sub generate_doc($) {\n"
2651 "\tmy $doc = $_[0];\n"
2652 "\tfor my $item (@$doc) {\n"
2653 "\t\tmy $type = $$item{type};\n"
2654 "\t\tif ($type eq \"text\") {\n"
2655 "\t\t\tlatex_quote($$item{content});\n"
2656 "\t\t} elsif ($type eq \"parbreak\") {\n"
2657 "\t\t\tprint \"\\n\\n\";\n"
2658 "\t\t} elsif ($type eq \"style\") {\n"
2659 "\t\t\tmy $style = $$item{style};\n"
2660 "\t\t\tif ($$item{enable} eq \"yes\") {\n"
2661 "\t\t\t\tif ($style eq \"bold\") { print '\\bfseries'; }\n"
2662 "\t\t\t\tif ($style eq \"italic\") { print '\\itshape'; }\n"
2663 "\t\t\t\tif ($style eq \"code\") { print '\\ttfamily'; }\n"
2664 "\t\t\t} else {\n"
2665 "\t\t\t\tif ($style eq \"bold\") { print '\\mdseries'; }\n"
2666 "\t\t\t\tif ($style eq \"italic\") { print '\\upshape'; }\n"
2667 "\t\t\t\tif ($style eq \"code\") { print '\\rmfamily'; }\n"
2668 "\t\t\t}\n"
2669 "\t\t\tprint '{}';\n"
2670 "\t\t} elsif ($type eq \"symbol\") {\n"
2671 "\t\t\tmy $symbol = $$item{symbol};\n"
2672 "\t\t\tif ($symbol eq \"copyright\") { print '\\copyright'; }\n"
2673 "\t\t\telsif ($symbol eq \"szlig\") { print '\\ss'; }\n"
2674 "\t\t\tprint '{}';\n"
2675 "\t\t} elsif ($type eq \"accent\") {\n"
2676 "\t\t\tmy ($accent) = $$item{accent};\n"
2677 "\t\t\tif ($accent eq \"umlaut\") { print '\\\"'; }\n"
2678 "\t\t\telsif ($accent eq \"acute\") { print '\\\\\\''; }\n"
2679 "\t\t\telsif ($accent eq \"grave\") { print '\\`'; }\n"
2680 "\t\t\telsif ($accent eq \"circ\") { print '\\^'; }\n"
2681 "\t\t\telsif ($accent eq \"tilde\") { print '\\~'; }\n"
2682 "\t\t\telsif ($accent eq \"cedilla\") { print '\\c'; }\n"
2683 "\t\t\telsif ($accent eq \"ring\") { print '\\r'; }\n"
2684 "\t\t\tprint \"{\" . $$item{letter} . \"}\"; \n"
2685 "\t\t} elsif ($type eq \"list\") {\n"
2686 "\t\t\tmy $env = ($$item{style} eq \"ordered\") ? \"enumerate\" : \"itemize\";\n"
2687 "\t\t\tprint \"\\n\\\\begin{\" . $env .\"}\";\n"
2688 "\t\t \tfor my $subitem (@{$$item{content}}) {\n"
2689 "\t\t\t\tprint \"\\n\\\\item \";\n"
2690 "\t\t\t\tgenerate_doc($subitem);\n"
2691 "\t\t \t}\n"
2692 "\t\t\tprint \"\\n\\\\end{\" . $env .\"}\";\n"
2693 "\t\t} elsif ($type eq \"url\") {\n"
2694 "\t\t\tlatex_quote($$item{content});\n"
2695 "\t\t}\n"
2696 "\t}\n"
2697 "}\n"
2698 "\n"
2699 "sub generate($$) {\n"
2700 "\tmy ($item, $node) = @_;\n"
2701 "\tmy ($type, $name) = @$node[0, 1];\n"
2702 "\tif ($type eq \"string\") {\n"
2703 "\t\tprint \"\\\\\" . $name . \"{\";\n"
2704 "\t\tlatex_quote($item);\n"
2705 "\t\tprint \"}\";\n"
2706 "\t} elsif ($type eq \"doc\") {\n"
2707 "\t\tif (@$item) {\n"
2708 "\t\t\tprint \"\\\\\" . $name . \"{\";\n"
2709 "\t\t\tgenerate_doc($item);\n"
2710 "\t\t\tprint \"}%\\n\";\n"
2711 "\t\t} else {\n"
2712 "#\t\t\tprint \"\\\\\" . $name . \"Empty%\\n\";\n"
2713 "\t\t}\n"
2714 "\t} elsif ($type eq \"hash\") {\n"
2715 "\t\tmy ($key, $value);\n"
2716 "\t\twhile (($key, $subnode) = each %{$$node[2]}) {\n"
2717 "\t\t\tmy $subname = $$subnode[1];\n"
2718 "\t\t\tprint \"\\\\Defcs{field\" . $subname . \"}{\";\n"
2719 "\t\t\tif ($$item{$key}) {\n"
2720 "\t\t\t\tgenerate($$item{$key}, $subnode);\n"
2721 "\t\t\t} else {\n"
2722 "#\t\t\t\t\tprint \"\\\\\" . $subname . \"Empty%\\n\";\n"
2723 "\t\t\t}\n"
2724 "\t\t\tprint \"}%\\n\";\n"
2725 "\t\t}\n"
2726 "\t\tprint \"\\\\\" . $name . \"%\\n\";\n"
2727 "\t} elsif ($type eq \"list\") {\n"
2728 "\t\tmy $index = 0;\n"
2729 "\t\tif (@$item) {\n"
2730 "\t\t\tprint \"\\\\\" . $name . \"{%\\n\";\n"
2731 "\t\t\tfor my $subitem (@$item) {\n"
2732 "\t\t\t\tif ($index) {\n"
2733 "\t\t\t\t\tprint \"\\\\\" . $name . \"Sep%\\n\";\n"
2734 "\t\t\t\t}\n"
2735 "\t\t\t\tgenerate($subitem, $$node[2]);\n"
2736 "\t\t\t\t$index++;\n"
2737 "\t\t\t}\n"
2738 "\t\t\tprint \"}%\\n\";\n"
2739 "\t\t} else {\n"
2740 "#\t\t\tprint \"\\\\\" . $name . \"Empty%\\n\";\n"
2741 "\t\t}\n"
2742 "\t}\n"
2743 "}\n"
2744 "\n"
2745 "generate($doxydocs, $doxystructure);\n";
2746
2747 return true;
2748}
2749
2751{
2752 std::ofstream doxyFormatTexStream;
2753 if (!createOutputFile(doxyFormatTexStream, pathDoxyFormatTex))
2754 return false;
2755
2756 doxyFormatTexStream <<
2757 "\\def\\Defcs#1{\\long\\expandafter\\def\\csname#1\\endcsname}\n"
2758 "\\Defcs{Empty}{}\n"
2759 "\\def\\IfEmpty#1{\\expandafter\\ifx\\csname#1\\endcsname\\Empty}\n"
2760 "\n"
2761 "\\def\\StringNode#1{\\Defcs{#1}##1{##1}}\n"
2762 "\\def\\DocNode#1{\\Defcs{#1}##1{##1}}\n"
2763 "\\def\\ListNode#1{\\Defcs{#1}##1{##1}\\Defcs{#1Sep}{}}\n"
2764 "\\def\\HashNode#1{\\Defcs{#1}{}}\n"
2765 "\n"
2766 "\\input{" << pathDoxyStructureTex << "}\n"
2767 "\n"
2768 "\\newbox\\BoxA\n"
2769 "\\dimendef\\DimenA=151\\relax\n"
2770 "\\dimendef\\DimenB=152\\relax\n"
2771 "\\countdef\\ZoneDepth=151\\relax\n"
2772 "\n"
2773 "\\def\\Cs#1{\\csname#1\\endcsname}\n"
2774 "\\def\\Letcs#1{\\expandafter\\let\\csname#1\\endcsname}\n"
2775 "\\def\\Heading#1{\\vskip 4mm\\relax\\textbf{#1}}\n"
2776 "\\def\\See#1{\\begin{flushleft}\\Heading{See also: }#1\\end{flushleft}}\n"
2777 "\n"
2778 "\\def\\Frame#1{\\vskip 3mm\\relax\\fbox{ \\vbox{\\hsize0.95\\hsize\\vskip 1mm\\relax\n"
2779 "\\raggedright#1\\vskip 0.5mm\\relax} }}\n"
2780 "\n"
2781 "\\def\\Zone#1#2#3{%\n"
2782 "\\Defcs{Test#1}{#2}%\n"
2783 "\\Defcs{Emit#1}{#3}%\n"
2784 "\\Defcs{#1}{%\n"
2785 "\\advance\\ZoneDepth1\\relax\n"
2786 "\\Letcs{Mode\\number\\ZoneDepth}0\\relax\n"
2787 "\\Letcs{Present\\number\\ZoneDepth}0\\relax\n"
2788 "\\Cs{Test#1}\n"
2789 "\\expandafter\\if\\Cs{Present\\number\\ZoneDepth}1%\n"
2790 "\\advance\\ZoneDepth-1\\relax\n"
2791 "\\Letcs{Present\\number\\ZoneDepth}1\\relax\n"
2792 "\\expandafter\\if\\Cs{Mode\\number\\ZoneDepth}1%\n"
2793 "\\advance\\ZoneDepth1\\relax\n"
2794 "\\Letcs{Mode\\number\\ZoneDepth}1\\relax\n"
2795 "\\Cs{Emit#1}\n"
2796 "\\advance\\ZoneDepth-1\\relax\\fi\n"
2797 "\\advance\\ZoneDepth1\\relax\\fi\n"
2798 "\\advance\\ZoneDepth-1\\relax}}\n"
2799 "\n"
2800 "\\def\\Member#1#2{%\n"
2801 "\\Defcs{Test#1}{\\Cs{field#1Detailed}\n"
2802 "\\IfEmpty{field#1DetailedDoc}\\else\\Letcs{Present#1}1\\fi}\n"
2803 "\\Defcs{#1}{\\Letcs{Present#1}0\\relax\n"
2804 "\\Cs{Test#1}\\if1\\Cs{Present#1}\\Letcs{Present\\number\\ZoneDepth}1\\relax\n"
2805 "\\if1\\Cs{Mode\\number\\ZoneDepth}#2\\fi\\fi}}\n"
2806 "\n"
2807 "\\def\\TypedefMemberList#1#2{%\n"
2808 "\\Defcs{#1DetailedDoc}##1{\\vskip 5.5mm\\relax##1}%\n"
2809 "\\Defcs{#1Name}##1{\\textbf{##1}}%\n"
2810 "\\Defcs{#1See}##1{\\See{##1}}%\n"
2811 "%\n"
2812 "\\Zone{#1s}{\\Cs{field#1List}}{\\subsubsection{#2}\\Cs{field#1List}}%\n"
2813 "\\Member{#1}{\\Frame{typedef \\Cs{field#1Type} \\Cs{field#1Name}}%\n"
2814 "\\Cs{field#1DetailedDoc}\\Cs{field#1See}\\vskip 5mm\\relax}}%\n"
2815 "\n"
2816 "\\def\\VariableMemberList#1#2{%\n"
2817 "\\Defcs{#1DetailedDoc}##1{\\vskip 5.5mm\\relax##1}%\n"
2818 "\\Defcs{#1Name}##1{\\textbf{##1}}%\n"
2819 "\\Defcs{#1See}##1{\\See{##1}}%\n"
2820 "%\n"
2821 "\\Zone{#1s}{\\Cs{field#1List}}{\\subsubsection{#2}\\Cs{field#1List}}%\n"
2822 "\\Member{#1}{\\Frame{\\Cs{field#1Type}{} \\Cs{field#1Name}}%\n"
2823 "\\Cs{field#1DetailedDoc}\\Cs{field#1See}\\vskip 5mm\\relax}}%\n"
2824 "\n"
2825 "\\def\\FunctionMemberList#1#2{%\n"
2826 "\\Defcs{#1PDParamName}##1{\\textit{##1}}%\n"
2827 "\\Defcs{#1PDParam}{\\Cs{field#1PDParamName}}%\n"
2828 "\\Defcs{#1PDParamsSep}{, }%\n"
2829 "\\Defcs{#1PDBlocksSep}{\\vskip 2mm\\relax}%\n"
2830 "%\n"
2831 "\\Defcs{#1PDBlocks}##1{%\n"
2832 "\\Heading{Parameters:}\\vskip 1.5mm\\relax\n"
2833 "\\DimenA0pt\\relax\n"
2834 "\\Defcs{#1PDBlock}{\\setbox\\BoxA\\hbox{\\Cs{field#1PDParams}}%\n"
2835 "\\ifdim\\DimenA<\\wd\\BoxA\\DimenA\\wd\\BoxA\\fi}%\n"
2836 "##1%\n"
2837 "\\advance\\DimenA3mm\\relax\n"
2838 "\\DimenB\\hsize\\advance\\DimenB-\\DimenA\\relax\n"
2839 "\\Defcs{#1PDBlock}{\\hbox to\\hsize{\\vtop{\\hsize\\DimenA\\relax\n"
2840 "\\Cs{field#1PDParams}}\\hfill\n"
2841 "\\vtop{\\hsize\\DimenB\\relax\\Cs{field#1PDDoc}}}}%\n"
2842 "##1}\n"
2843 "\n"
2844 "\\Defcs{#1ParamName}##1{\\textit{##1}}\n"
2845 "\\Defcs{#1Param}{\\Cs{field#1ParamType}{} \\Cs{field#1ParamName}}\n"
2846 "\\Defcs{#1ParamsSep}{, }\n"
2847 "\n"
2848 "\\Defcs{#1Name}##1{\\textbf{##1}}\n"
2849 "\\Defcs{#1See}##1{\\See{##1}}\n"
2850 "\\Defcs{#1Return}##1{\\Heading{Returns: }##1}\n"
2851 "\\Defcs{field#1Title}{\\Frame{\\Cs{field#1Type}{} \\Cs{field#1Name}(\\Cs{field#1Params})}}%\n"
2852 "%\n"
2853 "\\Zone{#1s}{\\Cs{field#1List}}{\\subsubsection{#2}\\Cs{field#1List}}%\n"
2854 "\\Member{#1}{%\n"
2855 "\\Cs{field#1Title}\\vskip 6mm\\relax\\Cs{field#1DetailedDoc}\n"
2856 "\\Cs{field#1Return}\\Cs{field#1PDBlocks}\\Cs{field#1See}\\vskip 5mm\\relax}}\n"
2857 "\n"
2858 "\\def\\FileDetailed{\\fieldFileDetailedDoc\\par}\n"
2859 "\\def\\ClassDetailed{\\fieldClassDetailedDoc\\par}\n"
2860 "\n"
2861 "\\def\\FileSubzones{\\fieldFileTypedefs\\fieldFileVariables\\fieldFileFunctions}\n"
2862 "\n"
2863 "\\def\\ClassSubzones{%\n"
2864 "\\fieldClassPublicTypedefs\\fieldClassPublicMembers\\fieldClassPublicMethods\n"
2865 "\\fieldClassProtectedTypedefs\\fieldClassProtectedMembers\\fieldClassProtectedMethods\n"
2866 "\\fieldClassPrivateTypedefs\\fieldClassPrivateMembers\\fieldClassPrivateMethods}\n"
2867 "\n"
2868 "\\Member{Page}{\\subsection{\\fieldPageName}\\fieldPageDetailedDoc}\n"
2869 "\n"
2870 "\\TypedefMemberList{FileTypedef}{Typedefs}\n"
2871 "\\VariableMemberList{FileVariable}{Variables}\n"
2872 "\\FunctionMemberList{FileFunction}{Functions}\n"
2873 "\\Zone{File}{\\FileSubzones}{\\subsection{\\fieldFileName}\\fieldFileDetailed\\FileSubzones}\n"
2874 "\n"
2875 "\\TypedefMemberList{ClassPublicTypedef}{Public Typedefs}\n"
2876 "\\TypedefMemberList{ClassProtectedTypedef}{Protected Typedefs}\n"
2877 "\\TypedefMemberList{ClassPrivateTypedef}{Private Typedefs}\n"
2878 "\\VariableMemberList{ClassPublicMember}{Public Members}\n"
2879 "\\VariableMemberList{ClassProtectedMember}{Protected Members}\n"
2880 "\\VariableMemberList{ClassPrivateMember}{Private Members}\n"
2881 "\\FunctionMemberList{ClassPublicMethod}{Public Methods}\n"
2882 "\\FunctionMemberList{ClassProtectedMethod}{Protected Methods}\n"
2883 "\\FunctionMemberList{ClassPrivateMethod}{Private Methods}\n"
2884 "\\Zone{Class}{\\ClassSubzones}{\\subsection{\\fieldClassName}\\fieldClassDetailed\\ClassSubzones}\n"
2885 "\n"
2886 "\\Zone{AllPages}{\\fieldPages}{\\section{Pages}\\fieldPages}\n"
2887 "\\Zone{AllFiles}{\\fieldFiles}{\\section{Files}\\fieldFiles}\n"
2888 "\\Zone{AllClasses}{\\fieldClasses}{\\section{Classes}\\fieldClasses}\n"
2889 "\n"
2890 "\\newlength{\\oldparskip}\n"
2891 "\\newlength{\\oldparindent}\n"
2892 "\\newlength{\\oldfboxrule}\n"
2893 "\n"
2894 "\\ZoneDepth0\\relax\n"
2895 "\\Letcs{Mode0}1\\relax\n"
2896 "\n"
2897 "\\def\\EmitDoxyDocs{%\n"
2898 "\\setlength{\\oldparskip}{\\parskip}\n"
2899 "\\setlength{\\oldparindent}{\\parindent}\n"
2900 "\\setlength{\\oldfboxrule}{\\fboxrule}\n"
2901 "\\setlength{\\parskip}{0cm}\n"
2902 "\\setlength{\\parindent}{0cm}\n"
2903 "\\setlength{\\fboxrule}{1pt}\n"
2904 "\\AllPages\\AllFiles\\AllClasses\n"
2905 "\\setlength{\\parskip}{\\oldparskip}\n"
2906 "\\setlength{\\parindent}{\\oldparindent}\n"
2907 "\\setlength{\\fboxrule}{\\oldfboxrule}}\n";
2908
2909 return true;
2910}
2911
2913{
2914 std::ofstream doxyLatexTexStream;
2915 if (!createOutputFile(doxyLatexTexStream, pathDoxyLatexTex))
2916 return false;
2917
2918 doxyLatexTexStream <<
2919 "\\documentclass[a4paper,12pt]{article}\n"
2920 "\\usepackage[latin1]{inputenc}\n"
2921 "\\usepackage[none]{hyphenat}\n"
2922 "\\usepackage[T1]{fontenc}\n"
2923 "\\usepackage{hyperref}\n"
2924 "\\usepackage{times}\n"
2925 "\n"
2926 "\\input{doxyformat}\n"
2927 "\n"
2928 "\\begin{document}\n"
2929 "\\input{" << pathDoxyDocsTex << "}\n"
2930 "\\sloppy\n"
2931 "\\EmitDoxyDocs\n"
2932 "\\end{document}\n";
2933
2934 return true;
2935}
2936
2938{
2939 // + classes
2940 // + namespaces
2941 // + files
2942 // - packages
2943 // + groups
2944 // + related pages
2945 // - examples
2946
2947 Dir perlModDir;
2948 if (!createOutputDir(perlModDir))
2949 return;
2950
2951 bool perlmodLatex = Config_getBool(PERLMOD_LATEX);
2952
2953 DString perlModAbsPath = perlModDir.absPath();
2954 pathDoxyDocsPM = perlModAbsPath + "/DoxyDocs.pm";
2955 pathDoxyStructurePM = perlModAbsPath + "/DoxyStructure.pm";
2956 pathMakefile = perlModAbsPath + "/Makefile";
2957 pathDoxyRules = perlModAbsPath + "/doxyrules.make";
2958
2959 if (perlmodLatex) {
2960 pathDoxyStructureTex = perlModAbsPath + "/doxystructure.tex";
2961 pathDoxyFormatTex = perlModAbsPath + "/doxyformat.tex";
2962 pathDoxyLatexTex = perlModAbsPath + "/doxylatex.tex";
2963 pathDoxyLatexDVI = perlModAbsPath + "/doxylatex.dvi";
2964 pathDoxyLatexPDF = perlModAbsPath + "/doxylatex.pdf";
2965 pathDoxyDocsTex = perlModAbsPath + "/doxydocs.tex";
2966 pathDoxyLatexPL = perlModAbsPath + "/doxylatex.pl";
2967 pathDoxyLatexStructurePL = perlModAbsPath + "/doxylatex-structure.pl";
2968 }
2969
2970 if (!(generatePerlModOutput()
2972 && generateMakefile()
2973 && generateDoxyRules()))
2974 return;
2975
2976 if (perlmodLatex) {
2981 return;
2982 }
2983}
2984
2986{
2987 PerlModGenerator pmg(Config_getBool(PERLMOD_PRETTY));
2988 pmg.generate();
2989}
2990
2991// Local Variables:
2992// c-basic-offset: 2
2993// End:
2994
2995/* This elisp function for XEmacs makes Control-Z transform
2996 the text in the region into a valid C string.
2997
2998 (global-set-key '(control z) (lambda () (interactive)
2999 (save-excursion
3000 (if (< (mark) (point)) (exchange-point-and-mark))
3001 (let ((start (point)) (replacers
3002 '(("\\\\" "\\\\\\\\")
3003 ("\"" "\\\\\"")
3004 ("\t" "\\\\t")
3005 ("^.*$" "\"\\&\\\\n\""))))
3006 (while replacers
3007 (while (re-search-forward (caar replacers) (mark) t)
3008 (replace-match (cadar replacers) t))
3009 (goto-char start)
3010 (setq replacers (cdr replacers)))))))
3011*/
constexpr auto prefix
Definition anchor.cpp:47
This class contains the information about the argument of a function or template.
Definition arguments.h:27
DString name
Definition arguments.h:45
DString type
Definition arguments.h:43
This class represents an function or template argument list.
Definition arguments.h:66
iterator end()
Definition arguments.h:95
bool hasParameters() const
Definition arguments.h:77
bool constSpecifier() const
Definition arguments.h:112
bool empty() const
Definition arguments.h:100
iterator begin()
Definition arguments.h:94
bool volatileSpecifier() const
Definition arguments.h:113
A abstract class representing of a compound symbol.
Definition classdef.h:100
virtual bool isAbstract() const =0
Returns true if there is at least one pure virtual member in this class.
virtual bool isFinal() const =0
Returns true if this class is marked as final.
virtual const ArgumentList & templateArguments() const =0
Returns the template arguments of this class.
virtual const BaseClassList & baseClasses() const =0
Returns the list of base classes from which this class directly inherits.
virtual bool isSealed() const =0
Returns true if this class is marked as sealed.
virtual DString compoundTypeString() const =0
Returns the type of compound as a string.
virtual MemberList * getMemberList(MemberListType lt) const =0
Returns the members in the list identified by lt.
virtual const ArgumentList & typeConstraints() const =0
virtual const MemberNameInfoLinkedMap & memberNameInfoLinkedMap() const =0
Returns a dictionary of all members.
virtual bool isImplicitTemplateInstance() const =0
virtual const MemberGroupList & getMemberGroups() const =0
Returns the member groups defined for this class.
virtual bool isRef() const =0
Returns true if this class is a C# ref struct or a C++/CLI ref class.
virtual ClassLinkedRefMap getClasses() const =0
returns the classes nested into this class
virtual const IncludeInfo * includeInfo() const =0
virtual const BaseClassList & subClasses() const =0
Returns the list of sub classes that directly derive from this class.
virtual DString initializer() const =0
virtual ArgumentList getTemplateParameterList() const =0
virtual const IncludeInfo * includeInfo() const =0
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition dstring.h:84
DString & setNum(short n)
Definition dstring.h:552
DString mid(size_t index, size_t len=npos) const
Definition dstring.h:318
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition dstring.h:148
char & at(size_t i)
Returns a reference to the character at index i.
Definition dstring.h:686
DString & sprintf(const char *format,...)
Definition dstring.cpp:34
DString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition dstring.h:337
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition dstring.h:157
The common base class of all entity definitions found in the sources.
Definition definition.h:77
virtual DString briefDescription(bool abbreviate=false) const =0
virtual int getEndBodyLine() const =0
virtual DString briefFile() const =0
virtual SrcLangExt getLanguage() const =0
Returns the programming language this definition was written in.
virtual int docLine() const =0
virtual DString getDefFileName() const =0
virtual DString documentation() const =0
virtual int getDefLine() const =0
virtual const DString & name() const =0
virtual int briefLine() const =0
virtual bool isAnonymous() const =0
virtual Definition * getOuterScope() const =0
virtual DString docFile() const =0
virtual int getStartBodyLine() const =0
virtual bool isReference() const =0
Class representing a directory in the file system.
Definition dir.h:73
static std::string currentDirPath()
Definition dir.cpp:347
std::string absPath() const
Definition dir.cpp:369
bool mkdir(const std::string &path, bool acceptsAbsPath=true) const
Definition dir.cpp:300
void setPath(const std::string &path)
Definition dir.cpp:234
bool exists() const
Definition dir.cpp:262
Node representing an anchor.
Definition docnode.h:229
DString anchor() const
Definition docnode.h:232
DString file() const
Definition docnode.h:233
Node representing an auto List.
Definition docnode.h:571
bool isCheckedList() const
Definition docnode.h:582
bool isEnumList() const
Definition docnode.h:580
Node representing an item of a auto list.
Definition docnode.h:595
int itemNumber() const
Definition docnode.h:598
Node representing a citation of some bibliographic reference.
Definition docnode.h:245
DString getText() const
Definition docnode.cpp:994
CiteInfoOption option() const
Definition docnode.h:253
DString target() const
Definition docnode.h:252
DString file() const
Definition docnode.h:248
Node representing a dia file.
Definition docnode.h:731
DString file() const
Definition docnode.h:685
Node representing a dot file.
Definition docnode.h:713
Node representing an emoji.
Definition docnode.h:341
int index() const
Definition docnode.h:345
DString name() const
Definition docnode.h:344
Node representing an item of a cross-referenced list.
Definition docnode.h:529
DString text() const
Definition docnode.h:533
int id() const
Definition docnode.h:535
Node representing a Hypertext reference.
Definition docnode.h:832
DString url() const
Definition docnode.h:839
Node representing a horizontal ruler.
Definition docnode.h:216
Node representing an HTML blockquote.
Definition docnode.h:1296
Node representing a HTML table caption.
Definition docnode.h:1233
Node representing a HTML table cell.
Definition docnode.h:1198
bool isHeading() const
Definition docnode.h:1205
Node representing a HTML description data.
Definition docnode.h:1186
Node representing a Html description list.
Definition docnode.h:910
Node representing a Html description item.
Definition docnode.h:897
Node Html details.
Definition docnode.h:866
Node Html heading.
Definition docnode.h:882
int level() const
Definition docnode.h:886
Node representing a Html list.
Definition docnode.h:1009
const HtmlAttribList & attribs() const
Definition docnode.h:1015
Type type() const
Definition docnode.h:1014
Node representing a HTML list item.
Definition docnode.h:1170
const HtmlAttribList & attribs() const
Definition docnode.h:1175
Node representing a HTML table row.
Definition docnode.h:1251
Node Html summary.
Definition docnode.h:853
Node representing a HTML table.
Definition docnode.h:1274
size_t numRows() const
Definition docnode.h:1278
const DocNodeVariant * caption() const
Definition docnode.cpp:2350
Node representing an image.
Definition docnode.h:642
Type type() const
Definition docnode.h:647
DString width() const
Definition docnode.h:650
DString name() const
Definition docnode.h:648
DString height() const
Definition docnode.h:651
Node representing a include/dontinclude operator block.
Definition docnode.h:477
Node representing an included text block from file.
Definition docnode.h:435
@ LatexInclude
Definition docnode.h:437
@ SnippetWithLines
Definition docnode.h:438
@ DontIncWithLines
Definition docnode.h:439
@ IncWithLines
Definition docnode.h:438
@ HtmlInclude
Definition docnode.h:437
@ VerbInclude
Definition docnode.h:437
@ DontInclude
Definition docnode.h:437
@ DocbookInclude
Definition docnode.h:439
Type type() const
Definition docnode.h:451
DString text() const
Definition docnode.h:452
Node representing an entry in the index.
Definition docnode.h:552
Node representing an internal section of documentation.
Definition docnode.h:978
Node representing an internal reference to some item.
Definition docnode.h:816
DString anchor() const
Definition docnode.h:822
DString file() const
Definition docnode.h:820
Node representing a line break.
Definition docnode.h:202
Node representing a word that can be linked to something.
Definition docnode.h:165
DString word() const
Definition docnode.h:170
DString anchor() const
Definition docnode.h:174
DString ref() const
Definition docnode.h:173
DString file() const
Definition docnode.h:171
Node representing a mermaid file.
Definition docnode.h:749
Node representing a msc file.
Definition docnode.h:722
Class representing the abstract syntax tree of a documentation block.
Definition docnode.h:1471
DocNodeVariant * parent()
Definition docnode.h:89
Node representing an block of paragraphs.
Definition docnode.h:988
Node representing a paragraph in the documentation tree.
Definition docnode.h:1089
Node representing a parameter list.
Definition docnode.h:1130
const DocNodeList & parameters() const
Definition docnode.h:1134
DocParamSect::Direction direction() const
Definition docnode.h:1138
const DocNodeList & paragraphs() const
Definition docnode.h:1136
Node representing a parameter section.
Definition docnode.h:1062
bool hasInOutSpecifier() const
Definition docnode.h:1078
Type type() const
Definition docnode.h:1077
Node representing a uml file.
Definition docnode.h:740
Node representing a reference to some item.
Definition docnode.h:787
bool hasLinkText() const
Definition docnode.h:797
DString targetTitle() const
Definition docnode.h:795
Root node of documentation tree.
Definition docnode.h:1318
Node representing a reference to a section.
Definition docnode.h:944
DString anchor() const
Definition docnode.h:949
DString file() const
Definition docnode.h:948
Node representing a list of section references.
Definition docnode.h:968
Node representing a normal section.
Definition docnode.h:923
int level() const
Definition docnode.h:927
const DocNodeVariant * title() const
Definition docnode.h:928
Node representing a separator.
Definition docnode.h:365
Node representing a simple list.
Definition docnode.h:999
Node representing a simple list item.
Definition docnode.h:1158
const DocNodeVariant * paragraph() const
Definition docnode.h:1162
Node representing a simple section.
Definition docnode.h:1026
Type type() const
Definition docnode.h:1035
const DocNodeVariant * title() const
Definition docnode.h:1042
Node representing a separator between two simple sections of the same type.
Definition docnode.h:1053
Node representing a style change.
Definition docnode.h:268
Style style() const
Definition docnode.h:307
bool enable() const
Definition docnode.h:309
Node representing a special symbol.
Definition docnode.h:328
HtmlEntityMapper::SymType symbol() const
Definition docnode.h:332
Root node of a text fragment.
Definition docnode.h:1309
Node representing a simple section title.
Definition docnode.h:608
Node representing a URL (or email address).
Definition docnode.h:188
DString url() const
Definition docnode.h:192
Node representing a verbatim, unparsed text fragment.
Definition docnode.h:376
DString text() const
Definition docnode.h:383
bool hasCaption() const
Definition docnode.h:390
Type type() const
Definition docnode.h:382
DString context() const
Definition docnode.h:384
@ JavaDocLiteral
Definition docnode.h:378
Node representing a VHDL flow chart.
Definition docnode.h:758
Helper base class for functionality shared by all visitors.
Definition docvisitor.h:29
Node representing some amount of white space.
Definition docnode.h:354
Node representing a word.
Definition docnode.h:153
DString word() const
Definition docnode.h:156
Node representing an item of a cross-referenced list.
Definition docnode.h:621
DString anchor() const
Definition docnode.h:625
DString file() const
Definition docnode.h:624
DString title() const
Definition docnode.h:626
Representation of a class inheritance or dependency graph.
bool isTrivial() const
static NamespaceLinkedMap * namespaceLinkedMap
Definition doxygen.h:108
static ConceptLinkedMap * conceptLinkedMap
Definition doxygen.h:90
static std::unique_ptr< PageDef > mainPage
Definition doxygen.h:93
static FileNameLinkedMap * inputNameLinkedMap
Definition doxygen.h:97
static ClassLinkedMap * classLinkedMap
Definition doxygen.h:88
static PageLinkedMap * pageLinkedMap
Definition doxygen.h:92
static GroupLinkedMap * groupLinkedMap
Definition doxygen.h:107
const char * name(int index) const
Access routine to the name of the Emoji entity.
Definition emoji.cpp:2029
static EmojiEntityMapper & instance()
Returns the one and only instance of the Emoji entity mapper.
Definition emoji.cpp:1981
A model of a file symbol.
Definition filedef.h:97
virtual const MemberGroupList & getMemberGroups() const =0
virtual const DString & docName() const =0
virtual const IncludeInfoList & includeFileList() const =0
virtual MemberList * getMemberList(MemberListType lt) const =0
virtual const IncludeInfoList & includedByFileList() const =0
A model of a group of symbols.
Definition groupdef.h:48
virtual DString groupTitle() const =0
virtual const GroupList & getSubGroups() const =0
virtual const FileList & getFiles() const =0
virtual const MemberGroupList & getMemberGroups() const =0
virtual const ConceptLinkedRefMap & getConcepts() const =0
virtual const PageLinkedRefMap & getPages() const =0
virtual const NamespaceLinkedRefMap & getNamespaces() const =0
virtual const ClassLinkedRefMap & getClasses() const =0
virtual MemberList * getMemberList(MemberListType lt) const =0
virtual const ModuleLinkedRefMap & getModules() const =0
const PerlSymb * perl(SymType symb) const
Access routine to the perl struct with the perl code of the HTML entity.
static HtmlEntityMapper & instance()
Returns the one and only instance of the HTML entity mapper.
Class representing the data associated with a #include statement.
Definition filedef.h:72
IncludeKind kind
Definition filedef.h:79
const FileDef * fileDef
Definition filedef.h:77
DString includeName
Definition filedef.h:78
const T * find(const std::string &key) const
Definition linkedmap.h:47
bool empty() const
Definition linkedmap.h:374
A model of a class/file/namespace member symbol.
Definition memberdef.h:45
virtual bool isInitonly() const =0
virtual DString argsString() const =0
virtual const ClassDef * getClassDef() const =0
virtual DString excpString() const =0
virtual const DString & initializer() const =0
virtual bool isSettable() const =0
virtual const MemberVector & enumFieldList() const =0
virtual const ArgumentList & argumentList() const =0
virtual bool isWritable() const =0
virtual bool isPrivateGettable() const =0
virtual const MemberVector & reimplementedBy() const =0
virtual DString bitfieldString() const =0
virtual bool isStatic() const =0
virtual const MemberDef * reimplements() const =0
virtual bool isPrivateSettable() const =0
virtual bool isProtectedSettable() const =0
virtual bool isProtectedGettable() const =0
virtual Protection protection() const =0
virtual bool isGettable() const =0
virtual MemberType memberType() const =0
virtual bool isReadable() const =0
virtual DString enumBaseType() const =0
virtual DString typeString() const =0
virtual Specifier virtualness(int count=0) const =0
virtual const ArgumentList & declArgumentList() const =0
A list of MemberDef objects as shown in documentation sections.
Definition memberlist.h:126
A vector of MemberDef object.
Definition memberlist.h:36
bool empty() const noexcept
Definition memberlist.h:61
virtual MemberList * getMemberList(MemberListType lt) const =0
virtual const MemberGroupList & getMemberGroups() const =0
virtual FileList getUsedFiles() const =0
virtual const ConceptLinkedRefMap & getConcepts() const =0
virtual const ClassLinkedRefMap & getClasses() const =0
static ModuleManager & instance()
An abstract interface of a namespace symbol.
virtual MemberList * getMemberList(MemberListType lt) const =0
virtual NamespaceLinkedRefMap getNamespaces() const =0
virtual ClassLinkedRefMap getClasses() const =0
virtual const MemberGroupList & getMemberGroups() const =0
A model of a page symbol.
Definition pagedef.h:27
Concrete visitor implementation for PerlMod output.
void openItem(const DString &)
PerlModDocVisitor(PerlModOutput &)
void visitChildren(const T &t)
void openSubBlock(const DString &=DString())
void addLink(const DString &ref, const DString &file, const DString &anchor)
PerlModOutput & m_output
void singleItem(const DString &)
void operator()(const DocWord &)
void generatePerlModForPage(PageDef *pi)
DString pathDoxyLatexStructurePL
DString pathDoxyStructureTex
PerlModOutput m_output
void generatePerlModForMember(const MemberDef *md, const Definition *)
bool generateDoxyFormatTex()
bool generateDoxyLatexTex()
bool createOutputDir(Dir &perlModDir)
void generatePerlModForClass(const ClassDef *cd)
bool generatePerlModOutput()
void generatePerlModForModule(const ModuleDef *mod)
DString pathDoxyFormatTex
DString pathDoxyStructurePM
void generatePerlModForNamespace(const NamespaceDef *nd)
void generatePerlModSection(const Definition *d, MemberList *ml, const DString &name, const DString &header=DString())
PerlModGenerator(bool pretty)
void addIncludeInfo(const IncludeInfo *ii)
void addListOfAllMembers(const ClassDef *cd)
bool generateDoxyStructurePM()
void generatePerlModForGroup(const GroupDef *gd)
void generatePerlModForFile(const FileDef *fd)
void generatePerlModForConcept(const ConceptDef *cd)
bool generateDoxyLatexStructurePL()
void generatePerlUserDefinedSection(const Definition *d, const MemberGroupList &mgl)
bool createOutputFile(std::ofstream &f, const DString &s)
PerlModOutput & closeList()
PerlModOutput & add(char c)
char m_spaces[PERLOUTPUT_MAX_INDENTATION *2+2]
virtual ~PerlModOutput()
PerlModOutput & addQuoted(const DString &s)
PerlModOutput(bool pretty)
PerlModOutput & addFieldQuotedString(const DString &field, const DString &content)
void iaddQuoted(const DString &)
PerlModOutputStream * m_stream
PerlModOutput & open(char c, const DString &s=DString())
PerlModOutput & add(DString &s)
PerlModOutput & continueBlock()
PerlModOutput & add(int n)
PerlModOutput & openList(const DString &s=DString())
void iaddField(const DString &)
PerlModOutput & addFieldBoolean(const DString &field, bool content)
void iaddFieldQuotedString(const DString &, const DString &)
void iaddFieldQuotedChar(const DString &, char)
PerlModOutput & openHash(const DString &s=DString())
PerlModOutput & add(const DString &s)
void iopen(char, const DString &)
void setPerlModOutputStream(PerlModOutputStream *os)
PerlModOutput & close(char c=0)
PerlModOutput & closeHash()
void iclose(char)
PerlModOutput & addFieldQuotedChar(const DString &field, char content)
PerlModOutput & indent()
PerlModOutput & addField(const DString &s)
PerlModOutput & add(unsigned int n)
std::ostream * m_t
PerlModOutputStream(std::ostream &t)
class that provide information about a section.
Definition section.h:58
DString title() const
Definition section.h:70
static SectionManager & instance()
returns a reference to the singleton
Definition section.h:179
#define Config_getBool(name)
Definition config.h:33
#define Config_getString(name)
Definition config.h:32
#define NON_COPYABLE(cls)
Macro to help implementing the rule of 5 for a non-copyable & movable class.
Definition construct.h:37
IDocParserPtr createDocParser()
factory function to create a parser
Definition docparser.cpp:59
IDocNodeASTPtr validatingParseDoc(IDocParser &parserIntf, const DString &fileName, int startLine, const Definition *ctx, const MemberDef *md, const DString &input, const DocOptions &options)
const char * qPrint(const char *s)
Definition dstring.h:783
@ ImportLocal
Definition filedef.h:51
@ IncludeLocal
Definition filedef.h:47
#define err(fmt,...)
Definition message.h:127
std::ofstream openOutputStream(const DString &name, bool append=false)
Definition portable.cpp:679
static void addTemplateArgumentList(const ArgumentList &al, PerlModOutput &output, const DString &, const ArgumentList &typeConstraints=ArgumentList())
void generatePerlMod()
static const char * getVirtualnessName(Specifier virt)
static void addTemplateList(const ClassDef *cd, PerlModOutput &output)
static DString pathDoxyExec
void setPerlModDoxyfile(const DString &qs)
static const char * getProtectionName(Protection prot)
static DString pathDoxyfile
static void addPerlModDocBlock(PerlModOutput &output, const DString &name, const DString &fileName, int lineNr, const Definition *scope, const MemberDef *md, const DString &text)
#define PERLOUTPUT_MAX_INDENTATION
Portable versions of functions that are platform dependent.
Helper class to pass options when calling OutputList::generateDoc().
Definition docoptions.h:24
Protection
Definition types.h:32
Specifier
Definition types.h:80
DString filterTitle(const DString &title)
Definition util.cpp:4590
A bunch of utility functions.