DIRECTORY Atom, FileNames, GGBasicTypes, AtomButtons, Feedback, GGFileOut, GGInterfaceTypes, GGModelTypes, GGScene, GGParseOut, GGSegmentTypes, IO, Rope; GGFileOutImpl: CEDAR PROGRAM IMPORTS Atom, FileNames, AtomButtons, Feedback, GGScene, GGParseOut, IO EXPORTS GGFileOut = BEGIN EntityGenerator: TYPE = GGModelTypes.EntityGenerator; FenceHoleOpen: TYPE = GGModelTypes.FenceHoleOpen; GGData: TYPE = GGInterfaceTypes.GGData; Outline: TYPE = GGModelTypes.Outline; Point: TYPE = GGBasicTypes.Point; ScalarButtonClient: TYPE = AtomButtons.ScalarButtonClient; Scene: TYPE = GGModelTypes.Scene; Segment: TYPE = GGSegmentTypes.Segment; Slice: TYPE = GGModelTypes.Slice; SliceGenerator: TYPE = GGModelTypes.SliceGenerator; Traj: TYPE = GGModelTypes.Traj; TwoState: TYPE = AtomButtons.TwoState; Problem: PUBLIC SIGNAL [msg: Rope.ROPE] = Feedback.Problem; versionRope: Rope.ROPE; Init: PROC [] ~ { versionRope _ "8705.14"; }; FileoutSceneAndOptions: PUBLIC PROC [f: IO.STREAM, ggData: GGData, fileName: Rope.ROPE] = { sliceGen: SliceGenerator _ GGScene.TopLevelSlicesInScene[ggData.scene]; sliceCount: NAT _ CountSlices[ggData.scene]; fileName _ FileNames.GetShortName[fileName]; f.PutF["Gargoyle file for scene: %g\n", [rope[fileName]]]; f.PutF["Produced by version %g\n\n", [rope[versionRope]]]; FileoutAlignments[f, ggData]; f.PutF["Entities: [%g]:\n\n", [integer[sliceCount]]]; FOR slice: Slice _ GGScene.NextSlice[sliceGen], GGScene.NextSlice[sliceGen] UNTIL slice = NIL DO FileoutSlice[f, slice]; ENDLOOP; }; FileoutSceneOnly: PUBLIC PROC [f: IO.STREAM, scene: Scene, fileName: Rope.ROPE] = { sliceGen: SliceGenerator _ GGScene.TopLevelSlicesInScene[scene]; sliceCount: NAT _ CountSlices[scene]; fileName _ FileNames.GetShortName[fileName]; f.PutF["Gargoyle file for scene: %g\n", [rope[fileName]]]; f.PutF["Produced by version %g\n\n", [rope[versionRope]]]; f.PutChar[IO.CR]; f.PutChar[IO.CR]; f.PutF["Entities: [%g]:\n\n", [integer[sliceCount]]]; FOR slice: Slice _ GGScene.NextSlice[sliceGen], GGScene.NextSlice[sliceGen] UNTIL slice = NIL DO FileoutSlice[f, slice]; ENDLOOP; }; PrintButtonValues: PROC [f: IO.STREAM, firstButton: ScalarButtonClient] = { IF firstButton = NIL THEN SIGNAL Problem[msg: "There should always be a dummy first button."]; firstButton _ firstButton.next; IF firstButton # NIL THEN { f.PutF["%g", [real[firstButton.value]]]; FOR thisButton: ScalarButtonClient _ firstButton.next, thisButton.next UNTIL thisButton = NIL DO f.PutF[", %g", [real[thisButton.value]]]; ENDLOOP; }; }; FileoutAlignments: PROC [f: IO.STREAM, ggData: GGData] = { firstButton: ScalarButtonClient; stateInfo: TwoState; midPointsOn: BOOL; f.PutF["Slope: "]; firstButton _ ggData.hitTest.slopeHeader.scalarButtons; PrintButtonValues[f, firstButton]; f.PutChar[IO.CR]; f.PutF["Angle: "]; firstButton _ ggData.hitTest.angleHeader.scalarButtons; PrintButtonValues[f, firstButton]; f.PutChar[IO.CR]; f.PutF["Radius: "]; firstButton _ ggData.hitTest.radiusHeader.scalarButtons; PrintButtonValues[f, firstButton]; f.PutChar[IO.CR]; f.PutF["LineDistance: "]; firstButton _ ggData.hitTest.distanceHeader.scalarButtons; PrintButtonValues[f, firstButton]; f.PutChar[IO.CR]; f.PutF["Midpoints: "]; stateInfo _ ggData.hitTest.midpointButton; midPointsOn _ AtomButtons.GetButtonState[stateInfo] = on; GGParseOut.WriteBOOL[f, midPointsOn]; f.PutChar[IO.CR]; f.PutChar[IO.CR]; }; CountSlices: PROC [scene: Scene] RETURNS [count: NAT] = { sliceGen: SliceGenerator _ GGScene.TopLevelSlicesInScene[scene]; count _ 0; FOR slice: Slice _ GGScene.NextSlice[sliceGen], GGScene.NextSlice[sliceGen] UNTIL slice = NIL DO count _ count + 1; ENDLOOP; }; FileoutSlice: PUBLIC PROC [f: IO.STREAM, slice: Slice] = { className: Rope.ROPE _ Atom.GetPName[slice.class.type]; f.PutF["%g\n", [rope[className]] ]; slice.class.fileout[slice, f]; f.PutChar[IO.CR]; f.PutChar[IO.CR]; }; Init[]; END. File: GGFileOutImpl.mesa Last edited by Bier on May 14, 1987 12:44:00 pm PDT Copyright c 1986 by Xerox Corporation. All rights reserved. Contents: Facilities for creating text files and writing out a human-readable version of a gargoyle object database Pier, May 12, 1987 4:19:41 pm PDT versionRope _ "8610.29"; versionRope _ "8612.04"; versionRope _ "8701.13"; versionRope _ "8701.135"; versionRope _ "8701.23"; versionRope _ "8701.26"; versionRope _ "8701.28"; versionRope _ "8701.30"; versionRope _ "8702.11"; versionRope _ "8702.26"; versionRope _ "8704.03"; FileoutSceneAndOptionsOLDD: PUBLIC PROC [f: IO.STREAM, ggData: GGData, fileName: Rope.ROPE] = { entityGen: EntityGenerator _ GGScene.TopLevelEntitiesInScene[ggData.scene]; entityCount: NAT _ GGScene.EntityCount[entityGen]; fileName _ FileNames.GetShortName[fileName]; f.PutF["Gargoyle file for scene: %g\n", [rope[fileName]]]; f.PutF["Produced by version %g\n\n", [rope[versionRope]]]; FileoutAlignments[f, ggData]; f.PutF["Entities: [%g]:\n\n", [integer[entityCount]]]; FOR entity: REF ANY _ GGScene.NextEntity[entityGen], GGScene.NextEntity[entityGen] UNTIL entity = NIL DO FileoutEntity[f, entity]; ENDLOOP; }; FileoutSceneOnlyOLDD: PUBLIC PROC [f: IO.STREAM, scene: Scene, fileName: Rope.ROPE] = { entityGen: EntityGenerator _ GGScene.TopLevelEntitiesInScene[scene]; entityCount: NAT _ GGScene.EntityCount[entityGen]; fileName _ FileNames.GetShortName[fileName]; f.PutF["Gargoyle file for scene: %g\n", [rope[fileName]]]; f.PutF["Produced by version %g\n\n", [rope[versionRope]]]; FileoutAlignments[f, ggData]; f.PutChar[IO.CR]; f.PutChar[IO.CR]; f.PutF["Entities: [%g]:\n\n", [integer[entityCount]]]; FOR entity: REF ANY _ GGScene.NextEntity[entityGen], GGScene.NextEntity[entityGen] UNTIL entity = NIL DO FileoutEntity[f, entity]; ENDLOOP; }; FileoutAlignments[f, ggData]; FileoutEntityOLDD: PROC [f: IO.STREAM, entity: REF ANY] = { WITH entity SELECT FROM slice: Slice => FileoutSlice[f, slice]; outline: Outline => outline.class.fileout[outline, f]; ENDCASE => ERROR; }; FileoutSliceOLDD: PUBLIC PROC [f: IO.STREAM, slice: Slice] = { className: Rope.ROPE _ Atom.GetPName[slice.class.type]; f.PutF["Slice (class: %g) [%g]:\n", [rope[className]], [integer[0]]]; f.PutF["Data: "]; slice.class.fileout[slice, f]; f.PutChar[IO.CR]; f.PutChar[IO.CR]; }; Κζ– "cedar" style˜Iheadšœ™Iprocšœ3™3Jšœ Οmœ1™<šœt™tIcode™!—L˜šΟk ˜ Lšœ†žœ˜—L˜šœžœž˜Lšžœ>ž˜GLšžœ ˜—L˜Lšž˜˜Lšœžœ ˜5Lšœžœ˜1Lšœžœ˜'Lšœ žœ˜%Lšœžœ˜!Lšœžœ"˜:Lšœžœ˜!Lšœ žœ˜'Lšœžœ˜!Lšœžœ˜3Lšœžœ˜Lšœ žœ˜&L˜LšΟnœžœžœ žœ˜;L˜Lšœžœ˜—L˜šŸœžœ˜Mšœ™Mšœ™Mšœ™Mšœ™Mšœ™Mšœ™Mšœ™Mšœ™Mšœ™Mšœ™Mšœ™—Mšœ˜˜M˜—š Ÿœžœžœžœžœ!žœ™_LšœK™KLšœ žœ"™2Lšœ,™,Lšœ:™:Lšœ:™:L™Lšœ6™6š žœ žœžœ@žœ žœž™hLšœ™Lšžœ™—Lšœ™L™—š Ÿœžœžœžœžœ!žœ˜[LšœG˜GLšœ žœ˜,Lšœ,˜,Lšœ:˜:Lšœ:˜:L˜Lšœ5˜5šžœIžœ žœž˜`Lšœ˜Lšžœ˜—Lšœ˜L˜—š Ÿœžœžœžœžœžœ™WLšœD™DLšœ žœ"™2Lšœ,™,Lšœ:™:Lšœ:™:L™Mšœ žœžœ™Mšœ žœžœ™Lšœ6™6š žœ žœžœ@žœ žœž™hLšœ™Lšžœ™—Lšœ™L™L™—š Ÿœžœžœžœžœžœ˜SLšœ@˜@Lšœ žœ˜%Lšœ,˜,Lšœ:˜:Lšœ:˜:L™Mšœ žœžœ˜Mšœ žœžœ˜Lšœ5˜5šžœIžœ žœž˜`Lšœ˜Lšžœ˜—Lšœ˜L˜L˜—šŸœžœžœžœ&˜KMšžœžœžœžœ>˜^Mšœ˜šžœžœžœ˜Mšœ(˜(šžœDžœžœž˜`Mšœ)˜)Mšžœ˜—M˜—M˜L˜—šŸœžœžœžœ˜:Mšœ ˜ Mšœ˜Mšœ žœ˜Lšœ˜Mšœ7˜7Mšœ"˜"Mšœ žœžœ˜Lšœ˜Mšœ7˜7Mšœ"˜"Mšœ žœžœ˜Lšœ˜Mšœ8˜8Mšœ"˜"Mšœ žœžœ˜Lšœ˜Mšœ:˜:Mšœ"˜"Mšœ žœžœ˜Lšœ˜Mšœ*˜*Mšœ9˜9Mšœ%˜%Mšœ žœžœ˜Mšœ žœžœ˜Lšœ˜L˜—šŸ œžœžœ žœ˜9Lšœ@˜@Lšœ ˜ šžœIžœ ž˜`Lšœ˜Lšžœ˜—Lšœ˜—L˜š Ÿœžœžœžœ žœžœ™<šžœžœž™Lšœ'™'L™6Lšžœžœ™—Lšœ™L™—š Ÿœžœžœžœžœ™>Lšœžœ#™7LšœE™EL™Lšœ™Lšœ žœžœ™Lšœ žœžœ™Lšœ™L™—š Ÿ œžœžœžœžœ˜:Lšœžœ#˜7Lšœ#˜#Lšœ˜Lšœ žœžœ˜Lšœ žœžœ˜Lšœ˜—L˜L˜L˜Lšžœ˜—…—$(