Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: Source/bindings/scripts/idltopath.pm

Issue 14456006: Fixes to make scripts generate includes with paths. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated to a newer chromium version Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4 use Exporter;
5
6 package idltopath;
7
8 our @ISA = qw( Exporter );
9 # These are exported by default.
10 our @EXPORT = qw( initIdlToPath idlToPath );
11
12 my %idlToPathHash;
13 my $idlToPathFile;
14
15 sub initIdlToPath
16 {
17 $idlToPathFile = shift;
18 if (!%idlToPathHash) {
19 open(FILE, $idlToPathFile) || die "Could not find generated data file " . $idlToPathFile;
20 while (<FILE>)
21 {
22 my ($key, $val) = split /,/;
23 # Strip CRLF from val (chomp is picky and will often remove only hal f).
24 $val =~ s/\s*$//;
25 $idlToPathHash{$key} .= $val;
26 }
27
28 die if !%idlToPathHash;
29 }
30 }
31
32
33 sub idlToPath
34 {
35 my $interface = shift;
36
37 if (!%idlToPathHash) {
38 die "idltopath is not initialized. Call initIdlToPath(datafile).";
39 }
40
41 if ($idlToPathHash{$interface}) {
42 return $idlToPathHash{$interface} . '/';
43 } elsif ($interface =~ /^SVGPath/ && $idlToPathHash{$interface . "Abs"}) {
44 return $idlToPathHash{$interface . "Abs"} . '/';
45 } elsif ($interface =~ /^WebKit/ && $idlToPathHash{substr($interface, 6)}) {
46 # WebKitAnimationEvent is in AnimationEvent.idl.
47 # WebKitNamedFlow is in NamedFlow.idl.
48 return $idlToPathHash{substr($interface, 6)} . '/';
49 } else {
50 my $caller_package;
51 my $caller_filename;
52 my $caller_line;
53 ($caller_package, $caller_filename, $caller_line) = caller;
54 die "Unknown interface '$interface'. Not found in $idlToPathFile. Called from $caller_filename:$caller_line.";
55 }
56 }
57
58 # A module must return a truth value.
59 1;
OLDNEW
« no previous file with comments | « Source/bindings/scripts/generate-bindings.pl ('k') | Source/bindings/scripts/idltopathgenerator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698