Unit pEuv;
interface

procedure readeuv(f:string);
procedure config;
procedure kaput;


const
  maxfaces=1500;
  maxpoints=800;

type factype= Array [1..Maxfaces,1..3] of integer;
     ptype=array[1..maxpoints,1..3] of integer;
  var

 faces :^factype;
 points:^ptype;
 inp:text;
 nfaces,npoints,i:integer;


implementation

uses dos,crt;
var
 st:string;
 i1,i2,i3:integer;

procedure getstrings;
var l1,l2,code:integer;
    c:char;
    s:array[1..3] of string;
begin
  l2:=1;
  s[1]:=' ';
  s[2]:=' ';
  s[3]:=' ';
  for l1:=1 to length(st) do begin
    c:=st[l1];
   if c=',' then l2:=l2+1;
   if  (c in['0'..'9']) or (c='-') then s[l2]:=s[l2]+c;
  end;
  val(s[1],i1,code);
  val(s[2],i2,code);
  val(s[3],i3,code);
end;

procedure readeuv(f:string);
begin
  assign(inp,f);
  reset(inp);
  npoints:=0;
  nfaces:=0;
  st:='';
  while st<>'#' do begin
    readln(inp,st);
    inc(npoints);
  end;
  while not eof(inp) do begin
    readln(inp,st);
    inc(nfaces);
  end;
  {got the nums}
  i:=1;
  reset(inp);

  repeat
    readln(inp,st);
    getstrings;
    points^[i,1]:=i1;
    points^[i,2]:=i2;
    points^[i,3]:=i3;
  if st<>'#' then inc(i);
  until i=npoints;
  i:=1;
  while not eof(inp) do begin
    readln(inp,st);
    getstrings;
    faces^[i,1]:=i1;
    faces^[i,2]:=i2;
    faces^[i,3]:=i3;
    if st<>'#' then inc(i);
  end;
  nfaces:=nfaces-1;
  npoints:=npoints-1;
  close(inp);
  {clrscr;}
end;

procedure config;
begin
  new(faces);
  new(points);
end;

procedure kaput;
begin
  dispose(faces);
  dispose(points);
end;

end.
