For those into (voluntarily or otherwise) maintenance of someone else's code---in this case 25 megabytes of C++ written over time by various and sundry hands (of various and sundry talent), here is a script that might be of use. It uses the output of ctags as input (pipe fans out there know what to do...) with the result of a reasonably useful table in mySQL.

#!/perl/bin/perl # # tag2msql.pl -- convert ctags -x output into a mysql table. use strict; use warnings; use diagnostics; use DBI; my $dbh = DBI->connect( 'DBI:mysql:host=localhost;database=blitzen', '', '', { PrintError => 0, RaiseError => 1 } ) or die "Cannot connect to Database\n"; my $theQuery; my ($symbol,$type,$line_number,$file_name,$source); while (<>) { if (/^operator/i) { /(.*?)\s+(.*?)\s+(.*?)\s+(.*?)\s+(.*?)\s+(.*)/; ($symbol,$type,$line_number,$file_name,$source) = ("$1 $2",$3, +$4,$5,$6); } else { /(.*?)\s+(.*?)\s+(.*?)\s+(.*?)\s+(.*)/; ($symbol,$type,$line_number,$file_name,$source) = ($1,$2,$3,$4 +,$5); } $symbol = $dbh->quote($symbol); $type = $dbh->quote($type); $line_number = $dbh->quote($line_number); $file_name = $dbh->quote($file_name); $source = $dbh->quote($source); $theQuery = qq{ INSERT symbols(symbol,type,line_number,file_name,source) VALUES($symbol,$type,$line_number,$file_name,$source) }; $dbh->do($theQuery) or warn("Cannot do query\n"); } $dbh->disconnect(); #mysql> describe symbol; #+-------------+--------------+------+-----+---------+-------+ #| Field | Type | Null | Key | Default | Extra | #+-------------+--------------+------+-----+---------+-------+ #| symbol | varchar(250) | | PRI | | | #| type | varchar(250) | | MUL | | | #| line_number | smallint(6) | | PRI | 0 | | #| file_name | varchar(200) | | PRI | | | #| source | varchar(250) | | | | | #+-------------+--------------+------+-----+---------+-------+ #5 rows in set (0.00 sec)

--hsm

"Never try to teach a pig to sing...it wastes your time and it annoys the pig."

In reply to Maintenance Archeology 101 by hsmyers

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.