| 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..4203f448604df790e74b80eebf16f5cf75979ac4
|
| --- /dev/null
|
| +++ b/Source/bindings/scripts/idltopath.pm
|
| @@ -0,0 +1,59 @@
|
| +#!/usr/bin/perl
|
| +use strict;
|
| +use warnings;
|
| +use Exporter;
|
| +
|
| +package idltopath;
|
| +
|
| +our @ISA = qw( Exporter );
|
| +# These are exported by default.
|
| +our @EXPORT = qw( initIdlToPath idlToPath );
|
| +
|
| +my %idlToPathHash;
|
| +my $idlToPathFile;
|
| +
|
| +sub initIdlToPath
|
| +{
|
| + $idlToPathFile = shift;
|
| + if (!%idlToPathHash) {
|
| + open(FILE, $idlToPathFile) || die "Could not find generated data file " . $idlToPathFile;
|
| + 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;
|
| + }
|
| +}
|
| +
|
| +
|
| +sub idlToPath
|
| +{
|
| + my $interface = shift;
|
| +
|
| + if (!%idlToPathHash) {
|
| + die "idltopath is not initialized. Call initIdlToPath(datafile).";
|
| + }
|
| +
|
| + if ($idlToPathHash{$interface}) {
|
| + return $idlToPathHash{$interface} . '/';
|
| + } elsif ($interface =~ /^SVGPath/ && $idlToPathHash{$interface . "Abs"}) {
|
| + return $idlToPathHash{$interface . "Abs"} . '/';
|
| + } elsif ($interface =~ /^WebKit/ && $idlToPathHash{substr($interface, 6)}) {
|
| + # WebKitAnimationEvent is in AnimationEvent.idl.
|
| + # WebKitNamedFlow is in NamedFlow.idl.
|
| + return $idlToPathHash{substr($interface, 6)} . '/';
|
| + } else {
|
| + my $caller_package;
|
| + my $caller_filename;
|
| + my $caller_line;
|
| + ($caller_package, $caller_filename, $caller_line) = caller;
|
| + die "Unknown interface '$interface'. Not found in $idlToPathFile. Called from $caller_filename:$caller_line.";
|
| + }
|
| +}
|
| +
|
| +# A module must return a truth value.
|
| +1;
|
|
|