perm filename READCA.SAI[LIB,AIL] blob sn#408145 filedate 1979-01-08 generic text, type T, neo UTF8
entry CReadC;
begin "ReadCard"
   external procedure newline(integer Chan);
   external integer !t!t!y;
   external boolean array !n!e!w!i!n!l!i!n!e[0:15];
   define CR = '15;
   define LF = '12;

   internal procedure CReadCard(integer Chan; reference string CardImage);
   begin "CReadCard"
      integer Temp;
      external boolean procedure EofTru(integer Chan);
      CardImage := null;
      if EofTru(Chan) then
         begin
            UserErr(0, 1, "Unexpected End Of File For " &
               (if Chan = !t!t!y then "Teletype." else
                "Channel number "& cvs(Chan)));
         end;
      newline(Chan);
      while true do
      begin
         Temp := WordIn(Chan);
         while ((Temp = CR) or (Temp = 0)) and not EofTru(Chan)  do
            Temp := WordIn(Chan);
         if (Temp = LF) or EofTru(Chan) then
            done;
         CardImage := CardImage & Temp;
      end;
      !n!e!w!i!n!l!i!n!e[Chan] := true;
   end "CReadCard";
end "ReadCard";