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{
1358 if (!al.hasParameters()) return;
1359 output.openList("template_parameters");
1360 for (const Argument &a : al)
1361 {
1362 output.openHash();
1363 if (!a.type.empty())
1364 output.addFieldQuotedString("type", a.type);
1365 if (!a.name.empty())
1366 output.addFieldQuotedString("declaration_name", a.name)
1367 .addFieldQuotedString("definition_name", a.name);
1368 if (!a.defval.empty())
1369 output.addFieldQuotedString("default", a.defval);
1370 output.closeHash();
1371 }
1372 output.closeList();
1373}
1374
1375static void addTemplateList(const ClassDef *cd,PerlModOutput &output)
1376{
1378}
1379
1380static void addTemplateList(const ConceptDef *cd,PerlModOutput &output)
1381{
1383}
1384
1386 const DString &name,
1387 const DString &fileName,
1388 int lineNr,
1389 const Definition *scope,
1390 const MemberDef *md,
1391 const DString &text)
1392{
1393 DString stext = text.stripWhiteSpace();
1394 if (stext.empty())
1395 {
1396 output.addField(name).add("{}");
1397 }
1398 else
1399 {
1400 auto parser { createDocParser() };
1401 auto ast { validatingParseDoc(*parser.get(),
1402 fileName,
1403 lineNr,
1404 scope,
1405 md,
1406 stext,
1407 DocOptions())
1408 };
1409 output.openHash(name);
1410 auto astImpl = dynamic_cast<const DocNodeAST*>(ast.get());
1411 if (astImpl)
1412 {
1413 PerlModDocVisitor visitor(output);
1414 std::visit(visitor,astImpl->root);
1415 visitor.finish();
1416 }
1417 output.closeHash();
1418 }
1419}
1420
1421static const char *getProtectionName(Protection prot)
1422{
1423 return to_string_lower(prot);
1424}
1425
1426static const char *getVirtualnessName(Specifier virt)
1427{
1428 return to_string_lower(virt);
1429}
1430
1433
1435{
1436 pathDoxyfile = qs;
1438}
1439
1441{
1442public:
1443
1445
1458
1459 inline PerlModGenerator(bool pretty) : m_output(pretty) { }
1460
1461 void generatePerlModForMember(const MemberDef *md, const Definition *);
1463 void generatePerlModSection(const Definition *d, MemberList *ml,
1464 const DString &name, const DString &header=DString());
1465 void addListOfAllMembers(const ClassDef *cd);
1466 void addIncludeInfo(const IncludeInfo *ii);
1467 void generatePerlModForClass(const ClassDef *cd);
1468 void generatePerlModForConcept(const ConceptDef *cd);
1469 void generatePerlModForModule(const ModuleDef *mod);
1471 void generatePerlModForFile(const FileDef *fd);
1472 void generatePerlModForGroup(const GroupDef *gd);
1474
1475 bool createOutputFile(std::ofstream &f, const DString &s);
1476 bool createOutputDir(Dir &perlModDir);
1477 bool generateDoxyLatexTex();
1478 bool generateDoxyFormatTex();
1480 bool generateDoxyLatexPL();
1482 bool generateDoxyRules();
1483 bool generateMakefile();
1484 bool generatePerlModOutput();
1485
1486 void generate();
1487};
1488
1490{
1491 // + declaration/definition arg lists
1492 // + reimplements
1493 // + reimplementedBy
1494 // + exceptions
1495 // + const/volatile specifiers
1496 // - examples
1497 // - source definition
1498 // - source references
1499 // - source referenced by
1500 // - body code
1501 // - template arguments
1502 // (templateArguments(), definitionTemplateParameterLists())
1503
1504 DString memType = to_string_lower(md->memberType());
1505 DString name;
1506 bool isFunc=to_isFunction(md->memberType());
1507
1508 bool isFortran = md->getLanguage()==SrcLangExt::Fortran;
1509 name = md->name();
1510 if (md->isAnonymous()) name = "__unnamed" + name.mid(1)+"__";
1511
1513 .addFieldQuotedString("kind", memType)
1514 .addFieldQuotedString("name", name)
1517 .addFieldBoolean("static", md->isStatic());
1518
1520 addPerlModDocBlock(m_output,"detailed",md->docFile(),md->docLine(),md->getOuterScope(),md,md->documentation());
1521 if (md->memberType()!=MemberType::Define &&
1522 md->memberType()!=MemberType::Enumeration)
1524
1525 const ArgumentList &al = md->argumentList();
1526 if (isFunc) //function
1527 {
1529 .addFieldBoolean("volatile", al.volatileSpecifier());
1530
1531 m_output.openList("parameters");
1532 const ArgumentList &declAl = md->declArgumentList();
1533 if (!declAl.empty())
1534 {
1535 auto defIt = al.begin();
1536 for (const Argument &a : declAl)
1537 {
1538 const Argument *defArg = nullptr;
1539 if (defIt!=al.end())
1540 {
1541 defArg = &(*defIt);
1542 ++defIt;
1543 }
1545
1546 if (!a.name.empty())
1547 m_output.addFieldQuotedString("declaration_name", a.name);
1548
1549 if (defArg && !defArg->name.empty() && defArg->name!=a.name)
1550 m_output.addFieldQuotedString("definition_name", defArg->name);
1551
1552 if (isFortran && defArg && !defArg->type.empty())
1553 m_output.addFieldQuotedString("type", defArg->type);
1554 else if (!a.type.empty())
1555 m_output.addFieldQuotedString("type", a.type);
1556
1557 if (!a.array.empty())
1558 m_output.addFieldQuotedString("array", a.array);
1559
1560 if (!a.defval.empty())
1561 m_output.addFieldQuotedString("default_value", a.defval);
1562
1563 if (!a.attrib.empty())
1564 m_output.addFieldQuotedString("attributes", a.attrib);
1565
1567 }
1568 }
1570 }
1571 else if (md->memberType()==MemberType::Define &&
1572 md->argsString()!=nullptr) // define
1573 {
1574 m_output.openList("parameters");
1575 for (const Argument &a : al)
1576 {
1578 .addFieldQuotedString("name", a.type)
1579 .closeHash();
1580 }
1582 }
1583 else if (md->argsString()!=nullptr)
1584 {
1585 m_output.addFieldQuotedString("arguments", md->argsString());
1586 }
1587
1588 if (!md->initializer().empty())
1589 m_output.addFieldQuotedString("initializer", md->initializer());
1590
1591 if (!md->excpString().empty())
1592 m_output.addFieldQuotedString("exceptions", md->excpString());
1593
1594 if (md->memberType()==MemberType::Enumeration) // enum
1595 {
1596 const MemberVector &enumFields = md->enumFieldList();
1598 if (!enumFields.empty())
1599 {
1600 m_output.openList("values");
1601 for (const auto &emd : enumFields)
1602 {
1604 .addFieldQuotedString("name", emd->name());
1605
1606 if (!emd->initializer().empty())
1607 m_output.addFieldQuotedString("initializer", emd->initializer());
1608
1609 addPerlModDocBlock(m_output,"brief",emd->briefFile(),emd->briefLine(),emd->getOuterScope(),emd,emd->briefDescription());
1610
1611 addPerlModDocBlock(m_output,"detailed",emd->docFile(),emd->docLine(),emd->getOuterScope(),emd,emd->documentation());
1612
1614 }
1616 }
1617 }
1618
1619 if (md->memberType() == MemberType::Variable && !md->bitfieldString().empty())
1620 {
1621 DString bitfield = md->bitfieldString();
1622 if (bitfield.at(0) == ':') bitfield = bitfield.mid(1);
1623 m_output.addFieldQuotedString("bitfield", bitfield);
1624 }
1625
1626 const MemberDef *rmd = md->reimplements();
1627 if (rmd)
1628 m_output.openHash("reimplements")
1629 .addFieldQuotedString("name", rmd->name())
1630 .closeHash();
1631
1632 const MemberVector &rbml = md->reimplementedBy();
1633 if (!rbml.empty())
1634 {
1635 m_output.openList("reimplemented_by");
1636 for (const auto &rbmd : rbml)
1638 .addFieldQuotedString("name", rbmd->name())
1639 .closeHash();
1641 }
1642
1644}
1645
1647 MemberList *ml,const DString &name,const DString &header)
1648{
1649 if (ml==nullptr) return; // empty list
1650
1651 m_output.openHash(name);
1652
1653 if (!header.empty())
1654 m_output.addFieldQuotedString("header", header);
1655
1656 m_output.openList("members");
1657 for (const auto &md : *ml)
1658 {
1660 }
1662 .closeHash();
1663}
1664
1666{
1667 m_output.openList("all_members");
1668 for (auto &mni : cd->memberNameInfoLinkedMap())
1669 {
1670 for (auto &mi : *mni)
1671 {
1672 const MemberDef *md=mi->memberDef();
1673 const ClassDef *mcd=md->getClassDef();
1674
1676 .addFieldQuotedString("name", md->name())
1678 .addFieldQuotedString("protection", getProtectionName(mi->prot()));
1679
1680 if (!mi->ambiguityResolutionScope().empty())
1681 m_output.addFieldQuotedString("ambiguity_scope", mi->ambiguityResolutionScope());
1682
1683 m_output.addFieldQuotedString("scope", mcd->name())
1684 .closeHash();
1685 }
1686 }
1688}
1689
1691{
1692 if (!mgl.empty())
1693 {
1694 m_output.openList("user_defined");
1695 for (const auto &mg : mgl)
1696 {
1698 if (!mg->header().empty())
1699 {
1700 m_output.addFieldQuotedString("header", mg->header());
1701 }
1702
1703 if (!mg->members().empty())
1704 {
1705 m_output.openList("members");
1706 for (const auto &md : mg->members())
1707 {
1709 }
1711 }
1713 }
1715 }
1716}
1717
1719{
1720 if (ii)
1721 {
1722 DString nm = ii->includeName;
1723 if (nm.empty() && ii->fileDef) nm = ii->fileDef->docName();
1724 if (!nm.empty())
1725 {
1726 m_output.openHash("includes");
1728 .addFieldQuotedString("name", nm)
1729 .closeHash();
1730 }
1731 }
1732}
1733
1735{
1736 // + brief description
1737 // + detailed description
1738 // + template argument list(s)
1739 // - include file
1740 // + member groups
1741 // + inheritance diagram
1742 // + list of direct super classes
1743 // + list of direct sub classes
1744 // + list of inner classes
1745 // + collaboration diagram
1746 // + list of all members
1747 // + user defined member sections
1748 // + standard member sections
1749 // + detailed member documentation
1750 // - examples using the class
1751
1752 if (cd->isReference()) return; // skip external references.
1753 if (cd->isAnonymous()) return; // skip anonymous compounds.
1754 if (cd->isImplicitTemplateInstance()) return; // skip generated template instances.
1755
1757 .addFieldQuotedString("name", cd->name());
1758 /* DGA: fix # #7547 Perlmod does not generate "kind" information to discriminate struct/union */
1760
1761 if (!cd->baseClasses().empty())
1762 {
1763 m_output.openList("base");
1764 for (const auto &bcd : cd->baseClasses())
1765 {
1767 .addFieldQuotedString("name", bcd.classDef->displayName())
1768 .addFieldQuotedString("virtualness", getVirtualnessName(bcd.virt))
1769 .addFieldQuotedString("protection", getProtectionName(bcd.prot))
1770 .closeHash();
1771 }
1773 }
1774
1775 if (!cd->subClasses().empty())
1776 {
1777 m_output.openList("derived");
1778 for (const auto &bcd : cd->subClasses())
1779 {
1781 .addFieldQuotedString("name", bcd.classDef->displayName())
1782 .addFieldQuotedString("virtualness", getVirtualnessName(bcd.virt))
1783 .addFieldQuotedString("protection", getProtectionName(bcd.prot))
1784 .closeHash();
1785 }
1787 }
1788
1789 {
1790 m_output.openList("inner");
1791 for (const auto &icd : cd->getClasses())
1793 .addFieldQuotedString("name", icd->name())
1794 .closeHash();
1796 }
1797
1799
1803
1804 generatePerlModSection(cd,cd->getMemberList(MemberListType::PubTypes()),"public_typedefs");
1805 generatePerlModSection(cd,cd->getMemberList(MemberListType::PubMethods()),"public_methods");
1806 generatePerlModSection(cd,cd->getMemberList(MemberListType::PubAttribs()),"public_members");
1807 generatePerlModSection(cd,cd->getMemberList(MemberListType::PubSlots()),"public_slots");
1808 generatePerlModSection(cd,cd->getMemberList(MemberListType::Signals()),"signals");
1809 generatePerlModSection(cd,cd->getMemberList(MemberListType::DcopMethods()),"dcop_methods");
1810 generatePerlModSection(cd,cd->getMemberList(MemberListType::Properties()),"properties");
1811 generatePerlModSection(cd,cd->getMemberList(MemberListType::PubStaticMethods()),"public_static_methods");
1812 generatePerlModSection(cd,cd->getMemberList(MemberListType::PubStaticAttribs()),"public_static_members");
1813 generatePerlModSection(cd,cd->getMemberList(MemberListType::ProTypes()),"protected_typedefs");
1814 generatePerlModSection(cd,cd->getMemberList(MemberListType::ProMethods()),"protected_methods");
1815 generatePerlModSection(cd,cd->getMemberList(MemberListType::ProAttribs()),"protected_members");
1816 generatePerlModSection(cd,cd->getMemberList(MemberListType::ProSlots()),"protected_slots");
1817 generatePerlModSection(cd,cd->getMemberList(MemberListType::ProStaticMethods()),"protected_static_methods");
1818 generatePerlModSection(cd,cd->getMemberList(MemberListType::ProStaticAttribs()),"protected_static_members");
1819 generatePerlModSection(cd,cd->getMemberList(MemberListType::PriTypes()),"private_typedefs");
1820 generatePerlModSection(cd,cd->getMemberList(MemberListType::PriMethods()),"private_methods");
1821 generatePerlModSection(cd,cd->getMemberList(MemberListType::PriAttribs()),"private_members");
1822 generatePerlModSection(cd,cd->getMemberList(MemberListType::PriSlots()),"private_slots");
1823 generatePerlModSection(cd,cd->getMemberList(MemberListType::PriStaticMethods()),"private_static_methods");
1824 generatePerlModSection(cd,cd->getMemberList(MemberListType::PriStaticAttribs()),"private_static_members");
1825 generatePerlModSection(cd,cd->getMemberList(MemberListType::Friends()),"friend_methods");
1826 generatePerlModSection(cd,cd->getMemberList(MemberListType::Related()),"related_methods");
1827
1828 addPerlModDocBlock(m_output,"brief",cd->briefFile(),cd->briefLine(),cd,nullptr,cd->briefDescription());
1829 addPerlModDocBlock(m_output,"detailed",cd->docFile(),cd->docLine(),cd,nullptr,cd->documentation());
1830
1831#if 0
1832 DotClassGraph inheritanceGraph(cd,DotClassGraph::Inheritance);
1833 if (!inheritanceGraph.isTrivial())
1834 {
1835 t << " <inheritancegraph>" << endl;
1836 inheritanceGraph.writePerlMod(t);
1837 t << " </inheritancegraph>" << endl;
1838 }
1839 DotClassGraph collaborationGraph(cd,DotClassGraph::Implementation);
1840 if (!collaborationGraph.isTrivial())
1841 {
1842 t << " <collaborationgraph>" << endl;
1843 collaborationGraph.writePerlMod(t);
1844 t << " </collaborationgraph>" << endl;
1845 }
1846 t << " <location file=\""
1847 << cd->getDefFileName() << "\" line=\""
1848 << cd->getDefLine() << "\"";
1849 if (cd->getStartBodyLine()!=-1)
1850 {
1851 t << " bodystart=\"" << cd->getStartBodyLine() << "\" bodyend=\""
1852 << cd->getEndBodyLine() << "\"";
1853 }
1854 t << "/>" << endl;
1855#endif
1856
1858}
1859
1861{
1862 if (cd->isReference()) return; // skip external references
1863
1865 .addFieldQuotedString("name", cd->name());
1866
1869 m_output.addFieldQuotedString("initializer", cd->initializer());
1870 addPerlModDocBlock(m_output,"brief",cd->briefFile(),cd->briefLine(),nullptr,nullptr,cd->briefDescription());
1871 addPerlModDocBlock(m_output,"detailed",cd->docFile(),cd->docLine(),nullptr,nullptr,cd->documentation());
1872
1874}
1875
1877{
1878 // + contained class definitions
1879 // + contained concept definitions
1880 // + member groups
1881 // + normal members
1882 // + brief desc
1883 // + detailed desc
1884 // + location (file_id, line, column)
1885 // - exports
1886 // + used files
1887
1888 if (mod->isReference()) return; // skip external references
1889
1891 .addFieldQuotedString("name", mod->name());
1892
1894
1895 if (!mod->getClasses().empty())
1896 {
1897 m_output.openList("classes");
1898 for (const auto &cd : mod->getClasses())
1900 .addFieldQuotedString("name", cd->name())
1901 .closeHash();
1903 }
1904
1905 if (!mod->getConcepts().empty())
1906 {
1907 m_output.openList("concepts");
1908 for (const auto &cd : mod->getConcepts())
1910 .addFieldQuotedString("name", cd->name())
1911 .closeHash();
1913 }
1914
1915 generatePerlModSection(mod,mod->getMemberList(MemberListType::DecTypedefMembers()),"typedefs");
1916 generatePerlModSection(mod,mod->getMemberList(MemberListType::DecEnumMembers()),"enums");
1917 generatePerlModSection(mod,mod->getMemberList(MemberListType::DecFuncMembers()),"functions");
1918 generatePerlModSection(mod,mod->getMemberList(MemberListType::DecVarMembers()),"variables");
1919
1920 addPerlModDocBlock(m_output,"brief",mod->briefFile(),mod->briefLine(),nullptr,nullptr,mod->briefDescription());
1921 addPerlModDocBlock(m_output,"detailed",mod->docFile(),mod->docLine(),nullptr,nullptr,mod->documentation());
1922
1923 if (!mod->getUsedFiles().empty())
1924 {
1925 m_output.openList("files");
1926 for (const auto &fd : mod->getUsedFiles())
1928 .addFieldQuotedString("name", fd->name())
1929 .closeHash();
1931 }
1932
1934}
1935
1937{
1938 // + contained class definitions
1939 // + contained namespace definitions
1940 // + member groups
1941 // + normal members
1942 // + brief desc
1943 // + detailed desc
1944 // + location
1945 // - files containing (parts of) the namespace definition
1946
1947 if (nd->isReference()) return; // skip external references
1948
1950 .addFieldQuotedString("name", nd->name());
1951
1952 if (!nd->getClasses().empty())
1953 {
1954 m_output.openList("classes");
1955 for (const auto &cd : nd->getClasses())
1957 .addFieldQuotedString("name", cd->name())
1958 .closeHash();
1960 }
1961
1962 if (!nd->getNamespaces().empty())
1963 {
1964 m_output.openList("namespaces");
1965 for (const auto &ind : nd->getNamespaces())
1967 .addFieldQuotedString("name", ind->name())
1968 .closeHash();
1970 }
1971
1973
1974 generatePerlModSection(nd,nd->getMemberList(MemberListType::DecDefineMembers()),"defines");
1975 generatePerlModSection(nd,nd->getMemberList(MemberListType::DecProtoMembers()),"prototypes");
1976 generatePerlModSection(nd,nd->getMemberList(MemberListType::DecTypedefMembers()),"typedefs");
1977 generatePerlModSection(nd,nd->getMemberList(MemberListType::DecEnumMembers()),"enums");
1978 generatePerlModSection(nd,nd->getMemberList(MemberListType::DecFuncMembers()),"functions");
1979 generatePerlModSection(nd,nd->getMemberList(MemberListType::DecVarMembers()),"variables");
1980
1981 addPerlModDocBlock(m_output,"brief",nd->briefFile(),nd->briefLine(),nullptr,nullptr,nd->briefDescription());
1982 addPerlModDocBlock(m_output,"detailed",nd->docFile(),nd->docLine(),nullptr,nullptr,nd->documentation());
1983
1985}
1986
1988{
1989 // + includes files
1990 // + includedby files
1991 // - include graph
1992 // - included by graph
1993 // - contained class definitions
1994 // - contained namespace definitions
1995 // - member groups
1996 // + normal members
1997 // + brief desc
1998 // + detailed desc
1999 // - source code
2000 // - location
2001 // - number of lines
2002
2003 if (fd->isReference()) return;
2004
2006 .addFieldQuotedString("name", fd->name());
2007
2008 m_output.openList("includes");
2009 for (const auto &inc: fd->includeFileList())
2010 {
2012 .addFieldQuotedString("name", inc.includeName);
2013 if (inc.fileDef && !inc.fileDef->isReference())
2014 {
2015 m_output.addFieldQuotedString("ref", inc.fileDef->getOutputFileBase());
2016 }
2018 }
2020
2021 m_output.openList("included_by");
2022 for (const auto &inc : fd->includedByFileList())
2023 {
2025 .addFieldQuotedString("name", inc.includeName);
2026 if (inc.fileDef && !inc.fileDef->isReference())
2027 {
2028 m_output.addFieldQuotedString("ref", inc.fileDef->getOutputFileBase());
2029 }
2031 }
2033
2035
2036 generatePerlModSection(fd,fd->getMemberList(MemberListType::DecDefineMembers()),"defines");
2037 generatePerlModSection(fd,fd->getMemberList(MemberListType::DecProtoMembers()),"prototypes");
2038 generatePerlModSection(fd,fd->getMemberList(MemberListType::DecTypedefMembers()),"typedefs");
2039 generatePerlModSection(fd,fd->getMemberList(MemberListType::DecEnumMembers()),"enums");
2040 generatePerlModSection(fd,fd->getMemberList(MemberListType::DecFuncMembers()),"functions");
2041 generatePerlModSection(fd,fd->getMemberList(MemberListType::DecVarMembers()),"variables");
2042
2043 addPerlModDocBlock(m_output,"brief",fd->briefFile(),fd->briefLine(),nullptr,nullptr,fd->briefDescription());
2044 addPerlModDocBlock(m_output,"detailed",fd->docFile(),fd->docLine(),nullptr,nullptr,fd->documentation());
2045
2047}
2048
2050{
2051 // + members
2052 // + member groups
2053 // + files
2054 // + classes
2055 // + namespaces
2056 // - packages
2057 // + pages
2058 // + child groups
2059 // - examples
2060 // + brief description
2061 // + detailed description
2062
2063 if (gd->isReference()) return; // skip external references
2064
2066 .addFieldQuotedString("name", gd->name())
2067 .addFieldQuotedString("title", gd->groupTitle());
2068
2069 if (!gd->getFiles().empty())
2070 {
2071 m_output.openList("files");
2072 for (const auto &fd : gd->getFiles())
2074 .addFieldQuotedString("name", fd->name())
2075 .closeHash();
2077 }
2078
2079 if (!gd->getClasses().empty())
2080 {
2081 m_output.openList("classes");
2082 for (const auto &cd : gd->getClasses())
2084 .addFieldQuotedString("name", cd->name())
2085 .closeHash();
2087 }
2088
2089 if (!gd->getConcepts().empty())
2090 {
2091 m_output.openList("concepts");
2092 for (const auto &cd : gd->getConcepts())
2094 .addFieldQuotedString("name", cd->name())
2095 .closeHash();
2097 }
2098
2099 if (!gd->getModules().empty())
2100 {
2101 m_output.openList("modules");
2102 for (const auto &mod : gd->getModules())
2104 .addFieldQuotedString("name", mod->name())
2105 .closeHash();
2107 }
2108
2109 if (!gd->getNamespaces().empty())
2110 {
2111 m_output.openList("namespaces");
2112 for (const auto &nd : gd->getNamespaces())
2114 .addFieldQuotedString("name", nd->name())
2115 .closeHash();
2117 }
2118
2119 if (!gd->getPages().empty())
2120 {
2121 m_output.openList("pages");
2122 for (const auto &pd : gd->getPages())
2124 .addFieldQuotedString("title", pd->title())
2125 .closeHash();
2127 }
2128
2129 if (!gd->getSubGroups().empty())
2130 {
2131 m_output.openList("groups");
2132 for (const auto &sgd : gd->getSubGroups())
2134 .addFieldQuotedString("title", sgd->groupTitle())
2135 .closeHash();
2137 }
2138
2140
2141 generatePerlModSection(gd,gd->getMemberList(MemberListType::DecDefineMembers()),"defines");
2142 generatePerlModSection(gd,gd->getMemberList(MemberListType::DecProtoMembers()),"prototypes");
2143 generatePerlModSection(gd,gd->getMemberList(MemberListType::DecTypedefMembers()),"typedefs");
2144 generatePerlModSection(gd,gd->getMemberList(MemberListType::DecEnumMembers()),"enums");
2145 generatePerlModSection(gd,gd->getMemberList(MemberListType::DecFuncMembers()),"functions");
2146 generatePerlModSection(gd,gd->getMemberList(MemberListType::DecVarMembers()),"variables");
2147
2148 addPerlModDocBlock(m_output,"brief",gd->briefFile(),gd->briefLine(),nullptr,nullptr,gd->briefDescription());
2149 addPerlModDocBlock(m_output,"detailed",gd->docFile(),gd->docLine(),nullptr,nullptr,gd->documentation());
2150
2152}
2153
2155{
2156 // + name
2157 // + title
2158 // + documentation
2159
2160 if (pd->isReference()) return;
2161
2163 .addFieldQuotedString("name", pd->name());
2164
2165 const SectionInfo *si = SectionManager::instance().find(pd->name());
2166 if (si)
2168
2169 addPerlModDocBlock(m_output,"detailed",pd->docFile(),pd->docLine(),nullptr,nullptr,pd->documentation());
2171}
2172
2174{
2175 std::ofstream outputFileStream;
2176 if (!createOutputFile(outputFileStream, pathDoxyDocsPM))
2177 return false;
2178
2179 PerlModOutputStream outputStream(outputFileStream);
2180 m_output.setPerlModOutputStream(&outputStream);
2181 m_output.add("$doxydocs=").openHash();
2182
2183 m_output.openList("classes");
2184 for (const auto &cd : *Doxygen::classLinkedMap)
2185 generatePerlModForClass(cd.get());
2187
2188 m_output.openList("concepts");
2189 for (const auto &cd : *Doxygen::conceptLinkedMap)
2190 generatePerlModForConcept(cd.get());
2192
2193 m_output.openList("modules");
2194 for (const auto &mod : ModuleManager::instance().modules())
2195 generatePerlModForModule(mod.get());
2197
2198 m_output.openList("namespaces");
2199 for (const auto &nd : *Doxygen::namespaceLinkedMap)
2202
2203 m_output.openList("files");
2204 for (const auto &fn : *Doxygen::inputNameLinkedMap)
2205 {
2206 for (const auto &fd : *fn)
2207 {
2208 generatePerlModForFile(fd.get());
2209 }
2210 }
2212
2213 m_output.openList("groups");
2214 for (const auto &gd : *Doxygen::groupLinkedMap)
2215 {
2216 generatePerlModForGroup(gd.get());
2217 }
2219
2220 m_output.openList("pages");
2221 for (const auto &pd : *Doxygen::pageLinkedMap)
2222 {
2223 generatePerlModForPage(pd.get());
2224 }
2226 {
2228 }
2230
2231 m_output.closeHash().add(";\n1;\n");
2232 m_output.reset();
2233 return true;
2234}
2235
2236bool PerlModGenerator::createOutputFile(std::ofstream &f, const DString &s)
2237{
2239 if (!f.is_open())
2240 {
2241 err("Cannot open file {} for writing!\n", s);
2242 return false;
2243 }
2244 return true;
2245}
2246
2248{
2249 std::string outputDirectory = Config_getString(OUTPUT_DIRECTORY).str();
2250 perlModDir.setPath(outputDirectory+"/perlmod");
2251 if (!perlModDir.exists() && !perlModDir.mkdir(outputDirectory+"/perlmod"))
2252 {
2253 err("Could not create perlmod directory in {}\n",outputDirectory);
2254 return false;
2255 }
2256 return true;
2257}
2258
2260{
2261 std::ofstream doxyModelPMStream;
2262 if (!createOutputFile(doxyModelPMStream, pathDoxyStructurePM))
2263 return false;
2264
2265 doxyModelPMStream <<
2266 "sub memberlist($) {\n"
2267 " my $prefix = $_[0];\n"
2268 " return\n"
2269 "\t[ \"hash\", $prefix . \"s\",\n"
2270 "\t {\n"
2271 "\t members =>\n"
2272 "\t [ \"list\", $prefix . \"List\",\n"
2273 "\t\t[ \"hash\", $prefix,\n"
2274 "\t\t {\n"
2275 "\t\t kind => [ \"string\", $prefix . \"Kind\" ],\n"
2276 "\t\t name => [ \"string\", $prefix . \"Name\" ],\n"
2277 "\t\t static => [ \"string\", $prefix . \"Static\" ],\n"
2278 "\t\t virtualness => [ \"string\", $prefix . \"Virtualness\" ],\n"
2279 "\t\t protection => [ \"string\", $prefix . \"Protection\" ],\n"
2280 "\t\t type => [ \"string\", $prefix . \"Type\" ],\n"
2281 "\t\t parameters =>\n"
2282 "\t\t [ \"list\", $prefix . \"Params\",\n"
2283 "\t\t\t[ \"hash\", $prefix . \"Param\",\n"
2284 "\t\t\t {\n"
2285 "\t\t\t declaration_name => [ \"string\", $prefix . \"ParamName\" ],\n"
2286 "\t\t\t type => [ \"string\", $prefix . \"ParamType\" ],\n"
2287 "\t\t\t },\n"
2288 "\t\t\t],\n"
2289 "\t\t ],\n"
2290 "\t\t detailed =>\n"
2291 "\t\t [ \"hash\", $prefix . \"Detailed\",\n"
2292 "\t\t\t{\n"
2293 "\t\t\t doc => [ \"doc\", $prefix . \"DetailedDoc\" ],\n"
2294 "\t\t\t return => [ \"doc\", $prefix . \"Return\" ],\n"
2295 "\t\t\t see => [ \"doc\", $prefix . \"See\" ],\n"
2296 "\t\t\t params =>\n"
2297 "\t\t\t [ \"list\", $prefix . \"PDBlocks\",\n"
2298 "\t\t\t [ \"hash\", $prefix . \"PDBlock\",\n"
2299 "\t\t\t\t{\n"
2300 "\t\t\t\t parameters =>\n"
2301 "\t\t\t\t [ \"list\", $prefix . \"PDParams\",\n"
2302 "\t\t\t\t [ \"hash\", $prefix . \"PDParam\",\n"
2303 "\t\t\t\t\t{\n"
2304 "\t\t\t\t\t name => [ \"string\", $prefix . \"PDParamName\" ],\n"
2305 "\t\t\t\t\t},\n"
2306 "\t\t\t\t ],\n"
2307 "\t\t\t\t ],\n"
2308 "\t\t\t\t doc => [ \"doc\", $prefix . \"PDDoc\" ],\n"
2309 "\t\t\t\t},\n"
2310 "\t\t\t ],\n"
2311 "\t\t\t ],\n"
2312 "\t\t\t},\n"
2313 "\t\t ],\n"
2314 "\t\t },\n"
2315 "\t\t],\n"
2316 "\t ],\n"
2317 "\t },\n"
2318 "\t];\n"
2319 "}\n"
2320 "\n"
2321 "$doxystructure =\n"
2322 " [ \"hash\", \"Root\",\n"
2323 " {\n"
2324 "\tfiles =>\n"
2325 "\t [ \"list\", \"Files\",\n"
2326 "\t [ \"hash\", \"File\",\n"
2327 "\t {\n"
2328 "\t\tname => [ \"string\", \"FileName\" ],\n"
2329 "\t\ttypedefs => memberlist(\"FileTypedef\"),\n"
2330 "\t\tvariables => memberlist(\"FileVariable\"),\n"
2331 "\t\tfunctions => memberlist(\"FileFunction\"),\n"
2332 "\t\tdetailed =>\n"
2333 "\t\t [ \"hash\", \"FileDetailed\",\n"
2334 "\t\t {\n"
2335 "\t\t doc => [ \"doc\", \"FileDetailedDoc\" ],\n"
2336 "\t\t },\n"
2337 "\t\t ],\n"
2338 "\t },\n"
2339 "\t ],\n"
2340 "\t ],\n"
2341 "\tpages =>\n"
2342 "\t [ \"list\", \"Pages\",\n"
2343 "\t [ \"hash\", \"Page\",\n"
2344 "\t {\n"
2345 "\t\tname => [ \"string\", \"PageName\" ],\n"
2346 "\t\tdetailed =>\n"
2347 "\t\t [ \"hash\", \"PageDetailed\",\n"
2348 "\t\t {\n"
2349 "\t\t doc => [ \"doc\", \"PageDetailedDoc\" ],\n"
2350 "\t\t },\n"
2351 "\t\t ],\n"
2352 "\t },\n"
2353 "\t ],\n"
2354 "\t ],\n"
2355 "\tclasses =>\n"
2356 "\t [ \"list\", \"Classes\",\n"
2357 "\t [ \"hash\", \"Class\",\n"
2358 "\t {\n"
2359 "\t\tname => [ \"string\", \"ClassName\" ],\n"
2360 "\t\tpublic_typedefs => memberlist(\"ClassPublicTypedef\"),\n"
2361 "\t\tpublic_methods => memberlist(\"ClassPublicMethod\"),\n"
2362 "\t\tpublic_members => memberlist(\"ClassPublicMember\"),\n"
2363 "\t\tprotected_typedefs => memberlist(\"ClassProtectedTypedef\"),\n"
2364 "\t\tprotected_methods => memberlist(\"ClassProtectedMethod\"),\n"
2365 "\t\tprotected_members => memberlist(\"ClassProtectedMember\"),\n"
2366 "\t\tprivate_typedefs => memberlist(\"ClassPrivateTypedef\"),\n"
2367 "\t\tprivate_methods => memberlist(\"ClassPrivateMethod\"),\n"
2368 "\t\tprivate_members => memberlist(\"ClassPrivateMember\"),\n"
2369 "\t\tdetailed =>\n"
2370 "\t\t [ \"hash\", \"ClassDetailed\",\n"
2371 "\t\t {\n"
2372 "\t\t doc => [ \"doc\", \"ClassDetailedDoc\" ],\n"
2373 "\t\t },\n"
2374 "\t\t ],\n"
2375 "\t },\n"
2376 "\t ],\n"
2377 "\t ],\n"
2378 "\tgroups =>\n"
2379 "\t [ \"list\", \"Groups\",\n"
2380 "\t [ \"hash\", \"Group\",\n"
2381 "\t {\n"
2382 "\t\tname => [ \"string\", \"GroupName\" ],\n"
2383 "\t\ttitle => [ \"string\", \"GroupTitle\" ],\n"
2384 "\t\tfiles =>\n"
2385 "\t\t [ \"list\", \"Files\",\n"
2386 "\t\t [ \"hash\", \"File\",\n"
2387 "\t\t {\n"
2388 "\t\t name => [ \"string\", \"Filename\" ]\n"
2389 "\t\t }\n"
2390 "\t\t ],\n"
2391 "\t\t ],\n"
2392 "\t\tclasses =>\n"
2393 "\t\t [ \"list\", \"Classes\",\n"
2394 "\t\t [ \"hash\", \"Class\",\n"
2395 "\t\t {\n"
2396 "\t\t name => [ \"string\", \"Classname\" ]\n"
2397 "\t\t }\n"
2398 "\t\t ],\n"
2399 "\t\t ],\n"
2400 "\t\tnamespaces =>\n"
2401 "\t\t [ \"list\", \"Namespaces\",\n"
2402 "\t\t [ \"hash\", \"Namespace\",\n"
2403 "\t\t {\n"
2404 "\t\t name => [ \"string\", \"NamespaceName\" ]\n"
2405 "\t\t }\n"
2406 "\t\t ],\n"
2407 "\t\t ],\n"
2408 "\t\tpages =>\n"
2409 "\t\t [ \"list\", \"Pages\",\n"
2410 "\t\t [ \"hash\", \"Page\","
2411 "\t\t {\n"
2412 "\t\t title => [ \"string\", \"PageName\" ]\n"
2413 "\t\t }\n"
2414 "\t\t ],\n"
2415 "\t\t ],\n"
2416 "\t\tgroups =>\n"
2417 "\t\t [ \"list\", \"Groups\",\n"
2418 "\t\t [ \"hash\", \"Group\",\n"
2419 "\t\t {\n"
2420 "\t\t title => [ \"string\", \"GroupName\" ]\n"
2421 "\t\t }\n"
2422 "\t\t ],\n"
2423 "\t\t ],\n"
2424 "\t\tfunctions => memberlist(\"GroupFunction\"),\n"
2425 "\t\tdetailed =>\n"
2426 "\t\t [ \"hash\", \"GroupDetailed\",\n"
2427 "\t\t {\n"
2428 "\t\t doc => [ \"doc\", \"GroupDetailedDoc\" ],\n"
2429 "\t\t },\n"
2430 "\t\t ],\n"
2431 "\t }\n"
2432 "\t ],\n"
2433 "\t ],\n"
2434 " },\n"
2435 " ];\n"
2436 "\n"
2437 "1;\n";
2438
2439 return true;
2440}
2441
2443{
2444 std::ofstream doxyRulesStream;
2445 if (!createOutputFile(doxyRulesStream, pathDoxyRules))
2446 return false;
2447
2448 bool perlmodLatex = Config_getBool(PERLMOD_LATEX);
2449 DString prefix = Config_getString(PERLMOD_MAKEVAR_PREFIX);
2450
2451 doxyRulesStream <<
2452 prefix << "DOXY_EXEC_PATH = " << pathDoxyExec << "\n" <<
2453 prefix << "DOXYFILE = " << pathDoxyfile << "\n" <<
2454 prefix << "DOXYDOCS_PM = " << pathDoxyDocsPM << "\n" <<
2455 prefix << "DOXYSTRUCTURE_PM = " << pathDoxyStructurePM << "\n" <<
2456 prefix << "DOXYRULES = " << pathDoxyRules << "\n";
2457 if (perlmodLatex)
2458 doxyRulesStream <<
2459 prefix << "DOXYLATEX_PL = " << pathDoxyLatexPL << "\n" <<
2460 prefix << "DOXYLATEXSTRUCTURE_PL = " << pathDoxyLatexStructurePL << "\n" <<
2461 prefix << "DOXYSTRUCTURE_TEX = " << pathDoxyStructureTex << "\n" <<
2462 prefix << "DOXYDOCS_TEX = " << pathDoxyDocsTex << "\n" <<
2463 prefix << "DOXYFORMAT_TEX = " << pathDoxyFormatTex << "\n" <<
2464 prefix << "DOXYLATEX_TEX = " << pathDoxyLatexTex << "\n" <<
2465 prefix << "DOXYLATEX_DVI = " << pathDoxyLatexDVI << "\n" <<
2466 prefix << "DOXYLATEX_PDF = " << pathDoxyLatexPDF << "\n";
2467
2468 doxyRulesStream <<
2469 "\n"
2470 ".PHONY: clean-perlmod\n"
2471 "clean-perlmod::\n"
2472 "\trm -f $(" << prefix << "DOXYSTRUCTURE_PM) \\\n"
2473 "\t$(" << prefix << "DOXYDOCS_PM)";
2474 if (perlmodLatex)
2475 doxyRulesStream <<
2476 " \\\n"
2477 "\t$(" << prefix << "DOXYLATEX_PL) \\\n"
2478 "\t$(" << prefix << "DOXYLATEXSTRUCTURE_PL) \\\n"
2479 "\t$(" << prefix << "DOXYDOCS_TEX) \\\n"
2480 "\t$(" << prefix << "DOXYSTRUCTURE_TEX) \\\n"
2481 "\t$(" << prefix << "DOXYFORMAT_TEX) \\\n"
2482 "\t$(" << prefix << "DOXYLATEX_TEX) \\\n"
2483 "\t$(" << prefix << "DOXYLATEX_PDF) \\\n"
2484 "\t$(" << prefix << "DOXYLATEX_DVI) \\\n"
2485 "\t$(addprefix $(" << prefix << "DOXYLATEX_TEX:tex=),out aux log)";
2486 doxyRulesStream << "\n\n";
2487
2488 doxyRulesStream <<
2489 "$(" << prefix << "DOXYRULES) \\\n"
2490 "$(" << prefix << "DOXYMAKEFILE) \\\n"
2491 "$(" << prefix << "DOXYSTRUCTURE_PM) \\\n"
2492 "$(" << prefix << "DOXYDOCS_PM)";
2493 if (perlmodLatex) {
2494 doxyRulesStream <<
2495 " \\\n"
2496 "$(" << prefix << "DOXYLATEX_PL) \\\n"
2497 "$(" << prefix << "DOXYLATEXSTRUCTURE_PL) \\\n"
2498 "$(" << prefix << "DOXYFORMAT_TEX) \\\n"
2499 "$(" << prefix << "DOXYLATEX_TEX)";
2500 }
2501 doxyRulesStream <<
2502 ": \\\n"
2503 "\t$(" << prefix << "DOXYFILE)\n"
2504 "\tcd $(" << prefix << "DOXY_EXEC_PATH) ; doxygen \"$<\"\n";
2505
2506 if (perlmodLatex) {
2507 doxyRulesStream <<
2508 "\n"
2509 "$(" << prefix << "DOXYDOCS_TEX): \\\n"
2510 "$(" << prefix << "DOXYLATEX_PL) \\\n"
2511 "$(" << prefix << "DOXYDOCS_PM)\n"
2512 "\tperl -I\"$(<D)\" \"$<\" >\"$@\"\n"
2513 "\n"
2514 "$(" << prefix << "DOXYSTRUCTURE_TEX): \\\n"
2515 "$(" << prefix << "DOXYLATEXSTRUCTURE_PL) \\\n"
2516 "$(" << prefix << "DOXYSTRUCTURE_PM)\n"
2517 "\tperl -I\"$(<D)\" \"$<\" >\"$@\"\n"
2518 "\n"
2519 "$(" << prefix << "DOXYLATEX_PDF) \\\n"
2520 "$(" << prefix << "DOXYLATEX_DVI): \\\n"
2521 "$(" << prefix << "DOXYLATEX_TEX) \\\n"
2522 "$(" << prefix << "DOXYFORMAT_TEX) \\\n"
2523 "$(" << prefix << "DOXYSTRUCTURE_TEX) \\\n"
2524 "$(" << prefix << "DOXYDOCS_TEX)\n"
2525 "\n"
2526 "$(" << prefix << "DOXYLATEX_PDF): \\\n"
2527 "$(" << prefix << "DOXYLATEX_TEX)\n"
2528 "\tpdflatex -interaction=nonstopmode \"$<\"\n"
2529 "\n"
2530 "$(" << prefix << "DOXYLATEX_DVI): \\\n"
2531 "$(" << prefix << "DOXYLATEX_TEX)\n"
2532 "\tlatex -interaction=nonstopmode \"$<\"\n";
2533 }
2534
2535 return true;
2536}
2537
2539{
2540 std::ofstream makefileStream;
2541 if (!createOutputFile(makefileStream, pathMakefile))
2542 return false;
2543
2544 bool perlmodLatex = Config_getBool(PERLMOD_LATEX);
2545 DString prefix = Config_getString(PERLMOD_MAKEVAR_PREFIX);
2546
2547 makefileStream <<
2548 ".PHONY: default clean" << (perlmodLatex ? " pdf" : "") << "\n"
2549 "default: " << (perlmodLatex ? "pdf" : "clean") << "\n"
2550 "\n"
2551 "include " << pathDoxyRules << "\n"
2552 "\n"
2553 "clean: clean-perlmod\n";
2554
2555 if (perlmodLatex) {
2556 makefileStream <<
2557 "pdf: $(" << prefix << "DOXYLATEX_PDF)\n"
2558 "dvi: $(" << prefix << "DOXYLATEX_DVI)\n";
2559 }
2560
2561 return true;
2562}
2563
2565{
2566 std::ofstream doxyLatexStructurePLStream;
2567 if (!createOutputFile(doxyLatexStructurePLStream, pathDoxyLatexStructurePL))
2568 return false;
2569
2570 doxyLatexStructurePLStream <<
2571 "use DoxyStructure;\n"
2572 "\n"
2573 "sub process($) {\n"
2574 "\tmy $node = $_[0];\n"
2575 "\tmy ($type, $name) = @$node[0, 1];\n"
2576 "\tmy $command;\n"
2577 "\tif ($type eq \"string\") { $command = \"String\" }\n"
2578 "\telsif ($type eq \"doc\") { $command = \"Doc\" }\n"
2579 "\telsif ($type eq \"hash\") {\n"
2580 "\t\t$command = \"Hash\";\n"
2581 "\t\tfor my $subnode (values %{$$node[2]}) {\n"
2582 "\t\t\tprocess($subnode);\n"
2583 "\t\t}\n"
2584 "\t}\n"
2585 "\telsif ($type eq \"list\") {\n"
2586 "\t\t$command = \"List\";\n"
2587 "\t\tprocess($$node[2]);\n"
2588 "\t}\n"
2589 "\tprint \"\\\\\" . $command . \"Node{\" . $name . \"}%\\n\";\n"
2590 "}\n"
2591 "\n"
2592 "process($doxystructure);\n";
2593
2594 return true;
2595}
2596
2598{
2599 std::ofstream doxyLatexPLStream;
2600 if (!createOutputFile(doxyLatexPLStream, pathDoxyLatexPL))
2601 return false;
2602
2603 doxyLatexPLStream <<
2604 "use DoxyStructure;\n"
2605 "use DoxyDocs;\n"
2606 "\n"
2607 "sub latex_quote($) {\n"
2608 "\tmy $text = $_[0];\n"
2609 "\t$text =~ s/\\\\/\\\\textbackslash /g;\n"
2610 "\t$text =~ s/\\|/\\\\textbar /g;\n"
2611 "\t$text =~ s/</\\\\textless /g;\n"
2612 "\t$text =~ s/>/\\\\textgreater /g;\n"
2613 "\t$text =~ s/~/\\\\textasciitilde /g;\n"
2614 "\t$text =~ s/\\^/\\\\textasciicircum /g;\n"
2615 "\t$text =~ s/[\\$&%#_{}]/\\\\$&/g;\n"
2616 "\tprint $text;\n"
2617 "}\n"
2618 "\n"
2619 "sub generate_doc($) {\n"
2620 "\tmy $doc = $_[0];\n"
2621 "\tfor my $item (@$doc) {\n"
2622 "\t\tmy $type = $$item{type};\n"
2623 "\t\tif ($type eq \"text\") {\n"
2624 "\t\t\tlatex_quote($$item{content});\n"
2625 "\t\t} elsif ($type eq \"parbreak\") {\n"
2626 "\t\t\tprint \"\\n\\n\";\n"
2627 "\t\t} elsif ($type eq \"style\") {\n"
2628 "\t\t\tmy $style = $$item{style};\n"
2629 "\t\t\tif ($$item{enable} eq \"yes\") {\n"
2630 "\t\t\t\tif ($style eq \"bold\") { print '\\bfseries'; }\n"
2631 "\t\t\t\tif ($style eq \"italic\") { print '\\itshape'; }\n"
2632 "\t\t\t\tif ($style eq \"code\") { print '\\ttfamily'; }\n"
2633 "\t\t\t} else {\n"
2634 "\t\t\t\tif ($style eq \"bold\") { print '\\mdseries'; }\n"
2635 "\t\t\t\tif ($style eq \"italic\") { print '\\upshape'; }\n"
2636 "\t\t\t\tif ($style eq \"code\") { print '\\rmfamily'; }\n"
2637 "\t\t\t}\n"
2638 "\t\t\tprint '{}';\n"
2639 "\t\t} elsif ($type eq \"symbol\") {\n"
2640 "\t\t\tmy $symbol = $$item{symbol};\n"
2641 "\t\t\tif ($symbol eq \"copyright\") { print '\\copyright'; }\n"
2642 "\t\t\telsif ($symbol eq \"szlig\") { print '\\ss'; }\n"
2643 "\t\t\tprint '{}';\n"
2644 "\t\t} elsif ($type eq \"accent\") {\n"
2645 "\t\t\tmy ($accent) = $$item{accent};\n"
2646 "\t\t\tif ($accent eq \"umlaut\") { print '\\\"'; }\n"
2647 "\t\t\telsif ($accent eq \"acute\") { print '\\\\\\''; }\n"
2648 "\t\t\telsif ($accent eq \"grave\") { print '\\`'; }\n"
2649 "\t\t\telsif ($accent eq \"circ\") { print '\\^'; }\n"
2650 "\t\t\telsif ($accent eq \"tilde\") { print '\\~'; }\n"
2651 "\t\t\telsif ($accent eq \"cedilla\") { print '\\c'; }\n"
2652 "\t\t\telsif ($accent eq \"ring\") { print '\\r'; }\n"
2653 "\t\t\tprint \"{\" . $$item{letter} . \"}\"; \n"
2654 "\t\t} elsif ($type eq \"list\") {\n"
2655 "\t\t\tmy $env = ($$item{style} eq \"ordered\") ? \"enumerate\" : \"itemize\";\n"
2656 "\t\t\tprint \"\\n\\\\begin{\" . $env .\"}\";\n"
2657 "\t\t \tfor my $subitem (@{$$item{content}}) {\n"
2658 "\t\t\t\tprint \"\\n\\\\item \";\n"
2659 "\t\t\t\tgenerate_doc($subitem);\n"
2660 "\t\t \t}\n"
2661 "\t\t\tprint \"\\n\\\\end{\" . $env .\"}\";\n"
2662 "\t\t} elsif ($type eq \"url\") {\n"
2663 "\t\t\tlatex_quote($$item{content});\n"
2664 "\t\t}\n"
2665 "\t}\n"
2666 "}\n"
2667 "\n"
2668 "sub generate($$) {\n"
2669 "\tmy ($item, $node) = @_;\n"
2670 "\tmy ($type, $name) = @$node[0, 1];\n"
2671 "\tif ($type eq \"string\") {\n"
2672 "\t\tprint \"\\\\\" . $name . \"{\";\n"
2673 "\t\tlatex_quote($item);\n"
2674 "\t\tprint \"}\";\n"
2675 "\t} elsif ($type eq \"doc\") {\n"
2676 "\t\tif (@$item) {\n"
2677 "\t\t\tprint \"\\\\\" . $name . \"{\";\n"
2678 "\t\t\tgenerate_doc($item);\n"
2679 "\t\t\tprint \"}%\\n\";\n"
2680 "\t\t} else {\n"
2681 "#\t\t\tprint \"\\\\\" . $name . \"Empty%\\n\";\n"
2682 "\t\t}\n"
2683 "\t} elsif ($type eq \"hash\") {\n"
2684 "\t\tmy ($key, $value);\n"
2685 "\t\twhile (($key, $subnode) = each %{$$node[2]}) {\n"
2686 "\t\t\tmy $subname = $$subnode[1];\n"
2687 "\t\t\tprint \"\\\\Defcs{field\" . $subname . \"}{\";\n"
2688 "\t\t\tif ($$item{$key}) {\n"
2689 "\t\t\t\tgenerate($$item{$key}, $subnode);\n"
2690 "\t\t\t} else {\n"
2691 "#\t\t\t\t\tprint \"\\\\\" . $subname . \"Empty%\\n\";\n"
2692 "\t\t\t}\n"
2693 "\t\t\tprint \"}%\\n\";\n"
2694 "\t\t}\n"
2695 "\t\tprint \"\\\\\" . $name . \"%\\n\";\n"
2696 "\t} elsif ($type eq \"list\") {\n"
2697 "\t\tmy $index = 0;\n"
2698 "\t\tif (@$item) {\n"
2699 "\t\t\tprint \"\\\\\" . $name . \"{%\\n\";\n"
2700 "\t\t\tfor my $subitem (@$item) {\n"
2701 "\t\t\t\tif ($index) {\n"
2702 "\t\t\t\t\tprint \"\\\\\" . $name . \"Sep%\\n\";\n"
2703 "\t\t\t\t}\n"
2704 "\t\t\t\tgenerate($subitem, $$node[2]);\n"
2705 "\t\t\t\t$index++;\n"
2706 "\t\t\t}\n"
2707 "\t\t\tprint \"}%\\n\";\n"
2708 "\t\t} else {\n"
2709 "#\t\t\tprint \"\\\\\" . $name . \"Empty%\\n\";\n"
2710 "\t\t}\n"
2711 "\t}\n"
2712 "}\n"
2713 "\n"
2714 "generate($doxydocs, $doxystructure);\n";
2715
2716 return true;
2717}
2718
2720{
2721 std::ofstream doxyFormatTexStream;
2722 if (!createOutputFile(doxyFormatTexStream, pathDoxyFormatTex))
2723 return false;
2724
2725 doxyFormatTexStream <<
2726 "\\def\\Defcs#1{\\long\\expandafter\\def\\csname#1\\endcsname}\n"
2727 "\\Defcs{Empty}{}\n"
2728 "\\def\\IfEmpty#1{\\expandafter\\ifx\\csname#1\\endcsname\\Empty}\n"
2729 "\n"
2730 "\\def\\StringNode#1{\\Defcs{#1}##1{##1}}\n"
2731 "\\def\\DocNode#1{\\Defcs{#1}##1{##1}}\n"
2732 "\\def\\ListNode#1{\\Defcs{#1}##1{##1}\\Defcs{#1Sep}{}}\n"
2733 "\\def\\HashNode#1{\\Defcs{#1}{}}\n"
2734 "\n"
2735 "\\input{" << pathDoxyStructureTex << "}\n"
2736 "\n"
2737 "\\newbox\\BoxA\n"
2738 "\\dimendef\\DimenA=151\\relax\n"
2739 "\\dimendef\\DimenB=152\\relax\n"
2740 "\\countdef\\ZoneDepth=151\\relax\n"
2741 "\n"
2742 "\\def\\Cs#1{\\csname#1\\endcsname}\n"
2743 "\\def\\Letcs#1{\\expandafter\\let\\csname#1\\endcsname}\n"
2744 "\\def\\Heading#1{\\vskip 4mm\\relax\\textbf{#1}}\n"
2745 "\\def\\See#1{\\begin{flushleft}\\Heading{See also: }#1\\end{flushleft}}\n"
2746 "\n"
2747 "\\def\\Frame#1{\\vskip 3mm\\relax\\fbox{ \\vbox{\\hsize0.95\\hsize\\vskip 1mm\\relax\n"
2748 "\\raggedright#1\\vskip 0.5mm\\relax} }}\n"
2749 "\n"
2750 "\\def\\Zone#1#2#3{%\n"
2751 "\\Defcs{Test#1}{#2}%\n"
2752 "\\Defcs{Emit#1}{#3}%\n"
2753 "\\Defcs{#1}{%\n"
2754 "\\advance\\ZoneDepth1\\relax\n"
2755 "\\Letcs{Mode\\number\\ZoneDepth}0\\relax\n"
2756 "\\Letcs{Present\\number\\ZoneDepth}0\\relax\n"
2757 "\\Cs{Test#1}\n"
2758 "\\expandafter\\if\\Cs{Present\\number\\ZoneDepth}1%\n"
2759 "\\advance\\ZoneDepth-1\\relax\n"
2760 "\\Letcs{Present\\number\\ZoneDepth}1\\relax\n"
2761 "\\expandafter\\if\\Cs{Mode\\number\\ZoneDepth}1%\n"
2762 "\\advance\\ZoneDepth1\\relax\n"
2763 "\\Letcs{Mode\\number\\ZoneDepth}1\\relax\n"
2764 "\\Cs{Emit#1}\n"
2765 "\\advance\\ZoneDepth-1\\relax\\fi\n"
2766 "\\advance\\ZoneDepth1\\relax\\fi\n"
2767 "\\advance\\ZoneDepth-1\\relax}}\n"
2768 "\n"
2769 "\\def\\Member#1#2{%\n"
2770 "\\Defcs{Test#1}{\\Cs{field#1Detailed}\n"
2771 "\\IfEmpty{field#1DetailedDoc}\\else\\Letcs{Present#1}1\\fi}\n"
2772 "\\Defcs{#1}{\\Letcs{Present#1}0\\relax\n"
2773 "\\Cs{Test#1}\\if1\\Cs{Present#1}\\Letcs{Present\\number\\ZoneDepth}1\\relax\n"
2774 "\\if1\\Cs{Mode\\number\\ZoneDepth}#2\\fi\\fi}}\n"
2775 "\n"
2776 "\\def\\TypedefMemberList#1#2{%\n"
2777 "\\Defcs{#1DetailedDoc}##1{\\vskip 5.5mm\\relax##1}%\n"
2778 "\\Defcs{#1Name}##1{\\textbf{##1}}%\n"
2779 "\\Defcs{#1See}##1{\\See{##1}}%\n"
2780 "%\n"
2781 "\\Zone{#1s}{\\Cs{field#1List}}{\\subsubsection{#2}\\Cs{field#1List}}%\n"
2782 "\\Member{#1}{\\Frame{typedef \\Cs{field#1Type} \\Cs{field#1Name}}%\n"
2783 "\\Cs{field#1DetailedDoc}\\Cs{field#1See}\\vskip 5mm\\relax}}%\n"
2784 "\n"
2785 "\\def\\VariableMemberList#1#2{%\n"
2786 "\\Defcs{#1DetailedDoc}##1{\\vskip 5.5mm\\relax##1}%\n"
2787 "\\Defcs{#1Name}##1{\\textbf{##1}}%\n"
2788 "\\Defcs{#1See}##1{\\See{##1}}%\n"
2789 "%\n"
2790 "\\Zone{#1s}{\\Cs{field#1List}}{\\subsubsection{#2}\\Cs{field#1List}}%\n"
2791 "\\Member{#1}{\\Frame{\\Cs{field#1Type}{} \\Cs{field#1Name}}%\n"
2792 "\\Cs{field#1DetailedDoc}\\Cs{field#1See}\\vskip 5mm\\relax}}%\n"
2793 "\n"
2794 "\\def\\FunctionMemberList#1#2{%\n"
2795 "\\Defcs{#1PDParamName}##1{\\textit{##1}}%\n"
2796 "\\Defcs{#1PDParam}{\\Cs{field#1PDParamName}}%\n"
2797 "\\Defcs{#1PDParamsSep}{, }%\n"
2798 "\\Defcs{#1PDBlocksSep}{\\vskip 2mm\\relax}%\n"
2799 "%\n"
2800 "\\Defcs{#1PDBlocks}##1{%\n"
2801 "\\Heading{Parameters:}\\vskip 1.5mm\\relax\n"
2802 "\\DimenA0pt\\relax\n"
2803 "\\Defcs{#1PDBlock}{\\setbox\\BoxA\\hbox{\\Cs{field#1PDParams}}%\n"
2804 "\\ifdim\\DimenA<\\wd\\BoxA\\DimenA\\wd\\BoxA\\fi}%\n"
2805 "##1%\n"
2806 "\\advance\\DimenA3mm\\relax\n"
2807 "\\DimenB\\hsize\\advance\\DimenB-\\DimenA\\relax\n"
2808 "\\Defcs{#1PDBlock}{\\hbox to\\hsize{\\vtop{\\hsize\\DimenA\\relax\n"
2809 "\\Cs{field#1PDParams}}\\hfill\n"
2810 "\\vtop{\\hsize\\DimenB\\relax\\Cs{field#1PDDoc}}}}%\n"
2811 "##1}\n"
2812 "\n"
2813 "\\Defcs{#1ParamName}##1{\\textit{##1}}\n"
2814 "\\Defcs{#1Param}{\\Cs{field#1ParamType}{} \\Cs{field#1ParamName}}\n"
2815 "\\Defcs{#1ParamsSep}{, }\n"
2816 "\n"
2817 "\\Defcs{#1Name}##1{\\textbf{##1}}\n"
2818 "\\Defcs{#1See}##1{\\See{##1}}\n"
2819 "\\Defcs{#1Return}##1{\\Heading{Returns: }##1}\n"
2820 "\\Defcs{field#1Title}{\\Frame{\\Cs{field#1Type}{} \\Cs{field#1Name}(\\Cs{field#1Params})}}%\n"
2821 "%\n"
2822 "\\Zone{#1s}{\\Cs{field#1List}}{\\subsubsection{#2}\\Cs{field#1List}}%\n"
2823 "\\Member{#1}{%\n"
2824 "\\Cs{field#1Title}\\vskip 6mm\\relax\\Cs{field#1DetailedDoc}\n"
2825 "\\Cs{field#1Return}\\Cs{field#1PDBlocks}\\Cs{field#1See}\\vskip 5mm\\relax}}\n"
2826 "\n"
2827 "\\def\\FileDetailed{\\fieldFileDetailedDoc\\par}\n"
2828 "\\def\\ClassDetailed{\\fieldClassDetailedDoc\\par}\n"
2829 "\n"
2830 "\\def\\FileSubzones{\\fieldFileTypedefs\\fieldFileVariables\\fieldFileFunctions}\n"
2831 "\n"
2832 "\\def\\ClassSubzones{%\n"
2833 "\\fieldClassPublicTypedefs\\fieldClassPublicMembers\\fieldClassPublicMethods\n"
2834 "\\fieldClassProtectedTypedefs\\fieldClassProtectedMembers\\fieldClassProtectedMethods\n"
2835 "\\fieldClassPrivateTypedefs\\fieldClassPrivateMembers\\fieldClassPrivateMethods}\n"
2836 "\n"
2837 "\\Member{Page}{\\subsection{\\fieldPageName}\\fieldPageDetailedDoc}\n"
2838 "\n"
2839 "\\TypedefMemberList{FileTypedef}{Typedefs}\n"
2840 "\\VariableMemberList{FileVariable}{Variables}\n"
2841 "\\FunctionMemberList{FileFunction}{Functions}\n"
2842 "\\Zone{File}{\\FileSubzones}{\\subsection{\\fieldFileName}\\fieldFileDetailed\\FileSubzones}\n"
2843 "\n"
2844 "\\TypedefMemberList{ClassPublicTypedef}{Public Typedefs}\n"
2845 "\\TypedefMemberList{ClassProtectedTypedef}{Protected Typedefs}\n"
2846 "\\TypedefMemberList{ClassPrivateTypedef}{Private Typedefs}\n"
2847 "\\VariableMemberList{ClassPublicMember}{Public Members}\n"
2848 "\\VariableMemberList{ClassProtectedMember}{Protected Members}\n"
2849 "\\VariableMemberList{ClassPrivateMember}{Private Members}\n"
2850 "\\FunctionMemberList{ClassPublicMethod}{Public Methods}\n"
2851 "\\FunctionMemberList{ClassProtectedMethod}{Protected Methods}\n"
2852 "\\FunctionMemberList{ClassPrivateMethod}{Private Methods}\n"
2853 "\\Zone{Class}{\\ClassSubzones}{\\subsection{\\fieldClassName}\\fieldClassDetailed\\ClassSubzones}\n"
2854 "\n"
2855 "\\Zone{AllPages}{\\fieldPages}{\\section{Pages}\\fieldPages}\n"
2856 "\\Zone{AllFiles}{\\fieldFiles}{\\section{Files}\\fieldFiles}\n"
2857 "\\Zone{AllClasses}{\\fieldClasses}{\\section{Classes}\\fieldClasses}\n"
2858 "\n"
2859 "\\newlength{\\oldparskip}\n"
2860 "\\newlength{\\oldparindent}\n"
2861 "\\newlength{\\oldfboxrule}\n"
2862 "\n"
2863 "\\ZoneDepth0\\relax\n"
2864 "\\Letcs{Mode0}1\\relax\n"
2865 "\n"
2866 "\\def\\EmitDoxyDocs{%\n"
2867 "\\setlength{\\oldparskip}{\\parskip}\n"
2868 "\\setlength{\\oldparindent}{\\parindent}\n"
2869 "\\setlength{\\oldfboxrule}{\\fboxrule}\n"
2870 "\\setlength{\\parskip}{0cm}\n"
2871 "\\setlength{\\parindent}{0cm}\n"
2872 "\\setlength{\\fboxrule}{1pt}\n"
2873 "\\AllPages\\AllFiles\\AllClasses\n"
2874 "\\setlength{\\parskip}{\\oldparskip}\n"
2875 "\\setlength{\\parindent}{\\oldparindent}\n"
2876 "\\setlength{\\fboxrule}{\\oldfboxrule}}\n";
2877
2878 return true;
2879}
2880
2882{
2883 std::ofstream doxyLatexTexStream;
2884 if (!createOutputFile(doxyLatexTexStream, pathDoxyLatexTex))
2885 return false;
2886
2887 doxyLatexTexStream <<
2888 "\\documentclass[a4paper,12pt]{article}\n"
2889 "\\usepackage[latin1]{inputenc}\n"
2890 "\\usepackage[none]{hyphenat}\n"
2891 "\\usepackage[T1]{fontenc}\n"
2892 "\\usepackage{hyperref}\n"
2893 "\\usepackage{times}\n"
2894 "\n"
2895 "\\input{doxyformat}\n"
2896 "\n"
2897 "\\begin{document}\n"
2898 "\\input{" << pathDoxyDocsTex << "}\n"
2899 "\\sloppy\n"
2900 "\\EmitDoxyDocs\n"
2901 "\\end{document}\n";
2902
2903 return true;
2904}
2905
2907{
2908 // + classes
2909 // + namespaces
2910 // + files
2911 // - packages
2912 // + groups
2913 // + related pages
2914 // - examples
2915
2916 Dir perlModDir;
2917 if (!createOutputDir(perlModDir))
2918 return;
2919
2920 bool perlmodLatex = Config_getBool(PERLMOD_LATEX);
2921
2922 DString perlModAbsPath = perlModDir.absPath();
2923 pathDoxyDocsPM = perlModAbsPath + "/DoxyDocs.pm";
2924 pathDoxyStructurePM = perlModAbsPath + "/DoxyStructure.pm";
2925 pathMakefile = perlModAbsPath + "/Makefile";
2926 pathDoxyRules = perlModAbsPath + "/doxyrules.make";
2927
2928 if (perlmodLatex) {
2929 pathDoxyStructureTex = perlModAbsPath + "/doxystructure.tex";
2930 pathDoxyFormatTex = perlModAbsPath + "/doxyformat.tex";
2931 pathDoxyLatexTex = perlModAbsPath + "/doxylatex.tex";
2932 pathDoxyLatexDVI = perlModAbsPath + "/doxylatex.dvi";
2933 pathDoxyLatexPDF = perlModAbsPath + "/doxylatex.pdf";
2934 pathDoxyDocsTex = perlModAbsPath + "/doxydocs.tex";
2935 pathDoxyLatexPL = perlModAbsPath + "/doxylatex.pl";
2936 pathDoxyLatexStructurePL = perlModAbsPath + "/doxylatex-structure.pl";
2937 }
2938
2939 if (!(generatePerlModOutput()
2941 && generateMakefile()
2942 && generateDoxyRules()))
2943 return;
2944
2945 if (perlmodLatex) {
2950 return;
2951 }
2952}
2953
2955{
2956 PerlModGenerator pmg(Config_getBool(PERLMOD_PRETTY));
2957 pmg.generate();
2958}
2959
2960// Local Variables:
2961// c-basic-offset: 2
2962// End:
2963
2964/* This elisp function for XEmacs makes Control-Z transform
2965 the text in the region into a valid C string.
2966
2967 (global-set-key '(control z) (lambda () (interactive)
2968 (save-excursion
2969 (if (< (mark) (point)) (exchange-point-and-mark))
2970 (let ((start (point)) (replacers
2971 '(("\\\\" "\\\\\\\\")
2972 ("\"" "\\\\\"")
2973 ("\t" "\\\\t")
2974 ("^.*$" "\"\\&\\\\n\""))))
2975 (while replacers
2976 (while (re-search-forward (caar replacers) (mark) t)
2977 (replace-match (cadar replacers) t))
2978 (goto-char start)
2979 (setq replacers (cdr replacers)))))))
2980*/
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 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 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 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 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:348
std::string absPath() const
Definition dir.cpp:370
bool mkdir(const std::string &path, bool acceptsAbsPath=true) const
Definition dir.cpp:301
void setPath(const std::string &path)
Definition dir.cpp:235
bool exists() const
Definition dir.cpp:263
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:979
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:2334
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
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 DString argsString() const =0
virtual const ClassDef * getClassDef() const =0
virtual DString excpString() const =0
virtual const DString & initializer() const =0
virtual const MemberVector & enumFieldList() const =0
virtual const ArgumentList & argumentList() 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 Protection protection() const =0
virtual MemberType memberType() 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:681
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 void addTemplateArgumentList(const ArgumentList &al, PerlModOutput &output, const DString &)
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:4454
A bunch of utility functions.