-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_report.pl
executable file
·55 lines (49 loc) · 1.45 KB
/
update_report.pl
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
53
54
55
#!/usr/bin/perl
if ($#ARGV != 1) {
die "Usage:\n $0 <infile> <obsid>\n";
}
# usr modified
$xsl_file="/data/mta4/CVS_test/ANCHORS_PROC/mod_report2.xsl";
$xsltproc="/data/mta4/CVS_test/ANCHORS_PROC/xsltproc";
# check obsid, directory structure is rigid
chomp $ARGV[1];
$data_dir=$ARGV[1];
@chars=split //,$data_dir;
while ($chars[0] eq "0") {
$data_dir = join '', @chars[1..$#chars];
@chars=split //,$data_dir;
} # while ($chars[0] eq "0") {
$obs_dir=$data_dir;
@chars=split //,$obs_dir;
while ($#chars < 4) {
$obs_dir= "0".$obs_dir;
@chars=split //,$obs_dir;
} # while ($count < 5) {
$data_root="/data/ANCHORS/YAXX/$obs_dir/Data/obs$data_dir";
$outxml="/data/ANCHORS/YAXX/$obs_dir/$data_dir.xml";
$cwd=`pwd`;
open(IN,"<$ARGV[0]") || die "Input file $ARGV[0] not found.\n";
$inline=<IN>; # skip first 2 header lines
$inline=<IN>; # skip first 2 header lines
while ($inline=<IN>) {
chomp $inline;
@line=split(/\s+/,$inline);
@src_str=split("_",$line[0]);
$src=$src_str[1];
$src_root="$data_root/src$src";
$xml_file="src$src.xml";
chdir($src_root);
$command="$xsltproc -o report2.tex -param vobs $data_dir -param vsrcid $src $xsl_file $xml_file";
#print "$command\n";
`$command`;
$command="latex -interaction=batchmode report2";
#print "$command\n";
`$command`;
$command="dvips report2 -o report2.ps";
#print "$command\n";
`$command`;
unlink(qw(report2.aux report2.dvi report2.log));
} # while ($inline=<IN>) {
close IN;
chdir($cwd);
#