File: TFI3d.mesa (text file in for 3d)
Last edited by Bier on July 30, 1984 0:47:06 am PDT
Copyright © 1984 by Xerox Corporation. All rights reserved.
Contents: convenience functions for parsing low-level parts of a 3d fileout produced by fileout3d.mesa
DIRECTORY
GraphicsColor,
IO,
Rope,
SV2d,
SV3d,
SVModelTypes,
SVSceneTypes;
TFI3d: DEFINITIONS =
BEGIN
Assembly: TYPE = SVSceneTypes.Assembly;
Color: TYPE = GraphicsColor.Color;
CoordSystem: TYPE = SVModelTypes.CoordSystem;
DrawStyle: TYPE = SVModelTypes.DrawStyle;
FileCamera: TYPE = SVSceneTypes.FileCamera;
FrameBox: TYPE = SVModelTypes.FrameBox;
Material: TYPE = SVModelTypes.Material;
Matrix3by3: TYPE = SV2d.Matrix3by3;
Matrix4by4: TYPE = SV3d.Matrix4by4;
OMap: TYPE = SVModelTypes.OMap;
Plane: TYPE = SV3d.Plane;
Point2d: TYPE = SV2d.Point2d;
Point3d: TYPE = SV3d.Point3d;
Scene: TYPE = SVSceneTypes.Scene;
SMap: TYPE = SVModelTypes.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 <SPACE>, <CR>, or <TAB> 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 <CR> 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 <CR> is encountered. Used to read Solidviews version rope.
The <CR> character is tossed out.
ReadWhiteSpace: PROC [f: IO.STREAM];
Reads, <SPACE>'s, <CR>'s, and <TAB>'s until something else is encountered. Signals RopeNotOnTop if no white space characters are found.
ReadBlank: PROC [f: IO.STREAM];
Reads, <SPACE>'s, <CR>'s, and <TAB>'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 <SPACE>'s, and <TABS>'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 "[<real1>,<real2>,<real3>]".
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 "[<real1>,<real2>]". Fills in point3d[3] with zero.
ReadReal: PROC [f: IO.STREAM] RETURNS [r: REAL];
Reads digits up to the next ], <CR>, <SPACE>. Leaves these terminators on the stream.
ReadNAT: PROC [f: IO.STREAM] RETURNS [n: NAT];
Reads digits up to the next ], <CR>, <SPACE>. 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];
ReadCamera: PROC [f: IO.STREAM, worldCS: CoordSystem, scene: Scene, version: REAL] RETURNS [fileCamera: FileCamera];
ReadClippingPlanes: PROC [f: IO.STREAM] RETURNS [clippingPlanes: LIST OF Plane];
ReadPlane: PROC [f: IO.STREAM] RETURNS [plane: Plane];
ReadStyle: PROC [f: IO.STREAM] RETURNS [style: DrawStyle];
ReadFrame: PROC [f: IO.STREAM] RETURNS [frame: FrameBox];
ReadListOfRope: PROC [f: IO.STREAM] RETURNS [ropeList: LIST OF Rope.ROPE];
ReadVisibleAssemblies: PROC [f: IO.STREAM, scene: Scene] RETURNS [assemblyList: LIST OF Assembly];
END.