Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Source / kwsys / kwsysHeaderDump.pl
blob4631b9187b2b3b749d10d4461f5ddcfd7baf4d17
1 #!/usr/bin/perl
3 # Program: KWSys - Kitware System Library
4 # Module: $RCSfile: kwsysHeaderDump.pl,v $
6 # Copyright (c) Kitware, Inc., Insight Consortium. All rights reserved.
7 # See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 # This software is distributed WITHOUT ANY WARRANTY; without even
10 # the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 # PURPOSE. See the above copyright notices for more information.
14 if ( $#ARGV+1 < 2 )
16 print "Usage: ./kwsysHeaderDump.pl <name> <header>\n";
17 exit(1);
20 $name = $ARGV[0];
21 $max = 0;
22 open(INFILE, $ARGV[1]);
23 while (chomp ($line = <INFILE>))
25 if (($line !~ /^\#/) &&
26 ($line =~ s/.*kwsys${name}_([A-Za-z0-9_]*).*/\1/) &&
27 ($i{$line}++ < 1))
29 push(@lines, "$line");
30 if (length($line) > $max)
32 $max = length($line);
36 close(INFILE);
38 $width = $max + 13;
39 print sprintf("#define %-${width}s kwsys_ns(${name})\n", "kwsys${name}");
40 foreach $l (@lines)
42 print sprintf("#define %-${width}s kwsys_ns(${name}_$l)\n",
43 "kwsys${name}_$l");
45 print "\n";
46 print sprintf("# undef kwsys${name}\n");
47 foreach $l (@lines)
49 print sprintf("# undef kwsys${name}_$l\n");