Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > perl + doxygen + dbi

Reply
Thread Tools

perl + doxygen + dbi

 
 
lyttlec
Guest
Posts: n/a
 
      07-30-2011
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
 
Reply With Quote
 
 
 
 
George Mpouras
Guest
Posts: n/a
 
      07-31-2011
On 07/31/2011 12:11 AM, lyttlec wrote:
> 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 ?
 
Reply With Quote
 
 
 
 
lyttlec
Guest
Posts: n/a
 
      08-01-2011
On 07/31/2011 04:07 PM, George Mpouras wrote:
> On 07/31/2011 12:11 AM, lyttlec wrote:
>> 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 ?

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.
 
Reply With Quote
 
George Mpouras
Guest
Posts: n/a
 
      08-01-2011
Something in XML maybe ?
Assumptions based on this format could be completely wrong.


 
Reply With Quote
 
lyttlec
Guest
Posts: n/a
 
      08-02-2011
On 08/01/2011 11:40 AM, George Mpouras wrote:
> 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 => {}
}
],
 
Reply With Quote
 
George Mpouras
Guest
Posts: n/a
 
      08-02-2011
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:arse_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";


 
Reply With Quote
 
lyttlec
Guest
Posts: n/a
 
      08-03-2011
On 08/02/2011 06:21 AM, George Mpouras wrote:
> 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:arse_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?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DBI Mysql storing DBI:binary, trouble with character 26 Jerome Hauss Ruby 0 10-13-2004 03:04 PM
DBI and DBI::Oracle packages configuration ulloa Perl 1 07-22-2004 05:52 PM
Doxygen Task for Ant makefile maintainers Karthik Java 0 04-29-2004 03:58 AM
DBI problem : How can I load quickly one huge table with DBI ??. Tim Haynes Perl Misc 3 09-13-2003 03:43 AM
Mason, DBI, and DBI::Pg Asby Perl Misc 0 07-24-2003 09:04 PM



Advertisments