| OLD | NEW |
| 1 #!/usr/bin/perl -w | 1 #!/usr/bin/perl -w |
| 2 | 2 |
| 3 # Copyright (C) 2005, 2006, 2007, 2009 Apple Inc. All rights reserved. | 3 # Copyright (C) 2005, 2006, 2007, 2009 Apple Inc. All rights reserved. |
| 4 # Copyright (C) 2009, Julien Chaffraix <jchaffraix@webkit.org> | 4 # Copyright (C) 2009, Julien Chaffraix <jchaffraix@webkit.org> |
| 5 # Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmob
ile.com/) | 5 # Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmob
ile.com/) |
| 6 # Copyright (C) 2011 Ericsson AB. All rights reserved. | 6 # Copyright (C) 2011 Ericsson AB. All rights reserved. |
| 7 # Copyright (C) 2011 Google, Inc. All rights reserved. | 7 # Copyright (C) 2011 Google, Inc. All rights reserved. |
| 8 # | 8 # |
| 9 # Redistribution and use in source and binary forms, with or without | 9 # Redistribution and use in source and binary forms, with or without |
| 10 # modification, are permitted provided that the following conditions | 10 # modification, are permitted provided that the following conditions |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 my $InCompiler = InFilesCompiler->new(\%defaultParameters, \&defaultItemFactory)
; | 49 my $InCompiler = InFilesCompiler->new(\%defaultParameters, \&defaultItemFactory)
; |
| 50 | 50 |
| 51 my $outputDir = $InCompiler->initializeFromCommandLine(); | 51 my $outputDir = $InCompiler->initializeFromCommandLine(); |
| 52 $InCompiler->compile(\&generateCode); | 52 $InCompiler->compile(\&generateCode); |
| 53 | 53 |
| 54 sub generateCode() | 54 sub generateCode() |
| 55 { | 55 { |
| 56 my $parsedParametersRef = shift; | 56 my $parsedParametersRef = shift; |
| 57 my $parsedItemsRef = shift; | 57 my $parsedItemsRef = shift; |
| 58 my $parsedItemPathsRef = shift; |
| 58 | 59 |
| 59 generateHeader($parsedParametersRef, $parsedItemsRef); | 60 generateHeader($parsedParametersRef, $parsedItemsRef); |
| 60 generateImplementation($parsedParametersRef, $parsedItemsRef); | 61 generateImplementation($parsedParametersRef, $parsedItemsRef, $parsedItemPat
hsRef); |
| 61 $InCompiler->generateInterfacesHeader(); | 62 $InCompiler->generateInterfacesHeader(); |
| 62 $InCompiler->generateHeadersHeader() | 63 $InCompiler->generateHeadersHeader() |
| 63 } | 64 } |
| 64 | 65 |
| 65 sub generateHeader() | 66 sub generateHeader() |
| 66 { | 67 { |
| 67 my $parsedParametersRef = shift; | 68 my $parsedParametersRef = shift; |
| 68 my $parsedItemsRef = shift; | 69 my $parsedItemsRef = shift; |
| 69 | 70 |
| 70 my $F; | 71 my $F; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 print F "\n"; | 122 print F "\n"; |
| 122 print F "#endif // ExceptionCodeDescription_h\n"; | 123 print F "#endif // ExceptionCodeDescription_h\n"; |
| 123 | 124 |
| 124 close F; | 125 close F; |
| 125 } | 126 } |
| 126 | 127 |
| 127 sub generateImplementation() | 128 sub generateImplementation() |
| 128 { | 129 { |
| 129 my $parsedParametersRef = shift; | 130 my $parsedParametersRef = shift; |
| 130 my $parsedItemsRef = shift; | 131 my $parsedItemsRef = shift; |
| 132 my $parsedItemPathsRef = shift; |
| 131 | 133 |
| 132 my $F; | 134 my $F; |
| 133 my %parsedItems = %{ $parsedItemsRef }; | 135 my %parsedItems = %{ $parsedItemsRef }; |
| 136 my %parsedItemPaths = %{ $parsedItemPathsRef }; |
| 134 | 137 |
| 135 my $outputFile = "$outputDir/ExceptionCodeDescription.cpp"; | 138 my $outputFile = "$outputDir/ExceptionCodeDescription.cpp"; |
| 136 | 139 |
| 137 open F, ">$outputFile" or die "Failed to open file: $!"; | 140 open F, ">$outputFile" or die "Failed to open file: $!"; |
| 138 | 141 |
| 139 print F $InCompiler->license(); | 142 print F $InCompiler->license(); |
| 140 | 143 |
| 141 print F "#include \"config.h\"\n"; | 144 print F "#include \"config.h\"\n"; |
| 142 print F "#include \"ExceptionCodeDescription.h\"\n"; | 145 print F "#include \"ExceptionCodeDescription.h\"\n"; |
| 143 print F "\n"; | 146 print F "\n"; |
| 144 print F "#include \"ExceptionCode.h\"\n"; | 147 print F "#include \"ExceptionCode.h\"\n"; |
| 145 | 148 |
| 146 for my $exceptionType (sort keys %parsedItems) { | 149 for my $exceptionType (sort keys %parsedItems) { |
| 147 my $conditional = $parsedItems{$exceptionType}{"conditional"}; | 150 my $conditional = $parsedItems{$exceptionType}{"conditional"}; |
| 148 | 151 |
| 149 print F "#if ENABLE($conditional)\n" if $conditional; | 152 print F "#if ENABLE($conditional)\n" if $conditional; |
| 150 print F "#include \"$exceptionType.h\"\n"; | 153 my $path = "$exceptionType.h"; |
| 154 $path = $parsedItemPaths{$exceptionType} . "/" . $path if defined($parse
dItemPaths{$exceptionType}); |
| 155 print F "#include \"$path\"\n"; |
| 151 print F "#endif\n" if $conditional; | 156 print F "#endif\n" if $conditional; |
| 152 } | 157 } |
| 153 | 158 |
| 154 print F "#include \"IDBDatabaseException.h\"\n"; | 159 print F "#include \"IDBDatabaseException.h\"\n"; |
| 155 | 160 |
| 156 print F "\n"; | 161 print F "\n"; |
| 157 print F "namespace WebCore {\n"; | 162 print F "namespace WebCore {\n"; |
| 158 print F "\n"; | 163 print F "\n"; |
| 159 print F "ExceptionCodeDescription::ExceptionCodeDescription(ExceptionCode ec
)\n"; | 164 print F "ExceptionCodeDescription::ExceptionCodeDescription(ExceptionCode ec
)\n"; |
| 160 print F "{\n"; | 165 print F "{\n"; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 181 | 186 |
| 182 print F " if (DOMCoreException::initializeDescription(ec, this))\n"; | 187 print F " if (DOMCoreException::initializeDescription(ec, this))\n"; |
| 183 print F " return;\n"; | 188 print F " return;\n"; |
| 184 print F " ASSERT_NOT_REACHED();\n"; | 189 print F " ASSERT_NOT_REACHED();\n"; |
| 185 print F "}\n"; | 190 print F "}\n"; |
| 186 print F "\n"; | 191 print F "\n"; |
| 187 print F "} // namespace WebCore\n"; | 192 print F "} // namespace WebCore\n"; |
| 188 | 193 |
| 189 close F; | 194 close F; |
| 190 } | 195 } |
| OLD | NEW |