| OLD | NEW |
| 1 # | 1 # |
| 2 # WebKit IDL parser | 2 # WebKit IDL parser |
| 3 # | 3 # |
| 4 # Copyright (C) 2005 Nikolas Zimmermann <wildfox@kde.org> | 4 # Copyright (C) 2005 Nikolas Zimmermann <wildfox@kde.org> |
| 5 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> | 5 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> |
| 6 # Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. | 6 # Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. |
| 7 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> | 7 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> |
| 8 # Copyright (C) Research In Motion Limited 2010. All rights reserved. | 8 # Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 9 # | 9 # |
| 10 # This library is free software; you can redistribute it and/or | 10 # This library is free software; you can redistribute it and/or |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 foreach my $function (@{$currentInterface->functions}) { | 235 foreach my $function (@{$currentInterface->functions}) { |
| 236 if ($function->signature->name eq $functionName) { | 236 if ($function->signature->name eq $functionName) { |
| 237 $indexer = $function->signature; | 237 $indexer = $function->signature; |
| 238 return 'prune'; | 238 return 'prune'; |
| 239 } | 239 } |
| 240 } | 240 } |
| 241 }); | 241 }); |
| 242 return $indexer; | 242 return $indexer; |
| 243 } | 243 } |
| 244 | 244 |
| 245 sub IDLFileForInterface | 245 sub PopulateIDLFiles { |
| 246 { | |
| 247 my $object = shift; | 246 my $object = shift; |
| 248 my $interfaceName = shift; | |
| 249 | 247 |
| 250 unless ($idlFiles) { | 248 unless ($idlFiles) { |
| 251 my $sourceRoot = $ENV{SOURCE_ROOT}; | 249 my $sourceRoot = $ENV{SOURCE_ROOT}; |
| 252 my @directories = map { $_ = "$sourceRoot/$_" if $sourceRoot && -d "$sou
rceRoot/$_"; $_ } @$useDirectories; | 250 my @directories = map { $_ = "$sourceRoot/$_" if $sourceRoot && -d "$sou
rceRoot/$_"; $_ } @$useDirectories; |
| 253 push(@directories, "."); | 251 push(@directories, "."); |
| 254 | 252 |
| 255 $idlFiles = { }; | 253 $idlFiles = { }; |
| 256 | 254 |
| 257 my $wanted = sub { | 255 my $wanted = sub { |
| 258 $idlFiles->{$1} = $File::Find::name if /^([A-Z].*)\.idl$/; | 256 $idlFiles->{$1} = $File::Find::name if /^(?!Test)([A-Z].*)\.idl$/; |
| 259 $File::Find::prune = 1 if /^\../; | 257 $File::Find::prune = 1 if /^\../; |
| 260 }; | 258 }; |
| 261 find($wanted, @directories); | 259 find($wanted, @directories); |
| 262 } | 260 } |
| 261 } |
| 262 |
| 263 sub GetAllInterfaces |
| 264 { |
| 265 my $object = shift; |
| 266 |
| 267 $object->PopulateIDLFiles(); |
| 268 |
| 269 foreach my $filename (values $idlFiles) { |
| 270 my $parser = IDLParser->new(1); |
| 271 my $document = $parser->Parse($filename, $defines, $preprocessor); |
| 272 |
| 273 foreach my $interface (@{$document->interfaces}) { |
| 274 $cachedInterfaces->{$interface->name} = $interface; |
| 275 } |
| 276 } |
| 277 |
| 278 return (values $cachedInterfaces); |
| 279 } |
| 280 |
| 281 sub IDLFileForInterface |
| 282 { |
| 283 my $object = shift; |
| 284 my $interfaceName = shift; |
| 285 |
| 286 $object->PopulateIDLFiles(); |
| 263 | 287 |
| 264 return $idlFiles->{$interfaceName}; | 288 return $idlFiles->{$interfaceName}; |
| 265 } | 289 } |
| 266 | 290 |
| 267 sub ParseInterface | 291 sub ParseInterface |
| 268 { | 292 { |
| 269 my $object = shift; | 293 my $object = shift; |
| 270 my $interfaceName = shift; | 294 my $interfaceName = shift; |
| 271 | 295 |
| 272 return undef if $interfaceName eq 'Object'; | 296 return undef if $interfaceName eq 'Object'; |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { | 786 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { |
| 763 $found = 1; | 787 $found = 1; |
| 764 } | 788 } |
| 765 return 1 if $found; | 789 return 1 if $found; |
| 766 }, 0); | 790 }, 0); |
| 767 | 791 |
| 768 return $found; | 792 return $found; |
| 769 } | 793 } |
| 770 | 794 |
| 771 1; | 795 1; |
| OLD | NEW |