Changeset 82807 in webkit


Ignore:
Timestamp:
Apr 4, 2011 2:03:03 AM (13 years ago)
Author:
loislo@chromium.org
Message:

2011-04-04 Ilya Tikhonovsky <loislo@chromium.org>

Reviewed by Yury Semikhatsky.

Web Inspector: remove obsolete doc generating code from CodeGenerator.
https://bugs.webkit.org/show_bug.cgi?id=57748

  • inspector/CodeGeneratorInspector.pm:
Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r82806 r82807  
     12011-04-04  Ilya Tikhonovsky  <loislo@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: remove obsolete doc generating code from CodeGenerator.
     6        https://bugs.webkit.org/show_bug.cgi?id=57748
     7
     8        * inspector/CodeGeneratorInspector.pm:
     9
    1102011-04-04  Andrey Kosyakov  <caseq@chromium.org>
    211
  • trunk/Source/WebCore/inspector/CodeGeneratorInspector.pm

    r82804 r82807  
    106106    "JSONType" => "Object",
    107107    "JSType" => "object",
    108     "DocType" => "%s"
    109108};
    110109$typeTransform{"Array"} = {
     
    116115    "JSONType" => "Array",
    117116    "JSType" => "object",
    118     "DocType" => "array of %s"
    119117};
    120118$typeTransform{"Value"} = {
     
    126124    "JSONType" => "Value",
    127125    "JSType" => "",
    128     "DocType" => "value"
    129126};
    130127$typeTransform{"String"} = {
     
    237234my @frontendFooter;
    238235
    239 my @documentationToc;
    240 my @documentationLines;
    241 
    242236# Default constructor
    243237sub new
     
    347341            generateBackendFunction($interface, $function);
    348342        }
    349     }
    350 
    351     push(@documentationToc, "<li><a href='#" . $interface->name . "'>" . $interface->name . "</a></li>");
    352     push(@documentationLines, "<h2 id='" . $interface->name . "'><a name=" . $interface->name . "></a>" . $interface->name . "</h2>");
    353 
    354     push(@documentationLines, "<h3>Events</h3>");
    355     foreach my $function (grep($_->signature->extendedAttributes->{"event"}, @{$interface->functions}) ) {
    356         generateDocumentationEvent($interface, $function);
    357     }
    358 
    359     push(@documentationLines, "<h3>Commands</h3>");
    360     foreach my $function (grep(!$_->signature->extendedAttributes->{"event"}, @{$interface->functions})) {
    361         generateDocumentationCommand($interface, $function);
    362343    }
    363344
     
    400381}
    401382
    402 sub generateDocumentationEvent
    403 {
    404     my $interface = shift;
    405     my $function = shift;
    406 
    407     my $functionName = $function->signature->name;
    408     my $domain = $interface->name;
    409 
    410     my @argsFiltered = grep($_->direction eq "out", @{$function->parameters});
    411 
    412     my @lines;
    413     push(@lines, "<h4>" . $interface->name . "." . ${functionName} . "</h4>");
    414     my $doc = $function->signature->extendedAttributes->{"doc"};
    415     if ($doc) {
    416         push(@lines, $doc);
    417     }
    418 
    419     push(@lines, "<pre style='background: lightGrey; padding: 10px'>");
    420     push(@lines, "{");
    421     push(@lines, "    type: \"event\",");
    422     push(@lines, "    domain: \"$domain\",");
    423     if (scalar(@argsFiltered)) {
    424         push(@lines, "    event: \"${functionName}\",");
    425         push(@lines, "    data: {");
    426         my @parameters;
    427         foreach my $parameter (@argsFiltered) {
    428             push(@parameters, "        " . parameterDocLine($parameter));
    429         }
    430         push(@lines, join(",\n", @parameters));
    431         push(@lines, "    }");
    432     } else {
    433         push(@lines, "    event: \"${functionName}\"");
    434     }
    435     push(@lines, "}");
    436     push(@lines, "</pre>");
    437     push(@documentationLines, @lines);
    438 }
    439 
    440383sub camelCase
    441384{
     
    541484}
    542485
    543 sub generateDocumentationCommand
    544 {
    545     my $interface = shift;
    546     my $function = shift;
    547 
    548     my $functionName = $function->signature->name;
    549     my $domain = $interface->name;
    550 
    551     my @lines;
    552 
    553     push(@lines, "<h4>" . $interface->name . "." . ${functionName} . "</h4>");
    554     my $doc = $function->signature->extendedAttributes->{"doc"};
    555     if ($doc) {
    556         push(@lines, $doc);
    557     }
    558 
    559     my @inArgs = grep($_->direction eq "in" && !($_->name eq "callId") , @{$function->parameters});
    560     push(@lines, "<pre style='background: lightGrey; padding: 10px'>");
    561     push(@lines, "request: {");
    562     push(@lines, "    id: &lt;number&gt;,");
    563     push(@lines, "    type: \"request\",");
    564     push(@lines, "    domain: \"" . $interface->name . "\",");
    565     if (scalar(@inArgs)) {
    566         push(@lines, "    command: \"${functionName}\",");
    567         push(@lines, "    arguments: {");
    568         my @parameters;
    569         foreach my $parameter (@inArgs) {
    570             push(@parameters, "        " . parameterDocLine($parameter));
    571         }
    572         push(@lines, join(",\n", @parameters));
    573         push(@lines, "    }");
    574     } else {
    575         push(@lines, "    command: \"${functionName}\"");
    576     }
    577     push(@lines, "}");
    578 
    579     my @outArgs = grep($_->direction eq "out", @{$function->parameters});   
    580     push(@lines, "");
    581     push(@lines, "response: {");
    582     push(@lines, "    requestId: &lt;number&gt;,");
    583     if (scalar(@outArgs)) {
    584         push(@lines, "    type: \"response\",");
    585         push(@lines, "    body: {");
    586             my @parameters;
    587             foreach my $parameter (@outArgs) {
    588                 push(@parameters, "        " . parameterDocLine($parameter));
    589             }
    590             push(@lines, join(",\n", @parameters));
    591         push(@lines, "    }");
    592     } else {
    593         push(@lines, "    type: \"response\"");
    594     }
    595     push(@lines, "}");
    596     push(@lines, "</pre>");
    597 
    598     push(@documentationLines, @lines);
    599 }
    600 
    601486sub generateBackendReportProtocolError
    602487{
     
    1041926}
    1042927
    1043 sub parameterDocType
    1044 {
    1045     my $parameter = shift;
    1046     my $subtype = $parameter->extendedAttributes->{"type"};
    1047     if ($subtype) {
    1048         my $pattern = typeTraits($parameter->type, "DocType");
    1049         return sprintf($pattern, "&lt;$subtype&gt;");
    1050     }
    1051 
    1052     my $subtypeRef = $parameter->extendedAttributes->{"typeRef"};
    1053     if ($subtypeRef) {
    1054         my $pattern = typeTraits($parameter->type, "DocType");
    1055         return sprintf($pattern, "&lt;<a href='#$subtypeRef'>" . $subtypeRef . "</a>&gt;");
    1056     }
    1057 
    1058     return "&lt;" . typeTraits($parameter->type, "JSType") . "&gt;";
    1059 }
    1060 
    1061 sub parameterDocLine
    1062 {
    1063     my $parameter = shift;
    1064 
    1065     my $result = $parameter->name . ": " . parameterDocType($parameter);
    1066     my $doc = $parameter->extendedAttributes->{"doc"};
    1067     if ($doc) {
    1068         $result = $result . " // " . $doc;
    1069     }
    1070     return $result;
    1071 }
    1072 
    1073928sub generateBackendAgentFieldsAndConstructor
    1074929{
     
    11521007    close($JS_STUB);
    11531008    undef($JS_STUB);
    1154 
    1155     open(my $DOCS, ">$outputDir/WebInspectorProtocol.html") || die "Couldn't open file $outputDir/WebInspectorProtocol.html";
    1156     print $DOCS "<ol class='toc' style='list-style: none; padding: 0'>";
    1157     print $DOCS join("\n", @documentationToc);
    1158     print $DOCS "</ol>";
    1159     print $DOCS join("\n", @documentationLines);
    1160     close($DOCS);
    1161     undef($DOCS);
    11621009}
    11631010
Note: See TracChangeset for help on using the changeset viewer.