| OLD | NEW |
| 1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 package CodeGeneratorInspector; | 5 package CodeGeneratorInspector; |
| 6 | 6 |
| 7 use strict; | 7 use strict; |
| 8 | 8 |
| 9 use Class::Struct; | 9 use Class::Struct; |
| 10 use File::stat; | 10 use File::stat; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 "domainAccessor" => "m_timelineAgent", | 86 "domainAccessor" => "m_timelineAgent", |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 $typeTransform{"Frontend"} = { | 89 $typeTransform{"Frontend"} = { |
| 90 "forward" => "InspectorFrontend", | 90 "forward" => "InspectorFrontend", |
| 91 "header" => "InspectorFrontend.h", | 91 "header" => "InspectorFrontend.h", |
| 92 }; | 92 }; |
| 93 $typeTransform{"PassRefPtr"} = { | 93 $typeTransform{"PassRefPtr"} = { |
| 94 "forwardHeader" => "wtf/PassRefPtr.h", | 94 "forwardHeader" => "wtf/PassRefPtr.h", |
| 95 }; | 95 }; |
| 96 $typeTransform{"RefCounted"} = { |
| 97 "forwardHeader" => "wtf/RefCounted.h", |
| 98 }; |
| 96 $typeTransform{"InspectorFrontendChannel"} = { | 99 $typeTransform{"InspectorFrontendChannel"} = { |
| 97 "forward" => "InspectorFrontendChannel", | 100 "forward" => "InspectorFrontendChannel", |
| 98 "header" => "InspectorFrontendChannel.h", | 101 "header" => "InspectorFrontendChannel.h", |
| 99 }; | 102 }; |
| 100 $typeTransform{"Object"} = { | 103 $typeTransform{"Object"} = { |
| 101 "param" => "PassRefPtr<InspectorObject>", | 104 "param" => "PassRefPtr<InspectorObject>", |
| 102 "variable" => "RefPtr<InspectorObject>", | 105 "variable" => "RefPtr<InspectorObject>", |
| 103 "defaultValue" => "InspectorObject::create()", | 106 "defaultValue" => "InspectorObject::create()", |
| 104 "forward" => "InspectorObject", | 107 "forward" => "InspectorObject", |
| 105 "header" => "InspectorValues.h", | 108 "header" => "InspectorValues.h", |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 209 |
| 207 my $codeGenerator; | 210 my $codeGenerator; |
| 208 my $outputDir; | 211 my $outputDir; |
| 209 my $outputHeadersDir; | 212 my $outputHeadersDir; |
| 210 my $writeDependencies; | 213 my $writeDependencies; |
| 211 my $verbose; | 214 my $verbose; |
| 212 | 215 |
| 213 my $namespace; | 216 my $namespace; |
| 214 | 217 |
| 215 my $backendClassName; | 218 my $backendClassName; |
| 219 my $backendClassDeclaration; |
| 216 my $backendJSStubName; | 220 my $backendJSStubName; |
| 217 my %backendTypes; | 221 my %backendTypes; |
| 218 my @backendMethods; | 222 my @backendMethods; |
| 219 my @backendMethodsImpl; | 223 my @backendMethodsImpl; |
| 220 my %backendMethodSignatures; | 224 my %backendMethodSignatures; |
| 221 my $backendConstructor; | 225 my $backendConstructor; |
| 222 my @backendConstantDeclarations; | 226 my @backendConstantDeclarations; |
| 223 my @backendConstantDefinitions; | 227 my @backendConstantDefinitions; |
| 224 my @backendFooter; | 228 my @backendFooter; |
| 225 my @backendJSStubs; | 229 my @backendJSStubs; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 | 270 |
| 267 $frontendClassName = "InspectorFrontend"; | 271 $frontendClassName = "InspectorFrontend"; |
| 268 $frontendConstructor = " ${frontendClassName}(InspectorFrontendChannel*);
"; | 272 $frontendConstructor = " ${frontendClassName}(InspectorFrontendChannel*);
"; |
| 269 push(@frontendFooter, "private:"); | 273 push(@frontendFooter, "private:"); |
| 270 push(@frontendFooter, " InspectorFrontendChannel* m_inspectorFrontendChan
nel;"); | 274 push(@frontendFooter, " InspectorFrontendChannel* m_inspectorFrontendChan
nel;"); |
| 271 $frontendTypes{"String"} = 1; | 275 $frontendTypes{"String"} = 1; |
| 272 $frontendTypes{"InspectorFrontendChannel"} = 1; | 276 $frontendTypes{"InspectorFrontendChannel"} = 1; |
| 273 $frontendTypes{"PassRefPtr"} = 1; | 277 $frontendTypes{"PassRefPtr"} = 1; |
| 274 | 278 |
| 275 $backendClassName = "InspectorBackendDispatcher"; | 279 $backendClassName = "InspectorBackendDispatcher"; |
| 280 $backendClassDeclaration = "InspectorBackendDispatcher: public RefCounted<In
spectorBackendDispatcher>"; |
| 276 $backendJSStubName = "InspectorBackendStub"; | 281 $backendJSStubName = "InspectorBackendStub"; |
| 277 $backendTypes{"Inspector"} = 1; | 282 $backendTypes{"Inspector"} = 1; |
| 278 $backendTypes{"InspectorFrontendChannel"} = 1; | 283 $backendTypes{"InspectorFrontendChannel"} = 1; |
| 279 $backendTypes{"PassRefPtr"} = 1; | 284 $backendTypes{"PassRefPtr"} = 1; |
| 285 $backendTypes{"RefCounted"} = 1; |
| 280 $backendTypes{"Object"} = 1; | 286 $backendTypes{"Object"} = 1; |
| 281 } | 287 } |
| 282 | 288 |
| 283 # Params: 'idlDocument' struct | 289 # Params: 'idlDocument' struct |
| 284 sub GenerateInterface | 290 sub GenerateInterface |
| 285 { | 291 { |
| 286 my $object = shift; | 292 my $object = shift; |
| 287 my $interface = shift; | 293 my $interface = shift; |
| 288 my $defines = shift; | 294 my $defines = shift; |
| 289 | 295 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 push(@function, " ${functionName}Message->setString(\"method\", \"$domain
.$functionName\");"); | 383 push(@function, " ${functionName}Message->setString(\"method\", \"$domain
.$functionName\");"); |
| 378 if (scalar(@argsFiltered)) { | 384 if (scalar(@argsFiltered)) { |
| 379 push(@function, " RefPtr<InspectorObject> paramsObject = InspectorObj
ect::create();"); | 385 push(@function, " RefPtr<InspectorObject> paramsObject = InspectorObj
ect::create();"); |
| 380 | 386 |
| 381 foreach my $parameter (@argsFiltered) { | 387 foreach my $parameter (@argsFiltered) { |
| 382 my $optional = $parameter->extendedAttributes->{"optional"} ? "if ("
. $parameter->name . ")\n " : ""; | 388 my $optional = $parameter->extendedAttributes->{"optional"} ? "if ("
. $parameter->name . ")\n " : ""; |
| 383 push(@function, " " . $optional . "paramsObject->set" . typeTrait
s($parameter->type, "JSONType") . "(\"" . $parameter->name . "\", " . $parameter
->name . ");"); | 389 push(@function, " " . $optional . "paramsObject->set" . typeTrait
s($parameter->type, "JSONType") . "(\"" . $parameter->name . "\", " . $parameter
->name . ");"); |
| 384 } | 390 } |
| 385 push(@function, " ${functionName}Message->setObject(\"params\", param
sObject);"); | 391 push(@function, " ${functionName}Message->setObject(\"params\", param
sObject);"); |
| 386 } | 392 } |
| 387 push(@function, " m_inspectorFrontendChannel->sendMessageToFrontend(${fun
ctionName}Message->toJSONString());"); | 393 push(@function, " if (m_inspectorFrontendChannel)"); |
| 394 push(@function, " m_inspectorFrontendChannel->sendMessageToFrontend($
{functionName}Message->toJSONString());"); |
| 388 push(@function, "}"); | 395 push(@function, "}"); |
| 389 push(@function, ""); | 396 push(@function, ""); |
| 390 push(@frontendMethodsImpl, @function); | 397 push(@frontendMethodsImpl, @function); |
| 391 } | 398 } |
| 392 | 399 |
| 393 sub camelCase | 400 sub camelCase |
| 394 { | 401 { |
| 395 my $value = shift; | 402 my $value = shift; |
| 396 $value =~ s/\b(\w)/\U$1/g; # make a camel-case name for type name | 403 $value =~ s/\b(\w)/\U$1/g; # make a camel-case name for type name |
| 397 $value =~ s/ //g; | 404 $value =~ s/ //g; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 push(@function, " reportProtocolError(&callId, ServerError, error);")
; | 489 push(@function, " reportProtocolError(&callId, ServerError, error);")
; |
| 483 push(@function, " return;"); | 490 push(@function, " return;"); |
| 484 push(@function, " }"); | 491 push(@function, " }"); |
| 485 push(@function, ""); | 492 push(@function, ""); |
| 486 push(@function, " RefPtr<InspectorObject> responseMessage = InspectorObje
ct::create();"); | 493 push(@function, " RefPtr<InspectorObject> responseMessage = InspectorObje
ct::create();"); |
| 487 push(@function, " RefPtr<InspectorObject> result = InspectorObject::creat
e();"); | 494 push(@function, " RefPtr<InspectorObject> result = InspectorObject::creat
e();"); |
| 488 push(@function, map(" result->set" . typeTraits($_->type, "JSONType")
. "(\"" . $_->name . "\", out_" . $_->name . ");", @outArgs)); | 495 push(@function, map(" result->set" . typeTraits($_->type, "JSONType")
. "(\"" . $_->name . "\", out_" . $_->name . ");", @outArgs)); |
| 489 push(@function, " responseMessage->setObject(\"result\", result);"); | 496 push(@function, " responseMessage->setObject(\"result\", result);"); |
| 490 push(@function, ""); | 497 push(@function, ""); |
| 491 push(@function, " responseMessage->setNumber(\"id\", callId);"); | 498 push(@function, " responseMessage->setNumber(\"id\", callId);"); |
| 492 push(@function, " m_inspectorFrontendChannel->sendMessageToFrontend(respo
nseMessage->toJSONString());"); | 499 push(@function, " if (m_inspectorFrontendChannel)"); |
| 500 push(@function, " m_inspectorFrontendChannel->sendMessageToFrontend(r
esponseMessage->toJSONString());"); |
| 493 push(@function, "}"); | 501 push(@function, "}"); |
| 494 push(@function, ""); | 502 push(@function, ""); |
| 495 push(@backendMethodsImpl, @function); | 503 push(@backendMethodsImpl, @function); |
| 496 } | 504 } |
| 497 | 505 |
| 498 sub generateBackendReportProtocolError | 506 sub generateBackendReportProtocolError |
| 499 { | 507 { |
| 500 my $reportProtocolError = << "EOF"; | 508 my $reportProtocolError = << "EOF"; |
| 501 | 509 |
| 502 void ${backendClassName}::reportProtocolError(const long* const callId, CommonEr
rorCode code, const String& customText) const | 510 void ${backendClassName}::reportProtocolError(const long* const callId, CommonEr
rorCode code, const String& customText) const |
| (...skipping 20 matching lines...) Expand all Loading... |
| 523 ASSERT(InspectorObject::parseJSON(s_commonErrors[code])); | 531 ASSERT(InspectorObject::parseJSON(s_commonErrors[code])); |
| 524 RefPtr<InspectorObject> error = InspectorObject::parseJSON(s_commonErrors[co
de])->asObject(); | 532 RefPtr<InspectorObject> error = InspectorObject::parseJSON(s_commonErrors[co
de])->asObject(); |
| 525 ASSERT(error); | 533 ASSERT(error); |
| 526 error->setArray("data", data); | 534 error->setArray("data", data); |
| 527 RefPtr<InspectorObject> message = InspectorObject::create(); | 535 RefPtr<InspectorObject> message = InspectorObject::create(); |
| 528 message->setObject("error", error); | 536 message->setObject("error", error); |
| 529 if (callId) | 537 if (callId) |
| 530 message->setNumber("id", *callId); | 538 message->setNumber("id", *callId); |
| 531 else | 539 else |
| 532 message->setValue("id", InspectorValue::null()); | 540 message->setValue("id", InspectorValue::null()); |
| 533 m_inspectorFrontendChannel->sendMessageToFrontend(message->toJSONString()); | 541 if (m_inspectorFrontendChannel) |
| 542 m_inspectorFrontendChannel->sendMessageToFrontend(message->toJSONString(
)); |
| 534 } | 543 } |
| 535 EOF | 544 EOF |
| 536 return split("\n", $reportProtocolError); | 545 return split("\n", $reportProtocolError); |
| 537 } | 546 } |
| 538 | 547 |
| 539 sub generateArgumentGetters | 548 sub generateArgumentGetters |
| 540 { | 549 { |
| 541 my $type = shift; | 550 my $type = shift; |
| 542 my $json = typeTraits($type, "JSONType"); | 551 my $json = typeTraits($type, "JSONType"); |
| 543 my $variable = typeTraits($type, "variable"); | 552 my $variable = typeTraits($type, "variable"); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 574 | 583 |
| 575 sub generateBackendDispatcher | 584 sub generateBackendDispatcher |
| 576 { | 585 { |
| 577 my @body; | 586 my @body; |
| 578 my @mapEntries = map(" dispatchMap.add(${_}Cmd, &${backendClassName}:
:$_);", map ($backendMethodSignatures{$_}, @backendMethods)); | 587 my @mapEntries = map(" dispatchMap.add(${_}Cmd, &${backendClassName}:
:$_);", map ($backendMethodSignatures{$_}, @backendMethods)); |
| 579 my $mapEntries = join("\n", @mapEntries); | 588 my $mapEntries = join("\n", @mapEntries); |
| 580 | 589 |
| 581 my $backendDispatcherBody = << "EOF"; | 590 my $backendDispatcherBody = << "EOF"; |
| 582 void ${backendClassName}::dispatch(const String& message) | 591 void ${backendClassName}::dispatch(const String& message) |
| 583 { | 592 { |
| 593 RefPtr<${backendClassName}> protect = this; |
| 584 typedef void (${backendClassName}::*CallHandler)(long callId, InspectorObjec
t* messageObject); | 594 typedef void (${backendClassName}::*CallHandler)(long callId, InspectorObjec
t* messageObject); |
| 585 typedef HashMap<String, CallHandler> DispatchMap; | 595 typedef HashMap<String, CallHandler> DispatchMap; |
| 586 DEFINE_STATIC_LOCAL(DispatchMap, dispatchMap, ); | 596 DEFINE_STATIC_LOCAL(DispatchMap, dispatchMap, ); |
| 587 long callId = 0; | 597 long callId = 0; |
| 588 | 598 |
| 589 if (dispatchMap.isEmpty()) { | 599 if (dispatchMap.isEmpty()) { |
| 590 $mapEntries | 600 $mapEntries |
| 591 } | 601 } |
| 592 | 602 |
| 593 RefPtr<InspectorValue> parsedMessage = InspectorValue::parseJSON(message); | 603 RefPtr<InspectorValue> parsedMessage = InspectorValue::parseJSON(message); |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 | 883 |
| 874 InspectorBackend = new InspectorBackendStub(); | 884 InspectorBackend = new InspectorBackendStub(); |
| 875 | 885 |
| 876 EOF | 886 EOF |
| 877 return split("\n", $inspectorBackendStubJS); | 887 return split("\n", $inspectorBackendStubJS); |
| 878 } | 888 } |
| 879 | 889 |
| 880 sub generateHeader | 890 sub generateHeader |
| 881 { | 891 { |
| 882 my $className = shift; | 892 my $className = shift; |
| 893 my $classDeclaration = shift; |
| 883 my $types = shift; | 894 my $types = shift; |
| 884 my $constructor = shift; | 895 my $constructor = shift; |
| 885 my $constants = shift; | 896 my $constants = shift; |
| 886 my $methods = shift; | 897 my $methods = shift; |
| 887 my $footer = shift; | 898 my $footer = shift; |
| 888 | 899 |
| 889 my $forwardHeaders = join("\n", sort(map("#include <" . typeTraits($_, "forw
ardHeader") . ">", grep(typeTraits($_, "forwardHeader"), keys %{$types})))); | 900 my $forwardHeaders = join("\n", sort(map("#include <" . typeTraits($_, "forw
ardHeader") . ">", grep(typeTraits($_, "forwardHeader"), keys %{$types})))); |
| 890 my $forwardDeclarations = join("\n", sort(map("class " . typeTraits($_, "for
ward") . ";", grep(typeTraits($_, "forward"), keys %{$types})))); | 901 my $forwardDeclarations = join("\n", sort(map("class " . typeTraits($_, "for
ward") . ";", grep(typeTraits($_, "forward"), keys %{$types})))); |
| 891 my $constantDeclarations = join("\n", @{$constants}); | 902 my $constantDeclarations = join("\n", @{$constants}); |
| 892 my $methodsDeclarations = join("\n", @{$methods}); | 903 my $methodsDeclarations = join("\n", @{$methods}); |
| 893 | 904 |
| 894 my $headerBody = << "EOF"; | 905 my $headerBody = << "EOF"; |
| 895 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 906 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 896 // Use of this source code is governed by a BSD-style license that can be | 907 // Use of this source code is governed by a BSD-style license that can be |
| 897 // found in the LICENSE file. | 908 // found in the LICENSE file. |
| 898 #ifndef ${className}_h | 909 #ifndef ${className}_h |
| 899 #define ${className}_h | 910 #define ${className}_h |
| 900 | 911 |
| 901 ${forwardHeaders} | 912 ${forwardHeaders} |
| 902 | 913 |
| 903 namespace $namespace { | 914 namespace $namespace { |
| 904 | 915 |
| 905 $forwardDeclarations | 916 $forwardDeclarations |
| 906 | 917 |
| 907 typedef String ErrorString; | 918 typedef String ErrorString; |
| 908 | 919 |
| 909 class $className { | 920 class $classDeclaration { |
| 910 public: | 921 public: |
| 911 $constructor | 922 $constructor |
| 912 | 923 |
| 913 $constantDeclarations | 924 $constantDeclarations |
| 914 $methodsDeclarations | 925 $methodsDeclarations |
| 915 | 926 |
| 916 $footer | 927 $footer |
| 917 }; | 928 }; |
| 918 | 929 |
| 919 } // namespace $namespace | 930 } // namespace $namespace |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 986 push(@arguments, "${agentClassName}* ${arg}"); | 997 push(@arguments, "${agentClassName}* ${arg}"); |
| 987 } | 998 } |
| 988 | 999 |
| 989 my $argumentString = join(", ", @arguments); | 1000 my $argumentString = join(", ", @arguments); |
| 990 | 1001 |
| 991 my @backendHead; | 1002 my @backendHead; |
| 992 push(@backendHead, " ${backendClassName}(${argumentString})"); | 1003 push(@backendHead, " ${backendClassName}(${argumentString})"); |
| 993 push(@backendHead, @fieldInitializers); | 1004 push(@backendHead, @fieldInitializers); |
| 994 push(@backendHead, " { }"); | 1005 push(@backendHead, " { }"); |
| 995 push(@backendHead, ""); | 1006 push(@backendHead, ""); |
| 1007 push(@backendHead, " void clearFrontend() { m_inspectorFrontendChannel =
0; }"); |
| 1008 push(@backendHead, ""); |
| 996 push(@backendHead, " enum CommonErrorCode {"); | 1009 push(@backendHead, " enum CommonErrorCode {"); |
| 997 push(@backendHead, " ParseError = 0,"); | 1010 push(@backendHead, " ParseError = 0,"); |
| 998 push(@backendHead, " InvalidRequest,"); | 1011 push(@backendHead, " InvalidRequest,"); |
| 999 push(@backendHead, " MethodNotFound,"); | 1012 push(@backendHead, " MethodNotFound,"); |
| 1000 push(@backendHead, " InvalidParams,"); | 1013 push(@backendHead, " InvalidParams,"); |
| 1001 push(@backendHead, " InternalError,"); | 1014 push(@backendHead, " InternalError,"); |
| 1002 push(@backendHead, " ServerError,"); | 1015 push(@backendHead, " ServerError,"); |
| 1003 push(@backendHead, " LastEntry,"); | 1016 push(@backendHead, " LastEntry,"); |
| 1004 push(@backendHead, " };"); | 1017 push(@backendHead, " };"); |
| 1005 push(@backendHead, ""); | 1018 push(@backendHead, ""); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1017 push(@backendMethodsImpl, generateBackendDispatcher()); | 1030 push(@backendMethodsImpl, generateBackendDispatcher()); |
| 1018 push(@backendMethodsImpl, generateBackendReportProtocolError()); | 1031 push(@backendMethodsImpl, generateBackendReportProtocolError()); |
| 1019 unshift(@frontendMethodsImpl, generateFrontendConstructorImpl(), ""); | 1032 unshift(@frontendMethodsImpl, generateFrontendConstructorImpl(), ""); |
| 1020 | 1033 |
| 1021 open(my $SOURCE, ">$outputDir/$frontendClassName.cpp") || die "Couldn't open
file $outputDir/$frontendClassName.cpp"; | 1034 open(my $SOURCE, ">$outputDir/$frontendClassName.cpp") || die "Couldn't open
file $outputDir/$frontendClassName.cpp"; |
| 1022 print $SOURCE join("\n", generateSource($frontendClassName, \%frontendTypes,
\@frontendConstantDefinitions, \@frontendMethodsImpl)); | 1035 print $SOURCE join("\n", generateSource($frontendClassName, \%frontendTypes,
\@frontendConstantDefinitions, \@frontendMethodsImpl)); |
| 1023 close($SOURCE); | 1036 close($SOURCE); |
| 1024 undef($SOURCE); | 1037 undef($SOURCE); |
| 1025 | 1038 |
| 1026 open(my $HEADER, ">$outputHeadersDir/$frontendClassName.h") || die "Couldn't
open file $outputHeadersDir/$frontendClassName.h"; | 1039 open(my $HEADER, ">$outputHeadersDir/$frontendClassName.h") || die "Couldn't
open file $outputHeadersDir/$frontendClassName.h"; |
| 1027 print $HEADER generateHeader($frontendClassName, \%frontendTypes, $frontendC
onstructor, \@frontendConstantDeclarations, \@frontendMethods, join("\n", @front
endFooter)); | 1040 print $HEADER generateHeader($frontendClassName, $frontendClassName, \%front
endTypes, $frontendConstructor, \@frontendConstantDeclarations, \@frontendMethod
s, join("\n", @frontendFooter)); |
| 1028 close($HEADER); | 1041 close($HEADER); |
| 1029 undef($HEADER); | 1042 undef($HEADER); |
| 1030 | 1043 |
| 1031 # Make dispatcher methods private on the backend. | 1044 # Make dispatcher methods private on the backend. |
| 1032 push(@backendConstantDeclarations, ""); | 1045 push(@backendConstantDeclarations, ""); |
| 1033 push(@backendConstantDeclarations, "private:"); | 1046 push(@backendConstantDeclarations, "private:"); |
| 1034 | 1047 |
| 1035 foreach my $type (keys %backendTypes) { | 1048 foreach my $type (keys %backendTypes) { |
| 1036 if (typeTraits($type, "JSONType")) { | 1049 if (typeTraits($type, "JSONType")) { |
| 1037 push(@backendMethodsImpl, generateArgumentGetters($type)); | 1050 push(@backendMethodsImpl, generateArgumentGetters($type)); |
| 1038 } | 1051 } |
| 1039 } | 1052 } |
| 1040 generateBackendAgentFieldsAndConstructor(); | 1053 generateBackendAgentFieldsAndConstructor(); |
| 1041 | 1054 |
| 1042 push(@backendMethodsImpl, generateBackendMessageParser()); | 1055 push(@backendMethodsImpl, generateBackendMessageParser()); |
| 1043 push(@backendMethodsImpl, ""); | 1056 push(@backendMethodsImpl, ""); |
| 1044 | 1057 |
| 1045 push(@backendConstantDeclarations, ""); | 1058 push(@backendConstantDeclarations, ""); |
| 1046 | 1059 |
| 1047 open($SOURCE, ">$outputDir/$backendClassName.cpp") || die "Couldn't open fil
e $outputDir/$backendClassName.cpp"; | 1060 open($SOURCE, ">$outputDir/$backendClassName.cpp") || die "Couldn't open fil
e $outputDir/$backendClassName.cpp"; |
| 1048 print $SOURCE join("\n", generateSource($backendClassName, \%backendTypes, \
@backendConstantDefinitions, \@backendMethodsImpl)); | 1061 print $SOURCE join("\n", generateSource($backendClassName, \%backendTypes, \
@backendConstantDefinitions, \@backendMethodsImpl)); |
| 1049 close($SOURCE); | 1062 close($SOURCE); |
| 1050 undef($SOURCE); | 1063 undef($SOURCE); |
| 1051 | 1064 |
| 1052 open($HEADER, ">$outputHeadersDir/$backendClassName.h") || die "Couldn't ope
n file $outputHeadersDir/$backendClassName.h"; | 1065 open($HEADER, ">$outputHeadersDir/$backendClassName.h") || die "Couldn't ope
n file $outputHeadersDir/$backendClassName.h"; |
| 1053 print $HEADER join("\n", generateHeader($backendClassName, \%backendTypes, $
backendConstructor, \@backendConstantDeclarations, \@backendMethods, join("\n",
@backendFooter))); | 1066 print $HEADER join("\n", generateHeader($backendClassName, $backendClassDecl
aration, \%backendTypes, $backendConstructor, \@backendConstantDeclarations, \@b
ackendMethods, join("\n", @backendFooter))); |
| 1054 close($HEADER); | 1067 close($HEADER); |
| 1055 undef($HEADER); | 1068 undef($HEADER); |
| 1056 | 1069 |
| 1057 open(my $JS_STUB, ">$outputDir/$backendJSStubName.js") || die "Couldn't open
file $outputDir/$backendJSStubName.js"; | 1070 open(my $JS_STUB, ">$outputDir/$backendJSStubName.js") || die "Couldn't open
file $outputDir/$backendJSStubName.js"; |
| 1058 print $JS_STUB join("\n", generateBackendStubJS()); | 1071 print $JS_STUB join("\n", generateBackendStubJS()); |
| 1059 close($JS_STUB); | 1072 close($JS_STUB); |
| 1060 undef($JS_STUB); | 1073 undef($JS_STUB); |
| 1061 } | 1074 } |
| 1062 | 1075 |
| 1063 1; | 1076 1; |
| OLD | NEW |