-- CedarLinkerOps.mesa -- Last edited by John Maxwell on: January 12, 1983 10:21 am DIRECTORY Atom USING [GetProp, PutProp], BcdDefs USING [Link, NullVersion, VersionStamp], BcdOps USING [BcdBase, MTHandle], PilotLoadStateOps USING [Map], PrincOps USING [ControlLink, GFTIndex, GlobalFrameHandle], Rope USING [Text]; CedarLinkerOps: DEFINITIONS IMPORTS Atom = BEGIN OPEN BcdDefs, BcdOps, PrincOps, PilotLoadStateOps; IR: TYPE = REF IRRecord; IRRecord: TYPE = RECORD[s: SEQUENCE size: NAT OF PrincOps.ControlLink]; Export: PROC[bcd: BcdBase, map: Map]; Bind: PROC[bcd: BcdBase, map: Map] RETURNS[resolved: BOOLEAN]; GetIR: PROCEDURE[ -- either the atom or the version must be non-NIL atom: ATOM _ NIL, version: VersionStamp _ NullVersion, length: CARDINAL _ 0] -- in case a new one must be created RETURNS[name: ATOM, interface: IR, versionStamp: VersionStamp]; GetFrame: PROC[interface: IR, index: CARDINAL] RETURNS[GlobalFrameHandle]; -- returns the frame of an exported variable NullLink: PROC[link: UNSPECIFIED] RETURNS[BOOLEAN] = INLINE BEGIN RETURN[ LOOPHOLE[link, CARDINAL] = 0 OR -- PrincOps.NullLink LOOPHOLE[link, CARDINAL] = 1]; END; -- PrincOps.UnboundLink OpenLinkSpace: PROC[frame: GlobalFrameHandle, mth: MTHandle, bcd: BcdBase _ NIL]; ReadLink: PROC[offset: CARDINAL] RETURNS [link: ControlLink]; WriteLink: PROC[offset: CARDINAL, link: ControlLink]; CloseLinkSpace: PROC[frame: GlobalFrameHandle]; GetSpace: PROC[nwords: CARDINAL] RETURNS [p: POINTER]; FreeSpace: PROC[p: POINTER]; LinkSegmentLength: PROC[mth: MTHandle, bcd: BcdBase] RETURNS[CARDINAL]; IthLink: PROC[mth: MTHandle, i: CARDINAL, bcd: BcdBase] RETURNS[Link]; -- private definitions GetPendingList: PRIVATE PROC[interface: ATOM] RETURNS[PendingList] = INLINE {RETURN[NARROW[Atom.GetProp[interface, $pending]]]}; SetPendingList: PRIVATE PROC[interface: ATOM, list: PendingList] = INLINE {Atom.PutProp[interface, $pending, list]}; GetBinding: PROC[bcd: BcdBase] RETURNS[binding: Binding]; -- already filled in FindVariableLink: PROC[bcd: BcdBase, mthLink: Link, rgfi: PrincOps.GFTIndex] RETURNS [link: PrincOps.ControlLink, frame: PrincOps.GlobalFrameHandle]; pendingModules: PRIVATE LIST OF PendingModule; -- list of people waiting for a MODULE to be exported Binding: TYPE = REF BindingSequence; BindingSequence: TYPE = RECORD[s: SEQUENCE size: NAT OF BindLink]; -- A Binding is a mapping between the dummy gfi's within the bcd and real interfaces. -- Bindings are only legal for [bcd.firstdummy..bcd.firstdummy+bcd.nDummies) ! BindLink: TYPE = RECORD[ whichgfi: PrincOps.GFTIndex _ 0, -- if there is more than one gfi for this interface atom: ATOM, -- so we can get and set the pending list interface: IR]; PendingList: TYPE = LIST OF Pending; Pending: TYPE = RECORD[ -- frame, mth, and bcd are parameters to OpenLinkSpace frame: GlobalFrameHandle, mth: MTHandle, bcd: BcdBase, index: CARDINAL, -- index into the links area link: PrincOps.ControlLink]; -- either a) an index into the IR or b) the actual link PendingModule: TYPE = RECORD[ -- frame, mth, and bcd are parameters to OpenLinkSpace frame: PrincOps.GlobalFrameHandle, mth: MTHandle, bcd: BcdBase, index: CARDINAL, -- index into the links area name: Rope.Text, -- name of module we are waiting for version: BcdDefs.VersionStamp]; -- version of module we are waiting for END . .