| OLD | NEW |
| 1 #!/usr/bin/perl -w | 1 #!/usr/bin/perl -w -I../../core/scripts -I../../../JSON/out/lib/perl5 |
| 2 # | 2 # |
| 3 # Copyright (C) 2005 Apple Computer, Inc. | 3 # Copyright (C) 2005 Apple Computer, Inc. |
| 4 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> | 4 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> |
| 5 # | 5 # |
| 6 # This file is part of WebKit | 6 # This file is part of WebKit |
| 7 # | 7 # |
| 8 # This library is free software; you can redistribute it and/or | 8 # This library is free software; you can redistribute it and/or |
| 9 # modify it under the terms of the GNU Library General Public | 9 # modify it under the terms of the GNU Library General Public |
| 10 # License as published by the Free Software Foundation; either | 10 # License as published by the Free Software Foundation; either |
| 11 # version 2 of the License, or (at your option) any later version. | 11 # version 2 of the License, or (at your option) any later version. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 31 use strict; | 31 use strict; |
| 32 | 32 |
| 33 use File::Path; | 33 use File::Path; |
| 34 use File::Basename; | 34 use File::Basename; |
| 35 use Getopt::Long; | 35 use Getopt::Long; |
| 36 use Text::ParseWords; | 36 use Text::ParseWords; |
| 37 use Cwd; | 37 use Cwd; |
| 38 | 38 |
| 39 use IDLParser; | 39 use IDLParser; |
| 40 use CodeGeneratorV8; | 40 use CodeGeneratorV8; |
| 41 use IRToFromJSON qw(IRToJSON); |
| 41 | 42 |
| 42 my @idlDirectories; | 43 my @idlDirectories; |
| 43 my $outputDirectory; | 44 my $outputDirectory; |
| 44 my $outputHeadersDirectory; | 45 my $outputHeadersDirectory; |
| 45 my $defines; | 46 my $defines; |
| 46 my $filename; | 47 my $filename; |
| 47 my $preprocessor; | 48 my $preprocessor; |
| 48 my $verbose; | 49 my $verbose; |
| 49 my $supplementalDependencyFile; | 50 my $supplementalDependencyFile; |
| 50 my $additionalIdlFiles; | 51 my $additionalIdlFiles; |
| 51 my $idlAttributesFile; | 52 my $idlAttributesFile; |
| 52 my $writeFileOnlyIfChanged; | 53 my $writeFileOnlyIfChanged; |
| 54 my $dumpJSON = ''; |
| 53 | 55 |
| 54 GetOptions('include=s@' => \@idlDirectories, | 56 GetOptions('include=s@' => \@idlDirectories, |
| 55 'outputDir=s' => \$outputDirectory, | 57 'outputDir=s' => \$outputDirectory, |
| 56 'outputHeadersDir=s' => \$outputHeadersDirectory, | 58 'outputHeadersDir=s' => \$outputHeadersDirectory, |
| 57 'defines=s' => \$defines, | 59 'defines=s' => \$defines, |
| 58 'filename=s' => \$filename, | 60 'filename=s' => \$filename, |
| 59 'preprocessor=s' => \$preprocessor, | 61 'preprocessor=s' => \$preprocessor, |
| 60 'verbose' => \$verbose, | 62 'verbose' => \$verbose, |
| 61 'supplementalDependencyFile=s' => \$supplementalDependencyFile, | 63 'supplementalDependencyFile=s' => \$supplementalDependencyFile, |
| 62 'additionalIdlFiles=s' => \$additionalIdlFiles, | 64 'additionalIdlFiles=s' => \$additionalIdlFiles, |
| 63 'idlAttributesFile=s' => \$idlAttributesFile, | 65 'idlAttributesFile=s' => \$idlAttributesFile, |
| 64 'write-file-only-if-changed=s' => \$writeFileOnlyIfChanged); | 66 'write-file-only-if-changed=s' => \$writeFileOnlyIfChanged, |
| 67 'dump-json' => \$dumpJSON); |
| 65 | 68 |
| 66 my $targetIdlFile = $ARGV[0]; | 69 my $targetIdlFile = $ARGV[0]; |
| 67 | 70 |
| 68 die('Must specify input file.') unless defined($targetIdlFile); | 71 die('Must specify input file.') unless defined($targetIdlFile); |
| 69 die('Must specify output directory.') unless defined($outputDirectory); | 72 die('Must specify output directory.') unless defined($outputDirectory); |
| 70 $defines = "" unless defined($defines); | 73 $defines = "" unless defined($defines); |
| 71 | 74 |
| 72 if (!$outputHeadersDirectory) { | 75 if (!$outputHeadersDirectory) { |
| 73 $outputHeadersDirectory = $outputDirectory; | 76 $outputHeadersDirectory = $outputDirectory; |
| 74 } | 77 } |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 $constant->extendedAttributes->{$extendedAttributeName} = $i
nterface->extendedAttributes->{$extendedAttributeName}; | 180 $constant->extendedAttributes->{$extendedAttributeName} = $i
nterface->extendedAttributes->{$extendedAttributeName}; |
| 178 } | 181 } |
| 179 push(@{$targetDataNode->constants}, $constant); | 182 push(@{$targetDataNode->constants}, $constant); |
| 180 } | 183 } |
| 181 } else { | 184 } else { |
| 182 die "$idlFile is not a supplemental dependency of $targetIdlFile. Th
ere maybe a bug in the the supplemental dependency generator (preprocess_idls.py
).\n"; | 185 die "$idlFile is not a supplemental dependency of $targetIdlFile. Th
ere maybe a bug in the the supplemental dependency generator (preprocess_idls.py
).\n"; |
| 183 } | 186 } |
| 184 } | 187 } |
| 185 } | 188 } |
| 186 | 189 |
| 190 # If dumping JSON, generate JSON output and exit |
| 191 if ($dumpJSON) { |
| 192 my $jsonFilename = "${targetInterfaceName}.json"; |
| 193 my $jsonText = IRToJSON($targetDocument); |
| 194 open FH, "> ${outputDirectory}/${jsonFilename}" or die "Cannot open $jsonFil
ename\n"; |
| 195 print FH $jsonText; |
| 196 close FH; |
| 197 exit 0; |
| 198 } |
| 199 |
| 187 # Generate desired output for the target IDL file. | 200 # Generate desired output for the target IDL file. |
| 188 my @dependentIdlFiles = ($targetDocument->fileName(), @supplementedIdlFiles); | 201 my @dependentIdlFiles = ($targetDocument->fileName(), @supplementedIdlFiles); |
| 189 my $codeGenerator = CodeGeneratorV8->new($targetDocument, \@idlDirectories, $pre
processor, $defines, $verbose, \@dependentIdlFiles, $writeFileOnlyIfChanged); | 202 my $codeGenerator = CodeGeneratorV8->new($targetDocument, \@idlDirectories, $pre
processor, $defines, $verbose, \@dependentIdlFiles, $writeFileOnlyIfChanged); |
| 190 my $interfaces = $targetDocument->interfaces; | 203 my $interfaces = $targetDocument->interfaces; |
| 191 foreach my $interface (@$interfaces) { | 204 foreach my $interface (@$interfaces) { |
| 192 print "Generating bindings code for IDL interface \"" . $interface->name . "
\"...\n" if $verbose; | 205 print "Generating bindings code for IDL interface \"" . $interface->name . "
\"...\n" if $verbose; |
| 193 $codeGenerator->GenerateInterface($interface); | 206 $codeGenerator->GenerateInterface($interface); |
| 194 $codeGenerator->WriteData($interface, $outputDirectory, $outputHeadersDirect
ory); | 207 $codeGenerator->WriteData($interface, $outputDirectory, $outputHeadersDirect
ory); |
| 195 } | 208 } |
| 196 | 209 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 last OUTER; | 304 last OUTER; |
| 292 } | 305 } |
| 293 } | 306 } |
| 294 } | 307 } |
| 295 if ($error) { | 308 if ($error) { |
| 296 die "IDL ATTRIBUTE CHECKER ERROR: $error | 309 die "IDL ATTRIBUTE CHECKER ERROR: $error |
| 297 If you want to add a new IDL attribute, you need to add it to bindings/scripts/I
DLAttributes.txt and add explanations to the Blink IDL document (http://chromium
.org/blink/webidl). | 310 If you want to add a new IDL attribute, you need to add it to bindings/scripts/I
DLAttributes.txt and add explanations to the Blink IDL document (http://chromium
.org/blink/webidl). |
| 298 "; | 311 "; |
| 299 } | 312 } |
| 300 } | 313 } |
| OLD | NEW |