-- AMModelBridge.Mesa
-- Russ Atkinson, October 21, 1982 3:41 pm
-- last modified on October 25, 1982 4:36 pm by Paul Rovner

DIRECTORY
AMModel USING[Context, Section],
PrincOps USING[BytePC],
RTBasic USING[TV];

AMModelBridge: DEFINITIONS
= BEGIN OPEN AMModel, PrincOps, RTBasic;

LoadedSection: TYPE = RECORD[section: Section, context: --prog--Context];
-- A LoadedSection is a convenience for clients of AMModelBridge. Each represents one of:
-- loaded compiler output bundle for a prog module
-- loaded compiler output bundle for a proc
-- loaded compiler output bundle for a statement

LoadedSectionForProc: PROC[tv: TV--proc--] RETURNS[LoadedSection];

ProcFromLoadedSection: PROC[proc: LoadedSection] RETURNS[TV--proc--];

-- This guy goes away when the conversion of BugBane and friends to the
-- AMModel world is complete
LoadedSectionForProgPC: PROC[prog: Context, pc: BytePC] RETURNS[LoadedSection];


-- (INTERIM) procs below provide conversion between TVs and Contexts. The right way to do
-- all this is to have AMModel include the operations of AMTypes that deal with localFrame
-- and globalFrame TVs. TVForFHReferent and friends should be replaced here with appropriate
-- replacements for the guys below.

ContextForFrame
: PROC[tv: TV--globalFrame or localFrame--] RETURNS[Context] =
INLINE {RETURN[tv]};

FrameFromContext: PROC[context: Context--prog, proc--]
RETURNS[TV--globalFrame, localFrame--] =
INLINE {RETURN[context]};

END.