Hi all
I have coded in Perl a small tool to create a .csv spreadsheet file with:
Path;File;Function
for all *.c files in POTC
also lists all .h files.
I would like to attach the results of running this tool in my POTC dir, but it seems impossible.
Hope it helps
Here is the perl code
-------------------------------------------------------------------------------------------------------
use File::Find;
$rootdir="C:\\Program Files\\Bethesda Softworks\\Pirates of the Caribbean\\PROGRAM";
$fileout=">POTCfunctions.csv";
open fout,$fileout;
find(\&searchfunc,$rootdir);
close fout;
sub searchfunc {
$filename = $_;
if ($filename =~ /(\w*)\.c/) {
open filein,$File::Find::name;
while ( not eof filein ) {
$linein = <filein>;
if ($linein =~ /^(\w+)(\ +)(\w+)\((.*)\)/) {
@dir=split /\//,$File::Find::dir;
$i=0;
$d = ".";
for($i=1;$i<=$#dir;$i++) {
$d=join("\\",$d, @dir[$i]);
}
printf fout "%s;%s;%s",$d,$_,$linein;
}
}
close fin;
}
if ($filename =~ /(\w*)\.h/) {
@dir=split /\//,$File::Find::dir;
$i=0;
$d = ".";
for($i=1;$i<=$#dir;$i++) {
$d=join("\\",$d, @dir[$i]);
}
printf fout "%s;%s\n",$d,$_;
}
}
------------------------------------------------------------------------------
Regards
Kblack
I have coded in Perl a small tool to create a .csv spreadsheet file with:
Path;File;Function
for all *.c files in POTC
also lists all .h files.
I would like to attach the results of running this tool in my POTC dir, but it seems impossible.
Hope it helps
Here is the perl code
-------------------------------------------------------------------------------------------------------
use File::Find;
$rootdir="C:\\Program Files\\Bethesda Softworks\\Pirates of the Caribbean\\PROGRAM";
$fileout=">POTCfunctions.csv";
open fout,$fileout;
find(\&searchfunc,$rootdir);
close fout;
sub searchfunc {
$filename = $_;
if ($filename =~ /(\w*)\.c/) {
open filein,$File::Find::name;
while ( not eof filein ) {
$linein = <filein>;
if ($linein =~ /^(\w+)(\ +)(\w+)\((.*)\)/) {
@dir=split /\//,$File::Find::dir;
$i=0;
$d = ".";
for($i=1;$i<=$#dir;$i++) {
$d=join("\\",$d, @dir[$i]);
}
printf fout "%s;%s;%s",$d,$_,$linein;
}
}
close fin;
}
if ($filename =~ /(\w*)\.h/) {
@dir=split /\//,$File::Find::dir;
$i=0;
$d = ".";
for($i=1;$i<=$#dir;$i++) {
$d=join("\\",$d, @dir[$i]);
}
printf fout "%s;%s\n",$d,$_;
}
}
------------------------------------------------------------------------------
Regards
Kblack