summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDave SIMmONs <simon@lindenlab.com>2011-05-24 10:51:09 -0700
committerDave SIMmONs <simon@lindenlab.com>2011-05-24 10:51:09 -0700
commit3dfb4944ed916f9a251078a2614a854b9de0315d (patch)
tree251a82d2511132632d12e36c8e8be0d7bf5b11cf /scripts
parent1a5b3b0a9091a72fd5e5fb395f7f0c97b0fd502c (diff)
parente5752934be74a84e6ec0ff8cb96974bd1e9060ec (diff)
Merge latest from lindenlab/viewer-development
Diffstat (limited to 'scripts')
-rw-r--r--scripts/gpu_table_tester178
-rw-r--r--scripts/messages/message_template.msg9
-rw-r--r--scripts/messages/message_template.msg.sha12
3 files changed, 188 insertions, 1 deletions
diff --git a/scripts/gpu_table_tester b/scripts/gpu_table_tester
new file mode 100644
index 0000000000..52b1c8f31d
--- /dev/null
+++ b/scripts/gpu_table_tester
@@ -0,0 +1,178 @@
+#!/usr/bin/perl
+## Checks entries in the indra/newview/gpu_table.txt file against sample data
+##
+## Copyright (c) 2011, Linden Research, Inc.
+##
+## Permission is hereby granted, free of charge, to any person obtaining a copy
+## of this software and associated documentation files (the "Software"), to deal
+## in the Software without restriction, including without limitation the rights
+## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+## copies of the Software, and to permit persons to whom the Software is
+## furnished to do so, subject to the following conditions:
+##
+## The above copyright notice and this permission notice shall be included in
+## all copies or substantial portions of the Software.
+##
+## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+## AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+## THE SOFTWARE.
+
+use English;
+use Getopt::Long;
+
+( $MyName = $0 ) =~ s|.*/||;
+my $mini_HELP = "
+ $MyName --gpu-table <gpu_table.txt>
+ [ --unrecognized-only ]
+ [ --table-only ]
+ [ <gpu-strings-file> ...]
+
+ Checks for duplicates and invalid lines in the gpu_table.txt file.
+
+ Unless the '--table-only' option is specified, it also tests the recognition of
+ values in the gpu-strings-files (or standard input if no files are given).
+
+ If the --unrecognized-only option is specified, then no output is produced for
+ values that are matched, otherwise a line is output for each input line that
+ describes the results of attempting to match the value on that line.
+";
+
+&GetOptions("help" => \$Help,
+ "gpu-table=s" => \$GpuTable,
+ "unrecognized-only" => \$UnrecognizedOnly,
+ "table-only" => \$TableOnly
+ )
+ || die "$mini_HELP";
+
+if ($Help)
+{
+ print $mini_HELP;
+ exit 0;
+}
+
+$ErrorsSeen = 0;
+
+die "Must specify a --gpu-table <gpu_table.txt> value"
+ unless $GpuTable;
+
+open(GPUS, "<$GpuTable")
+ || die "Failed to open gpu table '$GpuTable':\n\t$!\n";
+
+# Parse the GPU table into these table, indexed by the name
+my %NameLine; # name -> line number on which a given name was found (catches duplicate names)
+my %RecognizerLine; # name -> line number on which a given name was found (catches duplicate names)
+my %Name; # recognizer -> name
+my %Recognizer; # name -> recognizer
+my %Class; # recognizer -> class
+my %Supported; # recognizer -> supported
+my @InOrder; # records the order of the recognizers
+
+$Name{'UNRECOGNIZED'} = 'UNRECOGNIZED';
+$NameLine{'UNRECOGNIZED'} = '(hard-coded)'; # use this for error messages in table parsing
+$Class{'UNRECOGNIZED'} = '';
+$Supported{'UNRECOGNIZED'} = '';
+
+while (<GPUS>)
+{
+ next if m|^//|; # skip comments
+ next if m|^\s*$|; # skip blank lines
+
+ chomp;
+ my ($name, $regex, $class, $supported, $extra) = split('\t+');
+ my $errsOnLine = $ErrorsSeen;
+ if (!$name)
+ {
+ print STDERR "No name found on $GpuTable line $INPUT_LINE_NUMBER\n";
+ $ErrorsSeen++;
+ }
+ elsif ( defined $NameLine{$name} )
+ {
+ print STDERR "Duplicate name '$name' on $GpuTable lines $NameLine{$name} and $INPUT_LINE_NUMBER:\n";
+ print STDERR " $NameLine{$name}: /$Recognizer{$name}/ $Supported{$Recognizer{$name}} class $Class{$Recognizer{$name}}\n";
+ print STDERR " $INPUT_LINE_NUMBER: /$regex/ " . ($supported ? "supported" : "unsupported") . " class $class - ignored\n";
+ $ErrorsSeen++;
+ }
+ if (!$regex)
+ {
+ print STDERR "No recognizer found on $GpuTable line $INPUT_LINE_NUMBER\n";
+ $ErrorsSeen++;
+ }
+ elsif ( defined $RecognizerLine{$regex} )
+ {
+ print STDERR "Duplicate recognizer /$regex/ found on $GpuTable lines $RecognizerLine{$regex} and $INPUT_LINE_NUMBER (ignored)\n";
+ print STDERR " $RecognizerLine{$regex}: name '$Name{$regex}' $Supported{$regex} class $Class{$regex}\n";
+ print STDERR " $INPUT_LINE_NUMBER: name '$name' " . ($supported ? "supported" : "unsupported") . " class $class - ignored\n";
+ $ErrorsSeen++;
+ }
+ if ($class !~ m/[0123]/)
+ {
+ print STDERR "Invalid class value '$class' on $GpuTable line $INPUT_LINE_NUMBER\n";
+ $ErrorsSeen++;
+ }
+ if ($supported !~ m/[0123]/)
+ {
+ print STDERR "Invalid supported value '$supported' on $GpuTable line $INPUT_LINE_NUMBER\n";
+ $ErrorsSeen++;
+ }
+ if ($extra)
+ {
+ print STDERR "Extra data '$extra' on $GpuTable line $INPUT_LINE_NUMBER\n";
+ $ErrorsSeen++;
+ }
+
+ if ($errsOnLine == $ErrorsSeen) # no errors found on this line
+ {
+ push @InOrder,$regex;
+ $NameLine{$name} = $INPUT_LINE_NUMBER;
+ $RecognizerLine{$regex} = $INPUT_LINE_NUMBER;
+ $Name{$regex} = $name;
+ $Recognizer{$name} = $regex;
+ $Class{$regex} = $class;
+ $Supported{$regex} = $supported ? "supported" : "unsupported";
+ }
+}
+
+close GPUS;
+
+print STDERR "\n" if $ErrorsSeen;
+
+exit $ErrorsSeen if $TableOnly;
+
+my %RecognizedBy;
+while (<>)
+{
+ chomp;
+ my $recognizer;
+ $RecognizedBy{$_} = 'UNRECOGNIZED';
+ foreach $recognizer ( @InOrder ) # note early exit if recognized
+ {
+ if ( m/$recognizer/ )
+ {
+ $RecognizedBy{$_} = $recognizer;
+ last; # exit recognizer loop
+ }
+ }
+}
+
+## Print results.
+## For each input, show supported or unsupported, the class, and the recognizer name
+format STDOUT_TOP =
+GPU String Supported? Class Recognizer
+------------------------------------------------------------------------------------------------------ ----------- ----- ------------------------------------
+.
+format STDOUT =
+@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<... @<<<<<<<<<< @> @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<...
+$_, $Supported{$RecognizedBy{$_}},$Class{$RecognizedBy{$_}},$Name{$RecognizedBy{$_}}
+.
+
+foreach ( sort keys %RecognizedBy )
+{
+ write if ! $UnrecognizedOnly || $Name{$RecognizedBy{$_}} eq 'UNRECOGNIZED';
+ $-++; # suppresses pagination
+}
+
+exit $ErrorsSeen;
diff --git a/scripts/messages/message_template.msg b/scripts/messages/message_template.msg
index d292653d3f..2cb0a833d4 100644
--- a/scripts/messages/message_template.msg
+++ b/scripts/messages/message_template.msg
@@ -2061,6 +2061,15 @@ version 2.0
{ IsPhantom BOOL }
{ CastsShadows BOOL }
}
+ {
+ ExtraPhysics Variable
+ { PhysicsShapeType U8 }
+ { Density F32 }
+ { Friction F32 }
+ { Restitution F32 }
+ { GravityMultiplier F32 }
+
+ }
}
diff --git a/scripts/messages/message_template.msg.sha1 b/scripts/messages/message_template.msg.sha1
index 41e70011af..6486d92851 100644
--- a/scripts/messages/message_template.msg.sha1
+++ b/scripts/messages/message_template.msg.sha1
@@ -1 +1 @@
-ce3be58f4ea395c272fcfa3e6b6dad027c188e0d \ No newline at end of file
+465164e1a07f63d68c4ad1f00c19805dfb6ee2d7 \ No newline at end of file