[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

[XaraXtreme-commits] Commit Complete



Commit by  : alex
Repository : xara
Revision   : 1275
Date       : Thu Jun  8 21:26:23 BST 2006

Changed paths:
   M /Trunk/XaraLX/Scripts/normalise.pl

Include file zapping technology


Diff:
Index: Trunk/XaraLX/Scripts/normalise.pl
===================================================================
--- Trunk/XaraLX/Scripts/normalise.pl	(revision 1274)
+++ Trunk/XaraLX/Scripts/normalise.pl	(revision 1275)
@@ -91,6 +91,7 @@
                                      standard output (not the temp file)
    --verbose                       - be very loud about it
    --help                          - display this message
+   --removeinclude                 - remove the specified include
 
 EOF
 
@@ -129,6 +130,7 @@
 my $tempext = ".$$.tmp";
 my $backupext = '.bak';
 my $backup = 1;
+my @removeinclude;
 
 my $noticestart = '/* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE';
 my $noticeend   = ' */';
@@ -139,6 +141,7 @@
 my $newnotice;
 my @kauthors;
 my @ktypes;
+my $removeincludepat;
 
 GetOptions( "fixnl!" => \$fixnl,
 	    "fixauthors!" => \$fixauthors,
@@ -158,6 +161,7 @@
 	    "tempext=s" => \$tempext,
 	    "backupext=s" => \$backupext,
 	    "backup!" => \$backup,
+	    "removeinclude=s" => \@removeinclude,
 	    "help!" => \$help ) || usage ("Bad option");
 
 if ($help)
@@ -303,6 +307,12 @@
 	    }
 	}
 
+	# Remove unwanted includes
+	if (scalar(@removeinclude))
+	{
+	    $line="" if ($line =~ /$removeincludepat/);
+	}
+
 	# Fix trace statements to quote the string in _T if it's not
 	# there already
 	if (($fixtrace) && ($line !~ /_T\(/))
@@ -715,4 +725,17 @@
 	# Delete multiple returns at the end
 	$newnotice =~ s/
+$/
/g;
     }
+
+    if (scalar(@removeinclude))
+    {
+	my $i;
+	my $p="";
+	foreach $i (@removeinclude)
+	{
+	    $i=s/\./\\./g;
+	    $p.="|" if ($p ne "");
+	    $p.="($i)"
+	}
+	$removeincludepat=qr/^\s*\#include\s+\"$p\".*$/;
+    }
 }


Xara