-- file Literals.mesa
-- last modified by Satterthwaite, February 17, 1983 3:02 pm

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

Literals: DEFINITIONS = {

  Base: TYPE = Table.Base;
  Finger: TYPE = Table.Finger;
  Limit: NAT = Table.Limit/2;
  
 -- data structures

  LitIndex: TYPE = RECORD [
    SELECT litTag: * FROM
      word => [lti: LTIndex],
      string => [sti: 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..CARDINAL.LAST/2],
	length: CARDINAL,
	value: WordSequence]
      ENDCASE];

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

  LTId: TYPE = RECORD [baseP: Finger, index: LitIndex.word];

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


 -- string literals

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

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

 -- table allocation codes

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

  }.