Index: Source/bindings/scripts/idltopath.pm |
diff --git a/Source/bindings/scripts/idltopath.pm b/Source/bindings/scripts/idltopath.pm |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c4f943dd4996f2e44f789955032580086f48acbd |
--- /dev/null |
+++ b/Source/bindings/scripts/idltopath.pm |
@@ -0,0 +1,48 @@ |
+#!/usr/bin/perl |
+use strict; |
+use warnings; |
+use Exporter; |
+ |
+package idltopath; |
+ |
+our @ISA = qw( Exporter ); |
+# our @EXPORT_OK = qw( export_me export_me_too ); |
+# These are exported by default. |
+our @EXPORT = qw( idl_to_path idlToPath ); |
+ |
+my %idlToPathHash; |
+sub idlToPath |
+{ |
+ if (!%idlToPathHash) { |
+ my $idlToPathFile = $ENV{"IDLTOPATHFILE"}; |
+ die "Missing environment variable IDLTOPATHFILE" if !$idlToPathFile; |
+ print "Opening " . $idlToPathFile; |
+ open(FILE, $idlToPathFile) || die; |
+ while (<FILE>) |
+ { |
+ my ($key, $val) = split /,/; |
+ # Strip CRLF from val (chomp is picky and will often remove only half). |
+ $val =~ s/\s*$//; |
+ $idlToPathHash{$key} .= $val; |
+ } |
+ |
+ die if !%idlToPathHash; |
+ } |
+ |
+ my $interface = shift; |
+ if ($idlToPathHash{$interface}) { |
+ return $idlToPathHash{$interface} . '/'; |
+ } elsif ($interface =~ /^SVGPath/ && $idlToPathHash{$interface . "Abs"}) { |
+ return $idlToPathHash{$interface . "Abs"} . '/'; |
+ } else { |
+ return 'fixmebratell89/'; |
+ } |
+} |
+ |
+ |
+sub idl_to_path |
+{ |
+ my $interface = shift; |
+ return idlToPath($interface) |
+} |
+1; |