-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.pl
More file actions
executable file
·52 lines (48 loc) · 1.46 KB
/
script.pl
File metadata and controls
executable file
·52 lines (48 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/perl
# perl script to automate experiments
# Usage:
# perl script.pl <INPUT_FILE>
# Assumes that xsb is in the $PATH environment variable
# Assumes that startup.xwam is available in $execdir
use Cwd;
if (@ARGV != 1) {
print "check usage\n";
exit -1;
}
my $inputfile = $ARGV[0];
#print "inputfile: $inputfile\n";
open(my $fh, "<", $inputfile) or die "cannot open input file\n";
my $execdir, $sourcedir, $datadir;
my @experiments=();
while (my $line = <$fh>) {
if ($line =~ /#.*/) {
next;
} elsif ($line =~ /^execdir=(.+)/) {
$execdir = $1;
} elsif ($line =~ /^sourcedir=(.+)/) {
$sourcedir = $1;
} elsif ($line =~ /^datadir=(.+)/) {
$datadir = $1;
} else {
push(@experiments, $line);
}
}
close($fh);
chdir($execdir);
foreach my $experiment (@experiments) {
open (my $xsbscript, ">", "runexpmts.P");
print $xsbscript "go1 :- \n";
print $xsbscript "\t consult('ami'),\n";
chomp($experiment);
my @fields = split(/ /,$experiment);
print $xsbscript "\t adaptation(".$fields[2]."),\n";
print $xsbscript "\t resampling_style(".$fields[3]."),\n";
print $xsbscript "\t load_dyn('".$sourcedir."/".$fields[0]."'),\n";
",".$fields[7].",".$fields[8].",".$fields[9].",'".$datadir."/".$fields[1]
."').\n";
print $xsbscript "\t write_stats(".$fields[4].",".$fields[5].",".$fields[6].
",".$fields[7].",".$fields[8].",".$fields[9].",'".$datadir."/".$fields[1]
."').\n";
close($xsbscript);
system("xsb startup\n");
}