summaryrefslogtreecommitdiffstats
path: root/korundum/rubylib/rbtdeconfig_compiler/checkkcfg.pl
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-01-27 01:02:53 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-01-27 01:02:53 -0600
commit545706afdcf29b8f584e78275452cca715e284db (patch)
treefdbfaa34f2d633372ba4ab3e46d22cf10f38b40b /korundum/rubylib/rbtdeconfig_compiler/checkkcfg.pl
parent9d4971a2ffb5be9c6fc1b6d6bc74020c37fb2169 (diff)
downloadtdebindings-545706afdcf29b8f584e78275452cca715e284db.tar.gz
tdebindings-545706afdcf29b8f584e78275452cca715e284db.zip
Rename a number of libraries and executables to avoid conflicts with KDE4
Diffstat (limited to 'korundum/rubylib/rbtdeconfig_compiler/checkkcfg.pl')
-rwxr-xr-xkorundum/rubylib/rbtdeconfig_compiler/checkkcfg.pl83
1 files changed, 83 insertions, 0 deletions
diff --git a/korundum/rubylib/rbtdeconfig_compiler/checkkcfg.pl b/korundum/rubylib/rbtdeconfig_compiler/checkkcfg.pl
new file mode 100755
index 00000000..26b12bad
--- /dev/null
+++ b/korundum/rubylib/rbtdeconfig_compiler/checkkcfg.pl
@@ -0,0 +1,83 @@
+#!/usr/bin/perl
+
+if ( @ARGV != 1 ) {
+ print STDERR "Missing arg: filename\n";
+ exit 1;
+}
+
+$file = $ARGV[0];
+
+$file =~ /^(.*)\.[^\.]*$/;
+$filebase = $1;
+
+$file_h = "$filebase.h";
+$file_cpp = "$filebase.cpp";
+
+$kcfgc = $file . "c";
+
+$cmd = "./tdeconfig_compiler $file $kcfgc";
+
+#print "CMD $cmd\n";
+
+if ( system( $cmd ) != 0 ) {
+ print STDERR "Unable to run tdeconfig_compiler\n";
+ exit 1;
+}
+
+chectdefile( $file_h );
+chectdefile( $file_cpp );
+
+exit 0;
+
+sub chectdefile()
+{
+ my $file = shift;
+
+ $file =~ /\/([^\/]*)$/;
+ my $filename = $1;
+
+ print "Checking '$filename':\n";
+
+ my @ref;
+ if ( !open( REF, "$file.ref" ) ) {
+ print STDERR "Unable to open $file.ref\n";
+ exit 1;
+ }
+ while( <REF> ) {
+ push @ref, $_;
+ }
+ close REF;
+
+ if ( !open( READ, $filename ) ) {
+ print STDERR "Unable to open $filename\n";
+ exit 1;
+ }
+
+ $error = 0;
+ $i = 0;
+ $line = 1;
+ while( <READ> ) {
+ $out = $_;
+ $ref = @ref[$i++];
+
+ if ( $out ne $ref ) {
+ $error++;
+ print " Line $line: Expected : $ref";
+ print " Line $line: Compiler output : $out";
+ }
+
+ $line++;
+ }
+
+ close READ;
+
+ if ( $error > 0 ) {
+ print "\n FAILED: $error errors found.\n";
+ if ( $error > 5 ) {
+ system( "diff -u $file.ref $filename" );
+ }
+ exit 1;
+ } else {
+ print " OK\n";
+ }
+}