DIRECTORY Atom, FileNames, GGBasicTypes, AtomButtons, GGError, GGFileOut, GGInterfaceTypes, GGModelTypes, GGObjects, GGParseOut, GGSegmentTypes, IO, Rope; GGFileOutImpl: CEDAR PROGRAM IMPORTS Atom, FileNames, AtomButtons, GGError, GGObjects, GGParseOut, IO EXPORTS GGFileOut = BEGIN EntityGenerator: TYPE = GGModelTypes.EntityGenerator; FenceHoleOpen: TYPE = GGModelTypes.FenceHoleOpen; GargoyleData: TYPE = GGInterfaceTypes.GargoyleData; Outline: TYPE = GGModelTypes.Outline; Point: TYPE = GGBasicTypes.Point; ScalarButtonClient: TYPE = AtomButtons.ScalarButtonClient; Scene: TYPE = GGModelTypes.Scene; Segment: TYPE = GGSegmentTypes.Segment; Slice: TYPE = GGModelTypes.Slice; Traj: TYPE = GGModelTypes.Traj; TwoState: TYPE = AtomButtons.TwoState; Problem: PUBLIC SIGNAL [msg: Rope.ROPE] = GGError.Problem; versionRope: Rope.ROPE; Init: PROC [] ~ { versionRope _ "8702.11"; }; FileoutSceneAndOptions: PUBLIC PROC [f: IO.STREAM, gargoyleData: GargoyleData, fileName: Rope.ROPE] = { entityGen: EntityGenerator _ GGObjects.TopLevelEntitiesInScene[gargoyleData.scene]; entityCount: NAT _ GGObjects.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, gargoyleData]; f.PutF["Entities: [%g]:\n\n", [integer[entityCount]]]; FOR entity: REF ANY _ GGObjects.NextEntity[entityGen], GGObjects.NextEntity[entityGen] UNTIL entity = NIL DO FileoutEntity[f, entity]; ENDLOOP; }; FileoutSceneOnly: PUBLIC PROC [f: IO.STREAM, scene: Scene, fileName: Rope.ROPE] = { entityGen: EntityGenerator _ GGObjects.TopLevelEntitiesInScene[scene]; entityCount: NAT _ GGObjects.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]]]; f.PutChar[IO.CR]; f.PutChar[IO.CR]; f.PutF["Entities: [%g]:\n\n", [integer[entityCount]]]; FOR entity: REF ANY _ GGObjects.NextEntity[entityGen], GGObjects.NextEntity[entityGen] UNTIL entity = NIL DO FileoutEntity[f, entity]; 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, gargoyleData: GargoyleData] = { firstButton: ScalarButtonClient; stateInfo: TwoState; midPointsOn: BOOL; f.PutF["Slope: "]; firstButton _ gargoyleData.hitTest.slopeHeader.scalarButtons; PrintButtonValues[f, firstButton]; f.PutChar[IO.CR]; f.PutF["Angle: "]; firstButton _ gargoyleData.hitTest.angleHeader.scalarButtons; PrintButtonValues[f, firstButton]; f.PutChar[IO.CR]; f.PutF["Radius: "]; firstButton _ gargoyleData.hitTest.radiusHeader.scalarButtons; PrintButtonValues[f, firstButton]; f.PutChar[IO.CR]; f.PutF["LineDistance: "]; firstButton _ gargoyleData.hitTest.distanceHeader.scalarButtons; PrintButtonValues[f, firstButton]; f.PutChar[IO.CR]; f.PutF["Midpoints: "]; stateInfo _ gargoyleData.hitTest.midpointButton; midPointsOn _ AtomButtons.GetButtonState[stateInfo] = on; GGParseOut.WriteBOOL[f, midPointsOn]; f.PutChar[IO.CR]; f.PutChar[IO.CR]; }; CountEntities: PROC [entities: LIST OF REF ANY] RETURNS [count: NAT] = { count _ 0; FOR list: LIST OF REF ANY _ entities, list.rest UNTIL list = NIL DO count _ count + 1; ENDLOOP; }; FileoutEntity: 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; }; FileoutSlice: 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]; }; Init[]; END. File: GGFileOutImpl.mesa Last edited by Bier on January 28, 1987 8:54:58 pm PST 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, February 11, 1987 8:19:33 am PST versionRope _ "8610.29"; versionRope _ "8612.04"; versionRope _ "8701.13"; versionRope _ "8701.135"; versionRope _ "8701.23"; versionRope _ "8701.26"; versionRope _ "8701.28"; versionRope _ "8701.30"; FileoutAlignments[f, gargoyleData]; Κm– "cedar" style˜Iheadšœ™Iprocšœ6™6Jšœ Οmœ1™<šœt™tIcode™&—L˜šΟk ˜ Lšœ‡žœ˜—L˜šœžœž˜Lšžœ?ž˜HLšžœ ˜—L˜Lšž˜˜Lšœžœ ˜5Lšœžœ˜1Lšœžœ!˜3Lšœ žœ˜%Lšœžœ˜!Lšœžœ"˜:Lšœžœ˜!Lšœ žœ˜'Lšœžœ˜!Lšœžœ˜Lšœ žœ˜&L˜LšΟnœžœžœ žœ˜:L˜Lšœžœ˜—L˜šŸœžœ˜Mšœ™Mšœ™Mšœ™Mšœ™Mšœ™Mšœ™Mšœ™Mšœ™—Mšœ˜˜M˜—š Ÿœžœžœžœžœ-žœ˜gLšœS˜SLšœ žœ$˜4Lšœ,˜,Lšœ:˜:Lšœ:˜:L˜#Lšœ6˜6š žœ žœžœDžœ žœž˜lLšœ˜Lšžœ˜—Lšœ˜L˜—š Ÿœžœžœžœžœžœ˜SLšœF˜FLšœ žœ$˜4Lšœ,˜,Lšœ:˜:Lšœ:˜:L™#Mšœ žœžœ˜Mšœ žœžœ˜Lšœ6˜6š žœ žœžœDžœ žœž˜lLšœ˜Lšžœ˜—Lšœ˜L˜L˜—šŸœžœžœžœ&˜KMšžœžœžœžœ>˜^Mšœ˜šžœžœžœ˜Mšœ(˜(šžœDžœžœž˜`Mšœ)˜)Mšžœ˜—M˜—M˜L˜—šŸœžœžœžœ!˜FMšœ ˜ Mšœ˜Mšœ žœ˜Lšœ˜Mšœ=˜=Mšœ"˜"Mšœ žœžœ˜Lšœ˜Mšœ=˜=Mšœ"˜"Mšœ žœžœ˜Lšœ˜Mšœ>˜>Mšœ"˜"Mšœ žœžœ˜Lšœ˜Mšœ@˜@Mšœ"˜"Mšœ žœžœ˜Lšœ˜Mšœ0˜0Mšœ9˜9Mšœ%˜%Mšœ žœžœ˜Mšœ žœžœ˜Lšœ˜L˜—šŸ œžœ žœžœžœžœžœ žœ˜HLšœ ˜ šžœžœžœžœžœžœžœž˜CLšœ˜Lšžœ˜—Lšœ˜—L˜š Ÿ œžœžœžœ žœžœ˜8šžœžœž˜Lšœ'˜'L˜6Lšžœžœ˜—Lšœ˜L˜—š Ÿ œžœžœžœžœ˜:Lšœžœ#˜7LšœE˜EL˜Lšœ˜Lšœ žœžœ˜Lšœ žœžœ˜Lšœ˜L˜—L˜L˜Lšžœ˜—…—*³