Debian Codegraph @

tst/make_anupqeg

raw
1 #!/usr/bin/perl -w
2 $gap = "../../../bin/gap.sh";
3 print "Building GAP pre-script file\n";
4 system("$gap -A -x 80 < anupqeg.tsk > /dev/null");
5 print "GAP pre-script in anupqeg.tst-new\n";
6 open(IN, "<anupqeg.tst-new");
7 open(OUT, ">anupqeg.tst-new0");
8 $logto = 0;
9 print "Building GAP script file\n";
10 print OUT "LoadPackage( \"anupq\" );";
11 print OUT "LogTo(\"anupqeg.tst-new\");\n";
12 while (<IN>) {
13 if (!$logto) {
14 if (/LogTo/) {
15 $logto = 1;
16 next;
17 } elsif (s/^gap> //) {
18 print OUT $_;
19 }
20 } else {
21 s/^#I /#/;
22 print OUT $_;
23 }
24 }
25 print OUT "LogTo();\nquit;\n";
26 close OUT;
27 close IN;
28 print "GAP script in anupqeg.tst-new0\n";
29 print "Creating new anupqeg.tst file\n";
30 system("$gap -N -A -x 80 < anupqeg.tst-new0 > /dev/null");
31 open(IN, "<anupqeg.tst-new");
32 open(OUT, ">anupqeg.tst-new0");
33 $start = 0;
34 while (<IN>) {
35 if (!$start) {
36 if (/START/) {
37 $start = 1;
38 } else {
39 s/^gap> //;
40 }
41 print OUT $_;
42 } else {
43 print OUT $_;
44 last if (/STOP/);
45 }
46 }
47 close OUT;
48 close IN;
49 print "Pre-result in anupqeg.tst-new\n";
50 print "Result in anupqeg.tst-new0\n";