perm filename STRIN.SAI[LIB,AIL] blob sn#408150 filedate 1979-01-08 generic text, type T, neo UTF8
entry Strin;
begin "Strin"
   external boolean procedure EofTrue(integer Chan);
   define ! = "comment";
   internal simple string procedure Strin(integer Chan);
   begin "Strin"
      integer TChar;
      string Result;
      Result := null;
      if EofTrue(Chan) then
         return(null);
! ignore all characters before first quote character;
      while true do
      begin
         TChar := WordIn(Chan);
         if EofTrue(Chan) then
            return(Result);
         if TChar = """" then
            done;
      end;

! now the body of the string;
      TChar := WordIn(Chan);
      while true do
      begin 
         if EofTrue(Chan) then
            return(Result);
         if TChar = 0 then
            begin
               TChar := WordIn(Chan);
               continue;
            end;
         if TChar = """" then
            begin
               while (TChar := WordIn(Chan)) = 0 do
                  if EofTrue(Chan) then
                     return(Result);
               if TChar = """" then
                  begin
                     Result := Result & """";
                     TChar := WordIn(Chan);
                     continue;
                  end;
               return(Result);
            end;
         Result := Result & TChar;
                 TChar := WordIn(Chan);
      end;
   end "Strin";
end "Strin";