<> <> <> DIRECTORY AIS, IO, ReadAIS, Rope, Feedback; ReadAISImpl: CEDAR PROGRAM IMPORTS AIS, IO, Rope EXPORTS ReadAIS = BEGIN Raster: TYPE = AIS.Raster; FilenameMinusExtension: PUBLIC PROC [wholeName: Rope.ROPE] RETURNS [firstPart: Rope.ROPE] = { wholeStream: IO.STREAM _ IO.RIS[wholeName]; [firstPart, ----] _ IO.GetTokenRope[wholeStream, PeriodBreakProc]; }; PeriodBreakProc: SAFE PROC [char: CHAR] RETURNS [IO.CharClass] = { SELECT char FROM '. => RETURN[sepr]; ENDCASE => RETURN[other]; }; CreateFile: PUBLIC PROC [filename: Rope.ROPE, raster: Raster, overwrite: BOOLEAN _ FALSE, attributeLength: CARDINAL _ 0] RETURNS[f: AIS.FRef] = { f _ AIS.CreateFile[filename, raster]; }; <> <> <> <> <> <> <> <> <> <> <<>> <> <> <> <<}; -- bier March 26, 1986. commented out to see if it is used. >> <> <> <> <> <> <> <> <> <> <> <<>> <> <> <> <> <<}; -- bier March 26, 1986. commented out to see if it is used.>> ReadRope: PUBLIC PROC [f: IO.STREAM, rope: Rope.ROPE] = { <> <> c: CHAR; FOR i: INT IN[1..Rope.Length[rope]] DO c _ IO.GetChar[f]; IF NOT c = Rope.Fetch[rope,i-1] THEN SIGNAL RopeNotOnTop [IO.GetIndex[f], Rope.FromChar[c], rope]; ENDLOOP; }; RopeNotOnTop: PUBLIC SIGNAL [position: NAT, wasThere: Rope.ROPE, notThere: Rope.ROPE] = CODE; ReadReal: PUBLIC PROC [f: IO.STREAM] RETURNS [r: REAL] = { <, or . Leaves these terminators on the stream.>> realRope: Rope.ROPE; [realRope, ----] _ IO.GetTokenRope[f, RealBreakProc]; IF Rope.Find[realRope, ".", 0, FALSE] = -1 THEN realRope _ Rope.Concat[realRope, ".0"]; r _ IO.GetReal[IO.RIS[realRope]]; }; RealBreakProc: SAFE PROC [char: CHAR] RETURNS [IO.CharClass] = { SELECT char FROM '], ', => RETURN [break]; IO.CR =>RETURN [break]; IO.SP => RETURN [break]; ENDCASE => RETURN [other]; }; CloseFile: PUBLIC PROC [f: AIS.FRef, comment: Rope.ROPE] = { AIS.WriteComment[f, comment]; AIS.CloseFile[f]; }; END.