4 use Digest
::MD5
qw(md5_hex);
6 my $SRCFILE = "../gemrb/plugins/GUIScript/GUIScript.cpp";
7 my $TGTDIR = "../gemrb/docs/en/GUIScript";
20 sub parse_guiscript_cpp
{
26 open (SRC
, "< $SRCFILE") || die "Can't open $SRCFILE: $!\n";
28 while (defined (my $line = <SRC
>)) {
29 if ($line =~ /^PyDoc_STRVAR\s*\(\s*GemRB_(.*)__doc/g) {
32 elsif ($fname && $line =~ /^\"(.*)\"\s*$/g) {
35 elsif ($fname && $line =~ /^\"(.*)\"\s*\);\s*$/g) {
37 my $md5 = md5_hex
($1);
38 $fn_hash{$fname} = $md5;
39 $desc_hash{$fname} = $desc;
52 open (SRC
, "< $TGTDIR/$file") || die "Can't open $TGTDIR/$file: $!\n";
55 while (defined (my $line = <SRC
>)) {
56 if ($line =~ /^MD5:\s*([0-9a-f]+)/o) {
62 $file_hash{$file} = $md5;
67 &parse_guiscript_cpp
();
69 opendir (DIR
, $TGTDIR) || die "Can't open dir $TGTDIR: $!\n";
70 my @files = grep { -f
"$TGTDIR/$_" && ! exists ($file_ignore{$_}) } grep !/^\
.\
.?
/, readdir (DIR
);
73 foreach my $f (@files) {
77 foreach my $fn (sort keys %fn_hash) {
78 my $md5_1 = $fn_hash{$fn};
79 my $file = $fn . ".txt";
81 if (exists ($file_hash{$file})) {
82 my $md5_2 = $file_hash{$file};
84 if ($md5_1 eq $md5_2) {
87 print "! $fn: $md5_1 : $md5_2\n";
91 print "+ $fn : $md5_1 : $desc_hash{$fn}\n";
95 foreach my $file (sort keys %file_hash) {
96 my $md5 = $file_hash{$file};
98 $fn =~ s/\.[^\.]+$//o;
100 if (! exists ($fn_hash{$fn})) {
101 print "- $fn : $md5\n";