CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

| Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

Views: 418346
#!/usr/bin/perl -w
$gap = "../../../bin/gap.sh";
print "Building GAP pre-script file\n";
system("$gap -A -x 80 < anupqeg.tsk > /dev/null");
print "GAP pre-script in anupqeg.tst-new\n";
open(IN, "<anupqeg.tst-new");
open(OUT, ">anupqeg.tst-new0");
$logto = 0;
print "Building GAP script file\n";
print OUT "LoadPackage( \"anupq\" );";
print OUT "LogTo(\"anupqeg.tst-new\");\n";
while (<IN>) {
  if (!$logto) {
    if (/LogTo/) {
      $logto = 1;
      next;
    } elsif (s/^gap> //) { 
      print OUT $_; 
    }
  } else {
    s/^#I  /#/;
    print OUT $_;
  }
}
print OUT "LogTo();\nquit;\n";
close OUT;
close IN;
print "GAP script in anupqeg.tst-new0\n";
print "Creating new anupqeg.tst file\n";
system("$gap -N -A -x 80 < anupqeg.tst-new0 > /dev/null");
open(IN, "<anupqeg.tst-new");
open(OUT, ">anupqeg.tst-new0");
$start = 0;
while (<IN>) {
  if (!$start) {
    if (/START/) {
      $start = 1;
    } else {
      s/^gap> //;
    }
    print OUT $_;
  } else {
    print OUT $_;
    last if (/STOP/);
  }
}
close OUT;
close IN;
print "Pre-result in anupqeg.tst-new\n";
print "Result in anupqeg.tst-new0\n";