perl + doxygen + dbi

Discussion in 'Perl Misc' started by lyttlec, Jul 30, 2011.

  1. lyttlec

    lyttlec Guest

    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
     
    lyttlec, Jul 30, 2011
    #1
    1. Advertising

  2. 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 ?
     
    George Mpouras, Jul 31, 2011
    #2
    1. Advertising

  3. lyttlec

    lyttlec Guest

    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.
     
    lyttlec, Aug 1, 2011
    #3
  4. Something in XML maybe ?
    Assumptions based on this format could be completely wrong.
     
    George Mpouras, Aug 1, 2011
    #4
  5. lyttlec

    lyttlec Guest

    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 => {}
    }
    ],
     
    lyttlec, Aug 2, 2011
    #5
  6. 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";
     
    George Mpouras, Aug 2, 2011
    #6
  7. lyttlec

    lyttlec Guest

    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::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?
     
    lyttlec, Aug 3, 2011
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ulloa
    Replies:
    1
    Views:
    531
    Juha Laiho
    Jul 22, 2004
  2. Karthik
    Replies:
    0
    Views:
    398
    Karthik
    Apr 29, 2004
  3. Jerome Hauss
    Replies:
    0
    Views:
    175
    Jerome Hauss
    Oct 13, 2004
  4. Asby

    Mason, DBI, and DBI::Pg

    Asby, Jul 24, 2003, in forum: Perl Misc
    Replies:
    0
    Views:
    178
  5. Tim Haynes
    Replies:
    3
    Views:
    146
    Ron Reidy
    Sep 13, 2003
Loading...

Share This Page