| Index: Source/bindings/scripts/generate-bindings.pl
|
| diff --git a/Source/bindings/scripts/generate-bindings.pl b/Source/bindings/scripts/generate-bindings.pl
|
| index b3f3d43298ac01f3e561873f5119d564763adf41..fec5b22b20c995896ae3782a66b1c76d342f7ece 100755
|
| --- a/Source/bindings/scripts/generate-bindings.pl
|
| +++ b/Source/bindings/scripts/generate-bindings.pl
|
| @@ -1,4 +1,4 @@
|
| -#!/usr/bin/perl -w
|
| +#!/usr/bin/perl -w -I../../core/scripts -I../../../JSON/out/lib/perl5
|
| #
|
| # Copyright (C) 2005 Apple Computer, Inc.
|
| # Copyright (C) 2006 Anders Carlsson <andersca@mac.com>
|
| @@ -38,6 +38,7 @@ use Cwd;
|
|
|
| use IDLParser;
|
| use CodeGeneratorV8;
|
| +use IRToFromJSON qw(IRToJSON);
|
|
|
| my @idlDirectories;
|
| my $outputDirectory;
|
| @@ -50,6 +51,7 @@ my $supplementalDependencyFile;
|
| my $additionalIdlFiles;
|
| my $idlAttributesFile;
|
| my $writeFileOnlyIfChanged;
|
| +my $dumpJSON = '';
|
|
|
| GetOptions('include=s@' => \@idlDirectories,
|
| 'outputDir=s' => \$outputDirectory,
|
| @@ -61,7 +63,8 @@ GetOptions('include=s@' => \@idlDirectories,
|
| 'supplementalDependencyFile=s' => \$supplementalDependencyFile,
|
| 'additionalIdlFiles=s' => \$additionalIdlFiles,
|
| 'idlAttributesFile=s' => \$idlAttributesFile,
|
| - 'write-file-only-if-changed=s' => \$writeFileOnlyIfChanged);
|
| + 'write-file-only-if-changed=s' => \$writeFileOnlyIfChanged,
|
| + 'dump-json' => \$dumpJSON);
|
|
|
| my $targetIdlFile = $ARGV[0];
|
|
|
| @@ -184,6 +187,16 @@ foreach my $idlFile (@supplementedIdlFiles) {
|
| }
|
| }
|
|
|
| +# If dumping JSON, generate JSON output and exit
|
| +if ($dumpJSON) {
|
| + my $jsonFilename = "${targetInterfaceName}.json";
|
| + my $jsonText = IRToJSON($targetDocument);
|
| + open FH, "> ${outputDirectory}/${jsonFilename}" or die "Cannot open $jsonFilename\n";
|
| + print FH $jsonText;
|
| + close FH;
|
| + exit 0;
|
| +}
|
| +
|
| # Generate desired output for the target IDL file.
|
| my @dependentIdlFiles = ($targetDocument->fileName(), @supplementedIdlFiles);
|
| my $codeGenerator = CodeGeneratorV8->new($targetDocument, \@idlDirectories, $preprocessor, $defines, $verbose, \@dependentIdlFiles, $writeFileOnlyIfChanged);
|
|
|