• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

KBlacks Functions documentation- Build Mod Tool

kblack

Landlubber
Storm Modder
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
 
Stupid question: What's Perl and how do you use it? <img src="style_emoticons/<#EMO_DIR#>/unsure.gif" style="vertical-align:middle" emoid=":?" border="0" alt="unsure.gif" />
 
It's a scripting language, with a sintax very similar to C ( or POTC code)

Very useful to make small utilities and to parse text files.


To run the script:

1 Go to <a href="http://www.activestate.com/Products/ActivePerl/" target="_blank">http://www.activestate.com/Products/ActivePerl/</a> and download the free Perl distribution

2 Install it

3 Copy the script code in notepad, save as whateveryoulike.pl

4 Open a Command windows in the directory you saved whateveryoulike.pl

5 Write whateveryoulike.pl and return

Ale opss... you'll have a POTCfunctions.csv in that directory


So, at the end of the day, there aren't stupid questions, but incomplete instructions ;-)
 
Back
Top