-- file Literals.Mesa
-- last modified by Satterthwaite, August 28, 1978  11:07 AM

DIRECTORY
  AltoDefs: FROM "altodefs" USING [VMLimit],
  Table: FROM "table" USING [Base, Finger, Selector, Limit];

Literals: DEFINITIONS =
  BEGIN

 -- data structures

  LitRecord: TYPE = RECORD [
    SELECT litTag: * FROM
      word => [index: LTIndex],
      string => [index: STIndex],
      ENDCASE];

 -- literal constants

  WordSequence: TYPE = ARRAY [0..0) OF WORD;

  LTRecord: TYPE = RECORD [
    link: LTIndex,
    datum: SELECT kind: * FROM
      short => [value: WORD],
      long => [
	codeIndex: [0..AltoDefs.VMLimit/2],
	length: CARDINAL,
	value: WordSequence],
      ENDCASE];

  LTIndex: TYPE = Table.Base RELATIVE POINTER [0..Table.Limit/2) TO LTRecord;
   LTNull: LTIndex = LAST[LTIndex];

  LTId: TYPE = RECORD [baseP: Table.Finger, index: LTIndex];

  LitDescriptor: TYPE = RECORD[
    offset: Table.Base RELATIVE POINTER [0..AltoDefs.VMLimit) TO WordSequence,
    length: CARDINAL];


 -- string literals

  STRecord: TYPE = RECORD [
    SELECT kind: * FROM
      master => [
	link: MSTIndex,
	local: BOOLEAN,
	info: CARDINAL,
	codeIndex: CARDINAL,
	string: StringBody],
	-- the actual string text follows here
      copy => [
	mark: BOOLEAN,
	link: MSTIndex],
      ENDCASE];

  SizeSTPrefix: CARDINAL = SIZE[master STRecord] - SIZE[StringBody];

  STIndex: TYPE = Table.Base RELATIVE POINTER [0..Table.Limit/2) TO STRecord;
   STNull: STIndex = LAST[STIndex];
  MSTIndex: TYPE = Table.Base RELATIVE POINTER [0..Table.Limit/2) TO master STRecord;

 -- table allocation codes

  ltType: Table.Selector = 7;
  stType: Table.Selector = 8;

  END.