perl + doxygen + dbi

L

lyttlec

I'm starting a new project that requires lots of documentation. All the
information needed to prepare the documents and dbi input is in the XML
files generated by doxygen. I would like to use perl scripts and/or
doxygen layout files to automate the process.

Can anyone give me some pointers? I've searched google and the only
results have been to hand-edit the latex files.


Thanks
 
G

George Mpouras

eded to prepare the documents and dbi input is in the XML files
generated by doxygen. I would like to use perl scripts and/or doxygen
layout files to automate the process.

Can anyone give me some pointers? I've searched google and the only
results have been to hand-edit the latex files.

can you provide a sample ?
 
L

lyttlec

can you provide a sample ?
Government standards require lots of documents hat largely repeat the
info found in standard Doxygen refman.tex.
For example :
(Doxygen also generates an XML version)
<in refman.tex>
\begin{titlepage}
\vspace*{7cm}
\begin{center}
{\Large PROJECT NAME\\
\vspace*{1cm}
{\large Generated by Doxygen 1.7.1}\\
\vspace*{0.5cm}
{\small Sun Jul 31 2011 20:31:10}\\
\end{center}
\end{titlepage}
....
\chapter{File Index}
\input{files}
\chapter{File Documentation}
\input{some__file_8h}
\input{some__file_8c}
\input{another__file_8c}
\input{another__file_8h}
\printindex

some__file_8h.tex might contain
\subsection*{ENUMERATIONS}
\item
typedef enum \hyperlink{...} {first_enum} \{
\hyperlink{...}{FIRST_MEMBER},
\hyperlink{...}{SECOND_MEMBER}, etc
}
with similar subsections for functions, variables, and so on.


Each file, function, variable, etc will have a unique identifier that
can be used as a key.

The generic problem is to extract data from one latex (or XML) file and
put it in another. In this simple case everything in refman.tex after
\chapter{...} would be copied out into SoftwareDesignDescription.tex and
data associated with each unique identifier in the input files go into a
Data Dictionary.

I'm not asking anyone to solve the problem for me, but a solution for
the generic problem would be helpful.

Thanks.
 
G

George Mpouras

Something in XML maybe ?
Assumptions based on this format could be completely wrong.
 
L

lyttlec

Something in XML maybe ?
Assumptions based on this format could be completely wrong.

I cut some examples made using Doxygen to generate perl, xml, and latex
output. I think the perlmod code would be much easier to handle, but the
other tools like xml.

Here is the C code: .
struct tm {
int tm_sec; /* seconds after the minute [0, 59] */
int tm_min; /* minutes after the hour [0, 59] */
int tm_hour; /* hours since midnight [0, 23] */
int tm_mday; /* day of the month [1, 31] */
int tm_mon; /* months since January [0, 11] */
int tm_year; /* years since 1900 */
int tm_wday; /* days since Sunday [0, 6] */
int tm_yday; /* days since January 1 [0, 365] */
int tm_isdst; /* Daylight Saving Time flag */
};

This is the XML :

<compound refid="d8/d5a/structtm" kind="struct"><name>tm</name>
<member refid="d8/d5a/structtm_1a4d098a9a5c03a00b2ee61e10851de81e"
kind="variable"><name>tm_sec</name></member>
<member refid="d8/d5a/structtm_1af414eb7c86cc3099595211eee4d4211b"
kind="variable"><name>tm_min</name></member>
<member refid="d8/d5a/structtm_1a3e7ca4e37f1abcaf56b8a916c38eb9fe"
kind="variable"><name>tm_hour</name></member>
<member refid="d8/d5a/structtm_1ab8d8904bad43b0c8b96e61941c5b5310"
kind="variable"><name>tm_mday</name></member>
<member refid="d8/d5a/structtm_1a112ac36fa2f593777138a417cf031e17"
kind="variable"><name>tm_mon</name></member>
<member refid="d8/d5a/structtm_1a33adf78fd6476b2120ce3b9c4a852053"
kind="variable"><name>tm_year</name></member>
<member refid="d8/d5a/structtm_1afe81a8c46f1c693c43f259b288859f4f"
kind="variable"><name>tm_wday</name></member>
<member refid="d8/d5a/structtm_1a93a0ba77cc23796df84405dcbcc57eb1"
kind="variable"><name>tm_yday</name></member>
<member refid="d8/d5a/structtm_1a5645ca0580c8ab2c24f6c2965d9c9f9c"
kind="variable"><name>tm_isdst</name></member>
</compound>

This is from the autogenerated DoxyDocs.pm
classes => [
{
name => 'tm',
includes => {
local => 'no',
name => 'time.h'
},
all_members => [

{
name => 'tm_hour',
virtualness => 'non_virtual',
protection => 'public',
scope => 'tm'
},
{
name => 'tm_isdst',
virtualness => 'non_virtual',
protection => 'public',
scope => 'tm'
},
{
name => 'tm_mday',
virtualness => 'non_virtual',
protection => 'public',
scope => 'tm'
},
{
name => 'tm_min',
virtualness => 'non_virtual',
protection => 'public',
scope => 'tm'
},
{
name => 'tm_mon',
virtualness => 'non_virtual',
protection => 'public',
scope => 'tm'
},
{
name => 'tm_sec',
virtualness => 'non_virtual',
protection => 'public',
scope => 'tm'
},
{
name => 'tm_wday',
virtualness => 'non_virtual',
protection => 'public',
scope => 'tm'
},
{
name => 'tm_yday',
virtualness => 'non_virtual',
protection => 'public',
scope => 'tm'
},
{
name => 'tm_year',
virtualness => 'non_virtual',
protection => 'public',
scope => 'tm'
}
],
public_members => {
members => [
{
kind => 'variable',
name => 'tm_sec',
virtualness => 'non_virtual',
protection => 'public',
static => 'no',
brief => {},
detailed => {},
type => 'int'
},
{
kind => 'variable',
name => 'tm_min',
virtualness => 'non_virtual',
protection => 'public',
static => 'no',
brief => {},
detailed => {},
type => 'int'
},
{
kind => 'variable',
name => 'tm_hour',
virtualness => 'non_virtual',
protection => 'public',
static => 'no',
brief => {},
detailed => {},
type => 'int'
},
{
kind => 'variable',
name => 'tm_mday',
virtualness => 'non_virtual',
protection => 'public',
static => 'no',
brief => {},
detailed => {},
type => 'int'
},
{
kind => 'variable',
name => 'tm_mon',
virtualness => 'non_virtual',
protection => 'public',
static => 'no',
brief => {},
detailed => {},
type => 'int'
},
{
kind => 'variable',
name => 'tm_year',
virtualness => 'non_virtual',
protection => 'public',
static => 'no',
brief => {},
detailed => {},
type => 'int'
},
{
kind => 'variable',
name => 'tm_wday',
virtualness => 'non_virtual',
protection => 'public',
static => 'no',
brief => {},
detailed => {},
type => 'int'
},
{
kind => 'variable',
name => 'tm_yday',
virtualness => 'non_virtual',
protection => 'public',
static => 'no',
brief => {},
detailed => {},
type => 'int'
},
{
kind => 'variable',
name => 'tm_isdst',
virtualness => 'non_virtual',
protection => 'public',
static => 'no',
brief => {},
detailed => {},
type => 'int'
}
]
},
brief => {},
detailed => {}
}
],
 
G

George Mpouras

You could read the xml files recursive and for each one of them you could do
something e.g. greate an other file.
the pm files can be used also easily with a do ... pm statement





my $xml = '

<compound refid="d8/d5a/structtm" kind="struct"><name>tm</name>
<member refid="d8/d5a/structtm_1a4d098a9a5c03a00b2ee61e10851de81e"
kind="variable"><name>tm_sec</name></member>
<member refid="d8/d5a/structtm_1af414eb7c86cc3099595211eee4d4211b"
kind="variable"><name>tm_min</name></member>
<member refid="d8/d5a/structtm_1a3e7ca4e37f1abcaf56b8a916c38eb9fe"
kind="variable"><name>tm_hour</name></member>
<member refid="d8/d5a/structtm_1ab8d8904bad43b0c8b96e61941c5b5310"
kind="variable"><name>tm_mday</name></member>
<member refid="d8/d5a/structtm_1a112ac36fa2f593777138a417cf031e17"
kind="variable"><name>tm_mon</name></member>
<member refid="d8/d5a/structtm_1a33adf78fd6476b2120ce3b9c4a852053"
kind="variable"><name>tm_year</name></member>
<member refid="d8/d5a/structtm_1afe81a8c46f1c693c43f259b288859f4f"
kind="variable"><name>tm_wday</name></member>
<member refid="d8/d5a/structtm_1a93a0ba77cc23796df84405dcbcc57eb1"
kind="variable"><name>tm_yday</name></member>
<member refid="d8/d5a/structtm_1a5645ca0580c8ab2c24f6c2965d9c9f9c"
kind="variable"><name>tm_isdst</name></member>
</compound>

';



use XML::Simple;
my $xml = XML::Simple::parse_string($xml );
print "do something with tm_min : $xml->{member}->{'tm_min'}->{'refid'}\n";
print "do something with tm_hour :
$xml->{member}->{'tm_hour'}->{'refid'}\n";
 
L

lyttlec

You could read the xml files recursive and for each one of them you could do
something e.g. greate an other file.
the pm files can be used also easily with a do ... pm statement





my $xml = '

<compound refid="d8/d5a/structtm" kind="struct"><name>tm</name>
<member refid="d8/d5a/structtm_1a4d098a9a5c03a00b2ee61e10851de81e"
kind="variable"><name>tm_sec</name></member>
<member refid="d8/d5a/structtm_1af414eb7c86cc3099595211eee4d4211b"
kind="variable"><name>tm_min</name></member>
<member refid="d8/d5a/structtm_1a3e7ca4e37f1abcaf56b8a916c38eb9fe"
kind="variable"><name>tm_hour</name></member>
<member refid="d8/d5a/structtm_1ab8d8904bad43b0c8b96e61941c5b5310"
kind="variable"><name>tm_mday</name></member>
<member refid="d8/d5a/structtm_1a112ac36fa2f593777138a417cf031e17"
kind="variable"><name>tm_mon</name></member>
<member refid="d8/d5a/structtm_1a33adf78fd6476b2120ce3b9c4a852053"
kind="variable"><name>tm_year</name></member>
<member refid="d8/d5a/structtm_1afe81a8c46f1c693c43f259b288859f4f"
kind="variable"><name>tm_wday</name></member>
<member refid="d8/d5a/structtm_1a93a0ba77cc23796df84405dcbcc57eb1"
kind="variable"><name>tm_yday</name></member>
<member refid="d8/d5a/structtm_1a5645ca0580c8ab2c24f6c2965d9c9f9c"
kind="variable"><name>tm_isdst</name></member>
</compound>

';



use XML::Simple;
my $xml = XML::Simple::parse_string($xml );
print "do something with tm_min : $xml->{member}->{'tm_min'}->{'refid'}\n";
print "do something with tm_hour :
$xml->{member}->{'tm_hour'}->{'refid'}\n";
I guess it boils down to which is best :
xml-> perl-> xml,
latex -> perl -> xml,
or perlmod -> perl -> xml?

The Ray & McIntosh "Perl & XML", 2002 seems a bit dated now.
How is XML::Simple now?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top