| OLD | NEW |
| 1 #!/usr/bin/perl -w | 1 #!/usr/bin/perl -w |
| 2 | 2 |
| 3 # Copyright (C) 2011 Adam Barth <abarth@webkit.org> | 3 # Copyright (C) 2011 Adam Barth <abarth@webkit.org> |
| 4 # | 4 # |
| 5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
| 6 # modification, are permitted provided that the following conditions | 6 # modification, are permitted provided that the following conditions |
| 7 # are met: | 7 # are met: |
| 8 # 1. Redistributions of source code must retain the above copyright | 8 # 1. Redistributions of source code must retain the above copyright |
| 9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
| 10 # 2. Redistributions in binary form must reproduce the above copyright | 10 # 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 use Getopt::Long; | 30 use Getopt::Long; |
| 31 use File::Path; | 31 use File::Path; |
| 32 use File::Spec; | 32 use File::Spec; |
| 33 use IO::File; | 33 use IO::File; |
| 34 use InFilesParser; | 34 use InFilesParser; |
| 35 | 35 |
| 36 require Config; | 36 require Config; |
| 37 | 37 |
| 38 package InFilesCompiler; | 38 package InFilesCompiler; |
| 39 | 39 |
| 40 use FindBin; # locate this script |
| 41 use lib "$FindBin::Bin/../../../../../third_party/WebKit/Source/bindings/scripts
"; # use the binding generator directory. |
| 42 #use lib "$FindBin::Bin/../../bindings/scripts"; # use the binding generator di
rectory. |
| 43 use idltopath; |
| 44 |
| 40 my $inputFile = ""; | 45 my $inputFile = ""; |
| 41 my $outputDir = "."; | 46 my $outputDir = "."; |
| 42 my $defaultItemFactory; | 47 my $defaultItemFactory; |
| 43 | 48 |
| 44 my %parsedItems; | 49 my %parsedItems; |
| 45 my %parsedParameters; | 50 my %parsedParameters; |
| 46 | 51 |
| 47 sub itemHandler($$$) | 52 sub itemHandler($$$) |
| 48 { | 53 { |
| 49 my ($itemName, $property, $value) = @_; | 54 my ($itemName, $property, $value) = @_; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 die "Failed to read from file: $inputFile" if (keys %parsedItems == 0); | 114 die "Failed to read from file: $inputFile" if (keys %parsedItems == 0); |
| 110 | 115 |
| 111 &$generateCode(\%parsedParameters, \%parsedItems); | 116 &$generateCode(\%parsedParameters, \%parsedItems); |
| 112 } | 117 } |
| 113 | 118 |
| 114 sub license() | 119 sub license() |
| 115 { | 120 { |
| 116 return "/* | 121 return "/* |
| 117 * THIS FILE WAS AUTOMATICALLY GENERATED, DO NOT EDIT. | 122 * THIS FILE WAS AUTOMATICALLY GENERATED, DO NOT EDIT. |
| 118 * | 123 * |
| 124 * This file was generated by the make_names.pl/InFilesCompiler.pm script. |
| 125 * |
| 119 * Copyright (C) 2011 Google Inc. All rights reserved. | 126 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 120 * | 127 * |
| 121 * Redistribution and use in source and binary forms, with or without | 128 * Redistribution and use in source and binary forms, with or without |
| 122 * modification, are permitted provided that the following conditions | 129 * modification, are permitted provided that the following conditions |
| 123 * are met: | 130 * are met: |
| 124 * 1. Redistributions of source code must retain the above copyright | 131 * 1. Redistributions of source code must retain the above copyright |
| 125 * notice, this list of conditions and the following disclaimer. | 132 * notice, this list of conditions and the following disclaimer. |
| 126 * 2. Redistributions in binary form must reproduce the above copyright | 133 * 2. Redistributions in binary form must reproduce the above copyright |
| 127 * notice, this list of conditions and the following disclaimer in the | 134 * notice, this list of conditions and the following disclaimer in the |
| 128 * documentation and/or other materials provided with the distribution. | 135 * documentation and/or other materials provided with the distribution. |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 print F "\n"; | 276 print F "\n"; |
| 270 | 277 |
| 271 my %includedInterfaces = (); | 278 my %includedInterfaces = (); |
| 272 | 279 |
| 273 for my $itemName (sort keys %parsedItems) { | 280 for my $itemName (sort keys %parsedItems) { |
| 274 my $conditional = $parsedItems{$itemName}{"conditional"}; | 281 my $conditional = $parsedItems{$itemName}{"conditional"}; |
| 275 my $interfaceName = $object->interfaceForItem($itemName); | 282 my $interfaceName = $object->interfaceForItem($itemName); |
| 276 | 283 |
| 277 next if defined($includedInterfaces{$interfaceName}); | 284 next if defined($includedInterfaces{$interfaceName}); |
| 278 $includedInterfaces{$interfaceName} = 1; | 285 $includedInterfaces{$interfaceName} = 1; |
| 286 my $includepath = idl_to_path($interfaceName); |
| 279 | 287 |
| 280 print F "#if " . $object->conditionalStringFromAttributeValue($condition
al) . "\n" if $conditional; | 288 print F "#if " . $object->conditionalStringFromAttributeValue($condition
al) . "\n" if $conditional; |
| 281 print F "#include \"$interfaceName.h\"\n"; | 289 print F "#include \"$includepath$interfaceName.h\"\n"; |
| 282 print F "#include \"V8$interfaceName.h\"\n"; | 290 print F "#include \"V8$interfaceName.h\"\n"; |
| 283 print F "#endif\n" if $conditional; | 291 print F "#endif\n" if $conditional; |
| 284 } | 292 } |
| 285 | 293 |
| 286 print F "\n"; | 294 print F "\n"; |
| 287 print F "#endif // ${namespace}Headers_h\n"; | 295 print F "#endif // ${namespace}Headers_h\n"; |
| 288 | 296 |
| 289 close F; | 297 close F; |
| 290 } | 298 } |
| 291 | 299 |
| 292 1; | 300 1; |
| OLD | NEW |