-- File: TFI3d.mesa (text file in for 3d) -- Last edited by Bier on December 19, 1982 6:01 pm -- Author: Eric Bier on July 6, 1983 4:18 pm -- Contents: convenience functions for parsing low-level parts of a 3d fileout produced by fileout3d.mesa DIRECTORY GraphicsColor, IO, Matrix3d, Rope, SV2d, SVArtwork, SVMatrix2d; TFI3d: DEFINITIONS = BEGIN Color: TYPE = GraphicsColor.Color; Material: TYPE = SVArtwork.Material; Matrix3by3: TYPE = SVMatrix2d.Matrix3by3; Matrix4by4: TYPE = Matrix3d.Matrix4by4; OMap: TYPE = SVArtwork.OMap; Point3d: TYPE = Matrix3d.Point3d; Point2d: TYPE = SV2d.Point2d; SMap: TYPE = SVArtwork.SMap; FileinMatrix: PROC [f: IO.STREAM] RETURNS [mat: Matrix4by4]; FileinMatrix3by3: PROC [f: IO.STREAM] RETURNS [mat: Matrix3by3]; ReadRope: PROC [f: IO.STREAM, rope: Rope.ROPE]; -- removes the given rope from the top of the stream. Used to remove formatting words and phrases from 3d files. We are not interested in these strings but only in the data in between them. -- Signals RopeNotOnTop if some other rope is on top. RopeNotOnTop: SIGNAL [position: NAT, wasThere: Rope.ROPE, notThere: Rope.ROPE]; ReadChar: PROC [f: IO.STREAM, c: CHAR]; -- reads in one character from f. Complains if it is not c. -- Signals RopeNotOnTop if some other char is on top. ReadReturn: PROC [f: IO.STREAM]; -- convenience function. Equivalent to ReadChar[f, IO.CR]; ReadWord: PROC [f: IO.STREAM] RETURNS [word: Rope.ROPE]; -- reads a rope until , , or are encountered. Used to read in a rope which is data. ie the name of a coordinate system from a 3d file. ReadKeyWord: PROC [f: IO.STREAM] RETURNS [keyWord: Rope.ROPE, good: BOOL]; -- reads a rope until a ':' or are encountered. If CR is encountered first, then good is FALSE since ":" is expected after a keyword. ReadLine: PROC [f: IO.STREAM] RETURNS [line: Rope.ROPE]; -- reads a rope UNTIL is encountered. Used to read Solidviews version rope. -- The character is tossed out. ReadWhiteSpace: PROC [f: IO.STREAM]; -- reads, 's, 's, and 's until something else is encountered. Signals RopeNotOnTop if no white space characters are found. ReadBlank: PROC [f: IO.STREAM]; -- reads, 's, 's, and 's until something else is encountered. Doens't mind if no white space characters are found. ReadHorizontalBlank: PROC [f: IO.STREAM] RETURNS [good: BOOL]; -- reads 's, and 's until something else is encountered. Returns good = FALSE if a CR is encountered before anything else ReadBlankAndRope: PUBLIC PROC [f: IO.STREAM, rope: Rope.ROPE]; -- a convenience function. Equivalent to ReadBlank[f]; ReadRope[f, rope]; ReadBlankAndReal: PROC [f: IO.STREAM] RETURNS [r: REAL]; -- a convenience function. Equivalent to ReadBlank[f]; r _ ReadReal[f]; ReadBlankAndWord: PROC [f: IO.STREAM] RETURNS [word: Rope.ROPE]; -- a convenience function. Equivalent to ReadBlank[f]; word _ ReadWord[f]; ReadBlankAndNAT: PROC [f: IO.STREAM] RETURNS [n: NAT]; -- a convenience function. Equivalent to ReadBlank[f]; n _ ReadNAT[f]; ReadPoint3d: PROC [f: IO.STREAM] RETURNS [point3d: Point3d]; -- assumes the next rope on the stream will be of the form "[,,]". ReadPoint2d: PROC [f: IO.STREAM] RETURNS [point2d: Point2d]; ReadPoint2dAsPoint3d: PROC [f: IO.STREAM] RETURNS [point3d: Point3d]; -- assumes the next rope on the stream will be of the form "[,]". Fills in point3d[3] with zero. ReadReal: PROC [f: IO.STREAM] RETURNS [r: REAL]; -- reads digits up to the next ], , . Leaves these terminators on the stream. ReadNAT: PROC [f: IO.STREAM] RETURNS [n: NAT]; -- reads digits up to the next ], , . Leaves these terminators on the stream. ReadBool: PROC [f: IO.STREAM] RETURNS [truth: BOOL, good: BOOL]; -- tries to read TRUE or FALSE from the stream. If it encounters another word, good = FALSE; ReadColor: PROC [f: IO.STREAM] RETURNS [color: Color]; ReadSurface: PROC [f: IO.STREAM] RETURNS [surface: REF ANY]; ReadMaterial: PROC [f: IO.STREAM] RETURNS [material: Material]; ReadSMap: PROC [f: IO.STREAM] RETURNS [sMap: SMap]; ReadOMap: PROC [f: IO.STREAM] RETURNS [oMap: OMap]; END. Κ– "Mesa" style˜IprocšθΟcυœΟk œžœ<ž œžœ žœ"žœ#žœ&žœžœžœžœžœΟn œžœžœžœžœŸœžœžœžœžœŸœžœžœžœ žœΏœ6œžœ žœžœžœŸœžœžœžœžœ=œ6œŸ œžœžœžœ<œŸœžœžœžœžœ žœœŸ œžœžœžœžœžœžœŽœŸœžœžœžœžœ žœRœ%œŸœžœžœžœœŸ œžœžœžœ„œŸœžœžœžœžœžœŠœŸœžœžœžœžœ žœKœŸœžœžœžœžœžœIœŸœžœžœžœžœ žœLœŸœžœžœžœžœžœHœŸ œžœžœžœžœXœŸ œžœžœžœžœŸœžœžœžœžœpœŸœžœžœžœžœžœZœŸœžœžœžœžœžœ\Ÿœžœžœžœžœ žœžœ^œŸ œžœžœžœžœŸ œžœžœžœžœ žœžœŸ œžœžœžœžœŸœžœžœžœžœŸœžœžœžœžœžœ˜Š!—…—Œ