<> <> <> <<>> <> <<>> DIRECTORY Basics USING [charsPerWord, UnsafeBlock], BasicTime USING [GMT], Rope USING [ROPE], YggDID USING [DID], YggFile USING [FileHandle], YggEnvironment USING [AccessRights, LockOption, TransID]; YggRep: CEDAR DEFINITIONS ~ BEGIN ROPE: TYPE ~ Rope.ROPE; <> TypedPrimitiveElement: TYPE ~ RECORD [docType: DocType, bits: Bits]; <> <<>> DocType: TYPE ~ CARD; <> <> unknown: CARD = 0; -- place holder during various operations; never should be seen by clients int: CARD = 1; -- 32 bit integers rope: CARD = 2; -- (long null containing) strings shortRope: CARD = 3; -- strings that are short and null terminated float: CARD = 4; -- 32 bit floating point date: CARD = 5; -- GMT date uninterpretedBytes: CARD = 6; -- (long) byte sequences lastReservedDocType: CARD = 1023; -- all of types up to and including this one are reserved by the system Bits: TYPE ~ REF; -- For well known types, Bits is a REF to an INT32, ROPE, REAL32, or YggRep.AccurateGMT. Otherwise it is a REF BitsRep. BitsRep: TYPE ~ RECORD [ validBytes: CARD, b: PACKED SEQUENCE length: CARD OF BYTE ]; <> <<>> BytesFromBits: PROC [bits: Bits, startByte: CARD, block: Basics.UnsafeBlock]; <> <<>> <<>> SizeOfBits: PROC [bits: Bits] RETURNS [size: CARD]; <> <<>> <<>> SetSizeOfBits: PROC [bits: Bits, size: CARD] RETURNS [newRef: BOOL, newBits: Bits]; <> <<>> <<>> BytesToBits: PROC [bits: Bits, startByte: CARD, block: Basics.UnsafeBlock] RETURNS [newRef: BOOL, newBits: Bits]; <> <<>> <<>> AccurateGMT: TYPE ~ REF AccurateGMTRep; AccurateGMTRep: TYPE ~ RECORD [ gmt: BasicTime.GMT, -- 1968 to 2036 (231 seconds) usecs: INT32 ]; AccurateGMTRepByteSize: INT = WORDS[AccurateGMTRep] * Basics.charsPerWord; <<>> VDoc: TYPE ~ REF VDocRep; VDocRep: TYPE ~ RECORD [ did: YggDID.DID, -- document identifier for the document contents: TypedPrimitiveElement _ [unknown, NIL], attributes: LIST OF Attribute _ NIL -- the attributes of the document ]; <> <<>> Attribute: TYPE ~ RECORD [ attributeName: ROPE, -- name of the attribute (not unique for a given document) ordered: BOOL, -- whether the the valueSet is ordered value: LIST OF AttributeValue -- set of values for attribute ]; <> <<>> AttributeValue: TYPE ~ RECORD [ fieldName: ROPE, -- name of the attribute (not unique for a given document) valueSet: LIST OF TypedPrimitiveElement -- set of values for field ]; <> <<>> VolatizeFromDID: PROC [transID: YggEnvironment.TransID, did: YggDID.DID, access: YggEnvironment.AccessRights _ readOnly, lock: YggEnvironment.LockOption _ [intendRead, wait]] RETURNS [document: VDoc]; <> <<>> <<>> StabilizeToFiles: PROC [transID: YggEnvironment.TransID, did: YggDID.DID, document: VDoc, contents, attributes, links: YggFile.FileHandle]; <> <<>> <<>> <> <> <<>> <> <> <> <> <<0 0 = ordered>> <<1 0 = no field names>> <<2 0 = singleton attribute value (i. e., there is only one field)>> <<3 0 = singleton field value(s) (i. e., every field has only one value)>> <<4-6 code for type of data>> << 0 - each one is separate>> << 1 - integer (32 bit)>> << 2 - rope (may be large and contain nulls)>> << 3 - rope (shorter and null terminated)>> << 4 - float (32 bit)>> << 5 - date (GMT)>> << 6 - uninterpreted bytes>> << 7 - to be defined>> <<7 to be defined>> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <<>> charsPerWord: CARD ~ BITS[WORD]/8; AttributePreamble: TYPE ~ PACKED ARRAY [0..charsPerWord) OF AttributePreambleByte; <> AttributePreambleByte: TYPE ~ MACHINE DEPENDENT RECORD [ ordered (0:0..0): BOOL _ FALSE, -- true if the attribute values are ordered noFieldNames (0:1..1): BOOL _ FALSE, -- true if there are no field names singletonAttribute (0:2..2): BOOL _ FALSE, -- true if there is only one field in the attribute singletonField (0:3..3): BOOL _ FALSE, -- true if there is only one value in each of the fields typeCode (0:4..6): AttributePreambleType _ separate, -- code for type of data spare (0:7..7): BOOL _ FALSE ]; <> <<>> AttributePreambleType: TYPE ~ MACHINE DEPENDENT { separate (0), integer (1), ropeLarge (2), ropeShort (3), float (4), date (5), uninterpretedBytes (6), spare2 (7)}; <> END.