# HG changeset patch # User Matti Hamalainen # Date 1451536403 -7200 # Node ID 0a62974ff1f3ca0f2e66ad51c5ce97e9fadc9971 # Parent 02b421843a90ed23728b9ca8f122d8150b692547 Use modern [] style array definitions instead of array() in PHP output. diff -r 02b421843a90 -r 0a62974ff1f3 materials/parsealloys.pl --- a/materials/parsealloys.pl Thu Dec 31 06:32:55 2015 +0200 +++ b/materials/parsealloys.pl Thu Dec 31 06:33:23 2015 +0200 @@ -127,24 +127,24 @@ ## Output the results if ($mode eq "-php") { - print " "; if (scalar(keys %{$final{$min1}}) > 0) { - print "array("; + print "["; foreach my $min2 (sort { $a cmp $b } keys %{$final{$min1}}) { - print "\"$min2\" => array("; + print "\"$min2\" => ["; foreach my $res (sort { $final{$min1}{$min2}{$a} <=> $final{$min1}{$min2}{$b} } keys %{$final{$min1}{$min2}}) { print "\"$res\" => ".$final{$min1}{$min2}{$res}.", "; } - print "), "; + print "], "; } - print "),\n"; + print "],\n"; } else { @@ -152,7 +152,7 @@ } } - print ");\n\n"; + print "];\n\n"; # Create 'reverse' alloy table my %restab = (); @@ -181,26 +181,26 @@ } } - print "\$alloyRevTable = array(\n"; + print "\$alloyRevTable = [\n"; foreach my $res (sort { $a cmp $b } keys %restab) { - print " \"$res\" => array(\n"; + print " \"$res\" => [\n"; foreach my $min1 (sort { $a cmp $b } keys %{$restab{$res}}) { if (scalar(keys %{$restab{$res}{$min1}}) > 0) { - print " \"$min1\" => array("; + print " \"$min1\" => ["; foreach my $min2 (sort { $a cmp $b } keys %{$restab{$res}{$min1}}) { print "\"$min2\" => ".$restab{$res}{$min1}{$min2}.","; } - print "),\n"; + print "],\n"; } } - print " ),\n"; + print " ],\n"; } - print ");\n\n". + print "];\n\n". "?>"; } elsif ($mode eq "-text") diff -r 02b421843a90 -r 0a62974ff1f3 materials/parsematerial.pl --- a/materials/parsematerial.pl Thu Dec 31 06:32:55 2015 +0200 +++ b/materials/parsematerial.pl Thu Dec 31 06:33:23 2015 +0200 @@ -690,14 +690,14 @@ ### elsif ($opt_mode eq "-php") { - print " $b } keys %$transTable) { - print " array("; + print " ["; foreach my $j (sort { $$transTable{$i}{$a} <=> $$transTable{$i}{$b} } keys %{$$transTable{$i}}) { print $$transTable{$i}{$j}; @@ -705,26 +705,26 @@ $j =~ s/incredibly /incr./; print " => \"".$j."\"," } - print "),\n"; + print "],\n"; } - print ");\n\n". - "\$matDataTable = array(\n"; + print "];\n\n". + "\$matDataTable = [\n"; foreach my $name (sort { $a cmp $b } keys %$data) { - print " \"$name\" => array("; + print " \"$name\" => ["; for (my $qn = 1; $qn < scalar(@fieldInfo); $qn++) { my $i = $fieldInfo[$qn]{"i"}; if (ref($$data{$name}{$i}) eq "ARRAY") { - print "array(".join(",", @{$$data{$name}{$i}})."),"; + print "[".join(",", @{$$data{$name}{$i}})."],"; } else { print $$data{$name}{$i}.", "; } } - print "),\n"; + print "],\n"; } - print ");\n?>\n"; + print "];\n?>\n"; }