diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2002-10-06 19:08:54 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2002-10-06 19:08:54 (GMT) |
commit | 4596b79abbfea0953c6cd7c6b294dc1727807960 (patch) | |
tree | c1062a06b0267bdf027f00efb00f1fb2b70db5c5 /addon | |
parent | 858708350c055a757c1e34461a06c5cf2277f2db (diff) | |
download | Doxygen-4596b79abbfea0953c6cd7c6b294dc1727807960.zip Doxygen-4596b79abbfea0953c6cd7c6b294dc1727807960.tar.gz Doxygen-4596b79abbfea0953c6cd7c6b294dc1727807960.tar.bz2 |
Release-1.2.18-20021006
Diffstat (limited to 'addon')
-rw-r--r-- | addon/perlmod/DoxyModel.pm | 102 | ||||
-rw-r--r-- | addon/perlmod/README | 43 | ||||
-rw-r--r-- | addon/perlmod/doxydocs-latex.pl | 108 | ||||
-rw-r--r-- | addon/perlmod/doxytemplate-latex.pl | 28 |
4 files changed, 281 insertions, 0 deletions
diff --git a/addon/perlmod/DoxyModel.pm b/addon/perlmod/DoxyModel.pm new file mode 100644 index 0000000..10454b9 --- /dev/null +++ b/addon/perlmod/DoxyModel.pm @@ -0,0 +1,102 @@ +sub section($$) { + my ($wrap, $name) = @_; + my $prefix = "Doxy" . $name; + return + [ "hash", "Doxy" . $wrap, + { + members => + [ "list", $prefix . "s", + [ "hash", $prefix, + { + kind => [ "field", $prefix . "Kind" ], + name => [ "field", $prefix . "Name" ], + virtualness => [ "field", $prefix . "Virtualness" ], + protection => [ "field", $prefix . "Protection" ], + type => [ "field", $prefix . "Type" ], + parameters => + [ "list", $prefix . "Params", + [ "hash", $prefix . "Param", + { + declaration_name => [ "field", $prefix . "ParamName" ], + type => [ "field", $prefix . "ParamType" ], + }, + ], + ], + detailed => + [ "hash", $prefix . "Detailed", + { + doc => [ "doc", $prefix . "DetailedDoc" ], + return => [ "doc", $prefix . "Return" ], + see => [ "doc", $prefix . "See" ], + params => + [ "list", $prefix . "PDBlocks", + [ "hash", $prefix . "PDBlock", + { + parameters => + [ "list", $prefix . "PDParams", + [ "hash", $prefix . "PDParam", + { + name => [ "field", $prefix . "PDParamName" ], + }, + ], + ], + doc => [ "doc", $prefix . "PDDoc" ], + }, + ], + ], + }, + ], + }, + ], + ], + }, + ]; +} + +$doxymodel = + [ "hash", "DoxyTop", + { + files => + [ "list", "DoxyFiles", + [ "hash", "DoxyFile", + { + name => [ "field", "DoxyFileName" ], + typedefs => section("FileTypedefs", "Typedef"), + variables => section("FileVariables", "Variable"), + functions => section("FileFunctions", "Function"), + detailed => + [ "hash", "DoxyFileDetailed", + { + doc => [ "doc", "DoxyFileDetailedDoc" ], + }, + ], + }, + ], + ], + classes => + [ "list", "DoxyClasses", + [ "hash", "DoxyClass", + { + name => [ "field", "DoxyClassName" ], + public_typedefs => section("ClassPublicTypedefs", "Typedef"), + public_methods => section("ClassPublicMethods", "Function"), + public_members => section("ClassPublicMembers", "Variable"), + protected_typedefs => section("ClassProtectedTypedefs", "Typedef"), + protected_methods => section("ClassProtectedMethods", "Function"), + protected_members => section("ClassProtectedMembers", "Variable"), + private_typedefs => section("ClassPrivateTypedefs", "Typedef"), + private_methods => section("ClassPrivateMethods", "Function"), + private_members => section("ClassPrivateMembers", "Variable"), + detailed => + [ "hash", "DoxyClassDetailed", + { + doc => [ "doc", "DoxyClassDetailedDoc" ], + }, + ], + }, + ], + ], + }, + ]; + +1; diff --git a/addon/perlmod/README b/addon/perlmod/README new file mode 100644 index 0000000..0938474 --- /dev/null +++ b/addon/perlmod/README @@ -0,0 +1,43 @@ +DoxyModel.pm: it is a Perl module with information about the structure +of DoxyDocs.pm files. It is used by Perl scripts that process the +output generated by the Perl backend. + +doxydocs-latex.pl: it is a Perl script which uses DoxyModel.pm and a +generated DoxyDocs.pm to create the file doxydocs.tex. This file +contains the documentation, this time in "TeX" format. doxydocs.tex, +however, can't been directly LaTeX'ed. + +doxydocs-latex.ltx: this is the LaTeX file which is LaTeX'ed to +generate the PDF or DVI documentation. It includes doxydocs.tex, +generated by doxydocs-latex.pl above, and doxytemplate.tex, generated +by doxytemplate-latex.pl -- see below. This file is intended to be +customized by users if they want to modify the format of the PDF or +DVI output. + +doxytemplate-latex.pl: this is a Perl script which uses DoxyModel.pm +to generate a doxytemplate.tex TeX file. This file is included by +doxydocs-latex.ltx to maintain the compatibility with future versions +of Doxygen; i.e. a customized doxydocs-latex.ltx should work with the +output generated by future versions of Doxygen as long as it includes +an updated doxydocs.tex. + +So what do you do to test my backend? + +1. You apply perlgen.diff and rebuild Doxygen. +2. You save DoxyModel.pm, doxydocs-latex.pl, doxytemplate-latex.pl and +doxydocs-latex.ltx to your test directory. +3. You run doxytemplate-latex.pl to generate doxytemplate.tex. +4. You generate DoxyDocs.pm by running Doxygen on the test code. (You +must enable the GENERATE_PERL option in your Doxyfile). +5. You run doxydocs-latex.pl to generate doxydocs.tex from +DoxyDocs.pm. +6. You run pdflatex on doxydocs-latex.ltx to generate +doxydocs-latex.pdf from doxydocs.tex and doxytemplate.tex. + +If you want to regenerate the PDF output after modifying the test code +you only need to do the steps from 4 on. + +I also attach a main.h file I've used to test my backend and the +corresponding main.pdf file I've generated from it. + + diff --git a/addon/perlmod/doxydocs-latex.pl b/addon/perlmod/doxydocs-latex.pl new file mode 100644 index 0000000..c60ff65 --- /dev/null +++ b/addon/perlmod/doxydocs-latex.pl @@ -0,0 +1,108 @@ +#!/usr/bin/perl +# Copyright (C) 1997-2002 by Dimitri van Heesch. +# Author: Miguel Lobo. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation under the terms of the GNU General Public License is hereby +# granted. No representations are made about the suitability of this software +# for any purpose. It is provided "as is" without express or implied warranty. +# See the GNU General Public License for more details. +# +# Documents produced by Doxygen are derivative works derived from the +# input used in their production; they are not affected by this license. + +# This script can be used to generate LaTeX output using the new Perl +# intermediate format. It is incomplete and experimental, so for the moment +# you should use Doxygen"s standard LaTeX output. +# +# If you want to try this out, you should do: +# doxygen configName # This creates DoxyDocs.pm +# perl -I. doxydocs-latex.pl # This creates doxydocs.tex and doxytemplate.tex +# latex doxydocs-latex.ltx # This creates doxydocs-latex.dvi +# +# Notes: +# - Your config file has to have Perl output enabled, of course. +# - The Perl output format is only complete enough to document +# a simple C file; no classes by the moment :-). + +use DoxyModel; +use DoxyDocs; + +sub latex_quote($) { + my $text = $_[0]; + $text =~ s/[\\_&]/\\$&/g; + print TEXDOCS $text; +} + +sub generate_doc($) { + my $doc = $_[0]; + for my $item (@$doc) { + my $type = $$item{type}; + if ($type eq "text") { + latex_quote($$item{content}); + } elsif ($type eq "para") { + generate_doc($$item{content}); +# print TEXDOCS "\\par\n"; + } elsif ($type eq "bold") { + print TEXDOCS "\\textbf{"; + generate_doc($$item{content}); + print TEXDOCS "}"; + } elsif ($type eq "emphasis") { + print TEXDOCS "\\textit{"; + generate_doc($$item{content}); + print TEXDOCS "}"; + } elsif ($type eq "url") { + latex_quote($$item{content}); + } + } +} + +sub generate($$) { + my ($item, $model) = @_; + my ($type, $name) = @$model[0, 1]; + if ($type eq "field") { + print TEXDOCS "\\" . $name . "{"; + latex_quote($item); + print TEXDOCS "}"; + } elsif ($type eq "doc") { + if (@$item) { + print TEXDOCS "\\" . $name . "{"; + generate_doc($item); + print TEXDOCS "}%\n"; + } else { + print TEXDOCS "\\" . $name . "Empty%\n"; + } + } elsif ($type eq "hash") { + my ($key, $value); + while (($key, $submodel) = each %{$$model[2]}) { + my $name = $$submodel[1]; + print TEXDOCS "\\def\\f" . $name . "{"; + if ($$item{$key}) { + generate($$item{$key}, $submodel); + } else { + print TEXDOCS "\\" . $name . "Empty"; + } + print TEXDOCS "}%\n"; + } + print TEXDOCS "\\" . $name . "%\n"; + } elsif ($type eq "list") { + my $index = 0; + if (@$item) { + print TEXDOCS "\\" . $name . "{%\n"; + for my $subitem (@$item) { + if ($index) { + print TEXDOCS "\\" . $name . "Sep%\n"; + } + generate($subitem, $$model[2]); + $index++; + } + print TEXDOCS "}%\n"; + } else { + print TEXDOCS "\\" . $name . "Empty%\n"; + } + } +} + +open TEXDOCS, ">doxydocs.tex"; +generate($doxydocs, $doxymodel); +close TEXDOCS; diff --git a/addon/perlmod/doxytemplate-latex.pl b/addon/perlmod/doxytemplate-latex.pl new file mode 100644 index 0000000..8caddf6 --- /dev/null +++ b/addon/perlmod/doxytemplate-latex.pl @@ -0,0 +1,28 @@ +use DoxyModel; + +sub template($) { + my $model = $_[0]; + my ($type, $name) = @$model[0, 1]; + if ($type eq "field") { + print TEXTEMPLATE "\\def\\" . $name . "#1{#1}%\n"; + } elsif ($type eq "doc") { + print TEXTEMPLATE "\\def\\" . $name . "#1{#1}%\n"; + } elsif ($type eq "hash") { + my ($key, $value); + while (($key, $submodel) = each %{$$model[2]}) { + my $subname = $$submodel[1]; + print TEXTEMPLATE "\\def\\" . $subname . "Empty{}%\n"; + print TEXTEMPLATE "\\def\\f" . $subname . "Empty{\\" . $subname . "Empty}%\n"; + template($submodel); + } + print TEXTEMPLATE "\\def\\" . $name . "{}%\n"; + } elsif ($type eq "list") { + template($$model[2]); + print TEXTEMPLATE "\\def\\" . $name . "#1{#1}%\n"; + print TEXTEMPLATE "\\def\\" . $name . "Sep{}%\n"; + } +} + +open TEXTEMPLATE, ">doxytemplate.tex"; +template($doxymodel); +close TEXTEMPLATE; |