program mkpoly(input,output);
{ reads zeros.t and writes the associated canonical product }
const
  hdim=5;
  edim=11;
  vdim=5000;
  lmax=0;
  pdeg=4999;

%include 'types.h';

var
  v: vector;

%include 'reps.i';
%include 'scalar.i';
%include 'vector.i';

procedure ptread(f: string; var v: vector);
{ compute polynomial v from zeros in file named f }
var
  i,j,n,zd: integer;
  s: longstring;
  st0,st1,st2: scalar;
  t: text;
begin { ptread }
  write('(ptread ',trim(f),' '); flush(output);
  reset(t,f);
  readln(t,zd);
  n:=min(zd+1,pdeg);
  vzero(v);
  v[0]:=sone;
  for i:=1 to n do begin
    readln(t,s);
    ssset(s,st1);
    squot(sone,st1,st0);
    for j:=i downto 1 do begin
      sprod(v[j-1],st0,st2);
      ssum(v[j],st2,st1);
      v[j]:=st1;
    end;
    if (i mod 100)=0 then begin
      write('.');
      flush(output);
    end;
  end;
  write(')');
end { ptread };

begin { mkpoly }
  sinit;
  ptread('zeros.t',v);
  writeln;
  vwrite('poly.v',v);
  writeln;
  sdone('mkpoly');
end { mkpoly }.

