DIRECTORY GGBasicTypes, GGParseOut, Imager, ImagerColor, ImagerColorPrivate, ImagerTransformation, IO, Rope; GGParseOutImpl: CEDAR PROGRAM IMPORTS ImagerColorPrivate, IO EXPORTS GGParseOut = BEGIN Color: TYPE = Imager.Color; Point: TYPE = GGBasicTypes.Point; StrokeEnd: TYPE = Imager.StrokeEnd; WriteColor: PUBLIC PROC [f: IO.STREAM, color: Color] = { r, g, b: REAL; noColor: BOOL _ color=NIL; IF noColor THEN f.PutRope["none"] ELSE { cc: ImagerColor.ConstantColor _ NARROW[color]; r _ ImagerColorPrivate.ComponentFromColor[cc, $Red]; g _ ImagerColorPrivate.ComponentFromColor[cc, $Green]; b _ ImagerColorPrivate.ComponentFromColor[cc, $Blue]; f.PutF["[%g,%g,%g]",[real[r]], [real[g]], [real[b]]]; }; }; WriteStrokeEnd: PUBLIC PROC [f: IO.STREAM, lineEnds: StrokeEnd] = { rope: Rope.ROPE; SELECT lineEnds FROM square => rope _ "square"; butt => rope _ "butt"; round => rope _ "round"; ENDCASE => ERROR; f.PutRope[rope]; }; WritePoint: PUBLIC PROC [f: IO.STREAM, point: Point] = { f.PutF["[%g,%g]", [real[point.x]], [real[point.y]]]; }; WriteTransformation: PUBLIC PROC [f: IO.STREAM, transform: ImagerTransformation.Transformation] = { f.PutF["[%g %g %g ", [real[transform.a]], [real[transform.b]], [real[transform.c]]]; f.PutF["%g %g %g]", [real[transform.d]], [real[transform.e]], [real[transform.f]]]; }; WriteBOOL: PUBLIC PROC [f: IO.STREAM, bool: BOOL] = { IF bool THEN f.PutRope["TRUE"] ELSE f.PutRope["FALSE"]; }; WriteProps: PUBLIC PROC [f: IO.STREAM, props: LIST OF REF ANY] = { f.PutChar[IO.SP]; FOR name: LIST OF REF ANY _ props, name.rest UNTIL name=NIL DO f.PutRope[NARROW[name.first]]; f.PutChar[IO.SP]; ENDLOOP; }; END. $GGParseOutImpl.mesa Last edited by Bier, July 17, 1986 10:19:31 pm PDT Copyright c 1986 by Xerox Corporation. All rights reserved. Contents: Routines which turn various Gargoyle data structures into Rope.ROPEs and write them onto a file stream. Pier, October 29, 1986 7:57:38 pm PST Κ•˜codešœ™Kšœ2™2Kšœ Οmœ1™Kšœ žœžœžœ˜0Kšžœ˜—K˜—K˜Kšžœ˜J˜—…—n '