~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to extern/ode/dist/ode/fbuild/OptimizeUtil

  • Committer: Bazaar Package Importer
  • Author(s): Kevin Roy
  • Date: 2011-02-08 22:20:54 UTC
  • mfrom: (1.4.2 upstream)
  • mto: (14.2.6 sid) (1.5.1)
  • mto: This revision was merged to the branch mainline in revision 27.
  • Revision ID: james.westby@ubuntu.com-20110208222054-kk0gwa4bu8h5lyq4
Tags: upstream-2.56.1-beta-svn34076
ImportĀ upstreamĀ versionĀ 2.56.1-beta-svn34076

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/perl -w
2
 
#
3
 
#########################################################################
4
 
#                                                                       #
5
 
# Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith.       #
6
 
# All rights reserved.  Email: russ@q12.org   Web: www.q12.org          #
7
 
#                                                                       #
8
 
# This library is free software; you can redistribute it and/or         #
9
 
# modify it under the terms of EITHER:                                  #
10
 
#   (1) The GNU Lesser General Public License as published by the Free  #
11
 
#       Software Foundation; either version 2.1 of the License, or (at  #
12
 
#       your option) any later version. The text of the GNU Lesser      #
13
 
#       General Public License is included with this library in the     #
14
 
#       file LICENSE.TXT.                                               #
15
 
#   (2) The BSD-style license that is included with this library in     #
16
 
#       the file LICENSE-BSD.TXT.                                       #
17
 
#                                                                       #
18
 
# This library is distributed in the hope that it will be useful,       #
19
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of        #
20
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    #
21
 
# LICENSE.TXT and LICENSE-BSD.TXT for more details.                     #
22
 
#                                                                       #
23
 
#########################################################################
24
 
 
25
 
package BuildUtil;
26
 
 
27
 
 
28
 
sub main::doit
29
 
{
30
 
  my $cmd = $_[0];
31
 
  print "$cmd\n";
32
 
  system ($cmd)==0 or die "FAILED";
33
 
}
34
 
 
35
 
 
36
 
sub main::createParametersFile # (filename)
37
 
{
38
 
  open (PARAM,">$_[0]");
39
 
  print PARAM "# perl script to set parameters required by the code generator\n";
40
 
  print PARAM "\$FNAME=\"$main::FNAME\";\n" if defined($main::FNAME);
41
 
  print PARAM "\$TYPE=\"$main::TYPE\";\n" if defined($main::TYPE);
42
 
  print PARAM "\$N1=$main::N1;\n" if defined($main::N1);
43
 
  print PARAM "\$UNROLL1=$main::UNROLL1;\n" if defined($main::UNROLL1);
44
 
  print PARAM "\$UNROLL2=$main::UNROLL2;\n" if defined($main::UNROLL2);
45
 
  print PARAM "\$MADD=$main::MADD;\n" if defined($main::MADD);
46
 
  print PARAM "\$FETCH=$main::FETCH;\n" if defined($main::FETCH);
47
 
  print PARAM "\$LAT1=$main::LAT1;\n" if defined($main::LAT1);
48
 
  print PARAM "\$LAT2=$main::LAT2;\n" if defined($main::LAT2);
49
 
  close PARAM;
50
 
}
51
 
 
52
 
 
53
 
# read back a data file and find best parameters
54
 
 
55
 
sub main::readBackDataFile # (filename)
56
 
{
57
 
  my $filename = $_[0];
58
 
  my $maxtime = 1e10;
59
 
  open (FILE,$filename);
60
 
  while (<FILE>) {
61
 
    next if /^\#/;
62
 
    my $line = lc $_;
63
 
    if ($line =~ /error/) {
64
 
      print "ERRORS FOUND IN $filename\n";
65
 
      exit 1;
66
 
    }
67
 
    $line =~ s/^\s*//;
68
 
    $line =~ s/\s*$//;
69
 
    my @nums = split (/\s+/,$line);
70
 
    $time = $nums[0];
71
 
    if ($time < $maxtime) {
72
 
      $main::N1 = $nums[1];
73
 
      $main::UNROLL1 = $nums[2];
74
 
      $main::UNROLL2 = $nums[3];
75
 
      $main::MADD = $nums[4];
76
 
      $main::FETCH = $nums[5];
77
 
      $main::LAT1 = $nums[6];
78
 
      $main::LAT2 = $nums[7];
79
 
      $maxtime = $time;
80
 
    }
81
 
  }
82
 
  close FILE;
83
 
}
84
 
 
85
 
 
86
 
1;