-- file Literals.Mesa
-- last modified by Satterthwaite, 23-Oct-81 14:35:03

DIRECTORY
  Symbols: TYPE USING [SEIndex],
  Table: TYPE USING [Base, Finger, Selector, Limit];

Literals: DEFINITIONS = {

  Base: TYPE = Table.Base;
  Finger: TYPE = Table.Finger;
  Limit: NAT = Table.Limit/2;
  
 -- 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..LAST[CARDINAL]/2],
	length: CARDINAL,
	value: WordSequence]
      ENDCASE];

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

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

  LitDescriptor: TYPE = RECORD[
    offset: Base RELATIVE POINTER [0..LAST[CARDINAL]) 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],
      heap => [
	link: MSTIndex,
	type: Symbols.SEIndex,
	info: CARDINAL]
      ENDCASE];

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

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

 -- table allocation codes

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

  }.