DIRECTORY IO USING [STREAM], Rope USING [ROPE]; SerializedFiling: CEDAR DEFINITIONS ~ BEGIN ROPE: TYPE ~ Rope.ROPE; STREAM: TYPE ~ IO.STREAM; Error: ERROR [reason: ATOM, exp: ROPE]; SerializedFile: TYPE ~ RECORD [ version: CARD32, file: SerializedTree ]; currentVersion: CARD32 ~ 3; SerializedTree: TYPE ~ RECORD [ attributes: AttributeSequence, content: SerializedContentBytes, children: SerializedTreeSequence ]; AttributeSequence: TYPE ~ REF AttributeSequenceObject; AttributeSequenceObject: TYPE ~ MACHINE DEPENDENT RECORD [ body: PACKED SEQUENCE length: CARDINAL OF Attribute ]; Attribute: TYPE ~ RECORD [ type: AttributeType, value: AttributeValue ]; AttributeType: TYPE ~ CARD32; AttributeValue: TYPE ~ REF AttributeValueObject; AttributeValueObject: TYPE ~ SegmentObject; SerializedContentBytes: TYPE ~ RECORD [ data: StreamOfUnspecified, lastByteIsSignificant: BOOLEAN ]; StreamOfUnspecified: TYPE ~ LIST OF Segment; Segment: TYPE ~ REF SegmentObject; SegmentObject: TYPE ~ MACHINE DEPENDENT RECORD [ body: PACKED SEQUENCE length: CARDINAL OF CARD16 ]; SerializedTreeSequence: TYPE ~ REF SerializedTreeSequenceObject; SerializedTreeSequenceObject: TYPE ~ MACHINE DEPENDENT RECORD [ body: PACKED SEQUENCE length: CARDINAL OF SerializedTree ]; GetSerializedFile: PROC [s: STREAM] RETURNS [sfout: SerializedFile]; PutSerializedFile: PROC [s: STREAM, sfin: SerializedFile]; GetRopeContents: PROC [sf: SerializedFile] RETURNS [contents: ROPE]; SetRopeContents: PROC [sf: SerializedFile, contents: ROPE] RETURNS [new: SerializedFile]; GetAttributeAsRope: PROC [sf: SerializedFile, type: AttributeType] RETURNS [value: ROPE]; SetAttributeFromRope: PROC [sf: SerializedFile, type: AttributeType, value: ROPE] RETURNS [new: SerializedFile]; GetRopeAttribute: PROC [sf: SerializedFile, type: AttributeType] RETURNS [value: ROPE]; SetRopeAttribute: PROC [sf: SerializedFile, type: AttributeType, value: ROPE] RETURNS [new: SerializedFile]; GetVersionedRopeAttribute: PROC [sf: SerializedFile, type: AttributeType] RETURNS [version: CARD16, value: ROPE]; SetVersionedRopeAttribute: PROC [sf: SerializedFile, type: AttributeType, version: CARD16, value: ROPE] RETURNS [new: SerializedFile]; RopeFromSegment: PROC [segment: Segment, lastByteIsSignificant: BOOLEAN ¬ TRUE] RETURNS [rope: ROPE]; SegmentFromRope: PROC [rope: ROPE] RETURNS [segment: Segment, lastByteIsSignificant: BOOLEAN]; END. Œ SerializedFiling.mesa Copyright Ó 1989, 1991 by Xerox Corporation. All rights reserved. Doug Terry, December 11, 1989 12:09:50 pm PST Willie-Sue, March 21, 1990 11:48:21 am PST Operations for parsing XNS serialized files and such. The serialized file format is defined in the XNS Filing protocol. Willie-s, December 10, 1991 2:32 pm PST Serialized file type Reading/writing serialized files Reads a serialized file from the stream. Writes a serialized file to the stream. Useful extractors, conversions, etc. Returns the contents of the serialized file as a rope. Sets the contents of the serialized file. Finds an attribute of the given type and converts its value to a rope; returns NIL if no such attribute. Sets the value of the given attribute; Raises Error if the rope does not contain an even number of bytes (serialized file attributes must be an even number of bytes); does nothing if the serialized file does not contain an attribute of the specified type. Finds an attribute of the given type; uses CrRPC.GetRope.; returns NIL if no such attribute. Sets the value of the given attribute, using CrRPC.PutRope; does nothing if the serialized file does not contain an attribute of the specified type. Finds an attribute of the given type, the first CARD16 read is returned as version, the rest is read using CrRPC.GetRope; returns value = NIL if no such attribute. Sets the value of the given attribute; first outputs version, then uses CrRPC.PutRope does nothing if the serialized file does not contain an attribute of the specified type. Converts a segment to a rope. Note: this also works for AttributeValues. Converts a rope to a segment. ÊT–(cedarcode) style•NewlineDelimiter ™code•Mark outsideHeader™Kšœ Ïeœ7™BKšœ-™-K™*K™K™xK™'K™—šÏk ˜ Kšžœžœžœ˜Kšœžœžœ˜—K˜KšÐbl Ÿœžœž ˜#šœž˜K˜Kšžœžœžœ˜Kšžœžœžœžœ˜K˜KšÏnœžœ žœžœ˜'—head™šœžœžœ˜Kšœ žœ˜Kšœ˜Kšœ˜—K˜Kšœžœ˜K˜šœžœžœ˜K˜K˜ Kšœ ˜ Kšœ˜—K˜Kšœžœžœ˜6š œžœžœž œžœ˜:Kš œžœžœ žœžœ ˜3K˜—K˜šœ žœžœ˜Kšœ˜K˜K˜—K˜Kšœžœžœ˜K˜Kšœžœžœ˜0Kšœžœ˜+K˜šœžœžœ˜'K˜Kšœž˜Kšœ˜—K˜Kšœžœžœžœ ˜,K˜Kšœ žœžœ˜"š œžœžœž œžœ˜0Kš œžœžœ žœžœž˜0K˜—K˜Kšœžœžœ˜@š œžœžœž œžœ˜?Kš œžœžœ žœžœ˜8K˜—K˜—™ š œžœžœžœ˜DK™(K™—š œžœžœ˜:K™'K™——™$š œžœžœ žœ˜DK™6K™—š œžœ žœžœ˜YK™)K™—š œžœ+žœ žœ˜YK™hK™—š œžœ2žœžœ˜pK™ÿK™—š œžœ+žœ žœ˜WK™\K™—š œžœ2žœžœ˜lK™;K™XK™—š  œžœ+žœ žœ žœ˜qKšœ£™£K™—š  œžœ4žœ žœžœ˜†K™UK™XK™—š  œžœ+žœžœžœžœ˜eKšœI™IK™—š  œžœžœžœ+žœ˜^K™K™K™——Kšžœ˜—…— dD