#!/usr/bin/perl -w
-# Copyright (C) 2007 Apple Inc. All rights reserved.
+# Copyright (C) 2007 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
my ($filename) = @_;
open FILE, "<", $filename or die;
my $foundStart = 0;
+ my $foundOutput = 0;
my $foundEnd = 0;
my $result = "";
while (<FILE>) {
if (!$foundStart) {
- if (/^[[][{]$/) {
- $foundStart = 1;
- $result .= $_;
- }
- } else {
- if (/^[}][]]$/) {
- $foundEnd = 1;
- chomp;
- $result .= $_;
- last;
- } else {
- $result .= $_;
- }
- }
+ if (/^\[\{$/) {
+ $foundStart = 1;
+ $result .= $_;
+ } elsif (/^var \w+ = \[$/) {
+ $foundOutput = 1;
+ } elsif ($foundOutput && /^\{$/) {
+ $foundOutput = 0;
+ $foundStart = 1;
+ $result = "[{\n";
+ }
+ } else {
+ if (/\];?$/) {
+ $foundEnd = 1;
+ chomp;
+ s/;$//;
+ $result .= $_;
+ last;
+ } else {
+ $result .= $_;
+ }
+ }
}
close FILE;
dumpToFile($output, "tmp/sunspider-comparison-data.js");
-system("$jsShellPath", "-f", "tmp/sunspider-test-prefix.js", "-f", "tmp/sunspider-comparison-data.js", "-f", "resources/sunspider-compare-results.js");
+system($jsShellPath, "-f", "tmp/sunspider-test-prefix.js", "-f", "tmp/sunspider-comparison-data.js", "-f", "resources/sunspider-compare-results.js");