-- File DBStorageString.mesa
-- Last edited by MBrown on 20-Jun-81 16:14:59


  DIRECTORY
    DBStorageTID USING[TID],
    DBStorageVec USING[SlotIndexField, VecHeader, LengthField];

DBStorageString: DEFINITIONS = BEGIN OPEN DBStorageTID;
  -- This interface contains the internal storage level definitions that relate to the
  --representation of VarByte (and VarWord) fields.


  IString: TYPE = MACHINE DEPENDENT RECORD[
    bytesInString: DBStorageVec.LengthField,
      -- length, in bytes, of string stored in text portion of InlineString.
    slotOfExtension: DBStorageVec.SlotIndexField,
      -- zero means no extension (whole string fits into text field)
      -- nonzero is slot number of an LString.
    rest: SELECT OVERLAID * FROM
      word => [words: ARRAY [0..0) OF WORD ← NULL],
      text => [text: PACKED ARRAY [0..0) OF CHARACTER ← NULL],
      ENDCASE
  ];--IString
  -- This is the portion of a variable length field (VarByte or VarWord) that is stored
  --in the tuple body.  The text portion allows space to be reserved in the tuple body
  --for the "expected" length of the field.  The actual amount of space for text in an
  --IString is not represented anywhere in the tuple body, but is kept in the field
  --handle that is used for all accesses to this field.

  SizeOfNullIString: CARDINAL = SIZE[IString];

  LString: TYPE = MACHINE DEPENDENT RECORD[
    header: DBStorageVec.VecHeader,
      -- LString is stored in a vec, so prefix is a VecHeader
    bytesInRemString: CARDINAL,
      -- length of string represented by this LString (so storage allocation can be done
      --all at once).
    eStringID: TID
      -- ID of a "tuple" on another page; this tuple holds the first chars from
      --remainder of string. Can't be null.
  ];--LString

  SizeOfNullLString: CARDINAL = SIZE[LString];

  EString: TYPE = MACHINE DEPENDENT RECORD[
    header: DBStorageVec.VecHeader,
      -- EString is stored in a vec, so prefix is a VecHeader
    eStringID: TID,
      -- ID of a "tuple" on another page; this tuple holds the first chars from
      --remainder of string. Null => this tuple holds tail of string.
    rest: SELECT OVERLAID * FROM
      word => [words: ARRAY [0..0) OF WORD ← NULL],
      text => [text: PACKED ARRAY [0..0) OF CHARACTER ← NULL],
      ENDCASE
  ];--EString

  SizeOfNullEString: CARDINAL = SIZE[EString];


END.--DBStorageString


CHANGE LOG

Created by MBrown on August 12, 1980  11:03 AM

Changed by MBrown on 20-Jun-81 16:14:07
-- use overlaid variants to view variable part of records as words or bytes.