SameBreakWorldImpl.mesa
Copyright Ó 1990 by Xerox Corporation. All rights reserved.
Peter B. Kessler, August 6, 1990 5:10 pm PDT
Access to Cirio for the same world.
DIRECTORY
SameBreakWorld,
BreakWorldArchitecture,
CirioBreakAccess,
CirioNubAccess,
IO,
LoadStateAccess,
NewRMTW,
PFS,
Rope,
SystemInterface;
SameBreakWorldImpl: CEDAR PROGRAM
IMPORTS
SystemInterface, CirioNubAccess, LoadStateAccess, NewRMTW, IO, PFS, CirioBreakAccess
EXPORTS SameBreakWorld
~ {
Handle: PUBLIC TYPE ~ REF HandleRep ← NIL;
HandleRep: PUBLIC TYPE ~ RECORD [
sameWorldNub: CirioNubAccess.Handle ← NIL,
fileSet: SystemInterface.FileSet ← NIL,
moduleSet: NewRMTW.CedarModuleSet ← NIL,
loadState: LoadStateAccess.LoadStateHandle ← NIL,
breakWorld: BreakWorldArchitecture.BreakWorld ←
BreakWorldArchitecture.nullBreakWorld
];
Create: PUBLIC PROCEDURE [] RETURNS [SameBreakWorld.Handle] ~ {
handle: Handle ← NEW[HandleRep ← [
sameWorldNub: ,
fileSet: ,
moduleSet: NIL,
loadState: NIL,
breakWorld: BreakWorldArchitecture.nullBreakWorld]];
sameWorldServerName: Rope.ROPE ~ "sameWorld";
cf. LocalCirioImpl.InstallNewConnectionComponents.
handle.sameWorldNub ← CirioNubAccess.CreateSameWorldNub[];
handle.fileSet ← SystemInterface.CreateFileSet[];
handle.moduleSet ← NewRMTW.CreateCedarModuleSet[fileSet: handle.fileSet];
handle.loadState ← LoadStateAccess.CreateLoadStateHandle[
serverName: sameWorldServerName,
nub: handle.sameWorldNub, fileSet: handle.fileSet];
{
breakSet: CirioBreakAccess.CirioBreakSet ← CirioBreakAccess.CreateCirioBreakSet[
nub: handle.sameWorldNub,
fileNameStem: "PopUpDriver2",
breakProcName: "BreakPointPopUp"];
cf. Cirio/LocalCirioImpl.mesa
handle.breakWorld ← CirioBreakAccess.BreakWorldFromBreakSet[breaks: breakSet];
};
RETURN [handle];
};
Destroy: PUBLIC PROCEDURE [handle: SameBreakWorld.Handle] RETURNS [] ~ {
IF handle # NIL THEN {
IF handle.breakWorld # BreakWorldArchitecture.nullBreakWorld THEN {
handle.breakWorld ← BreakWorldArchitecture.nullBreakWorld;
};
IF handle.loadState # NIL THEN {
handle.loadState ← NIL;
};
IF handle.moduleSet # NIL THEN {
handle.moduleSet ← NIL;
};
IF handle.fileSet # NIL THEN {
SystemInterface.CloseFileSet[set: handle.fileSet];
handle.fileSet ← NIL;
};
IF handle.sameWorldNub # NIL THEN {
CirioNubAccess.DestroyNub[h: handle.sameWorldNub];
handle.sameWorldNub ← NIL;
};
};
RETURN;
};
BreakWorld: PUBLIC PROCEDURE [handle: SameBreakWorld.Handle]
RETURNS [BreakWorldArchitecture.BreakWorld] ~ {
breakWorld: BreakWorldArchitecture.BreakWorld ←
BreakWorldArchitecture.nullBreakWorld;
IF handle # SameBreakWorld.nullHandle THEN {
breakWorld ← handle.breakWorld
};
RETURN [breakWorld];
};
PCFromFileAndPosition: PUBLIC PROCEDURE [
handle: SameBreakWorld.Handle,
mesaFilename: Rope.ROPE, position: INT, report: IO.STREAM]
RETURNS [address: CARD ← 0, correspondingPosition: INT ← 0] ~ {
IF handle # SameBreakWorld.nullHandle THEN {
ENABLE {
SystemInterface.ShowReport => {
report.PutRope[msgText];
report.PutChar['\n];
RESUME;
};
};
mesaFile: NewRMTW.CirioFile ← SystemInterface.GetCirioFile[
set: handle.fileSet, name: PFS.PathFromRope[rope: mesaFilename]];
addr: REF NewRMTW.CedarBreakAddress ← NewRMTW.GetAbsAddressForBreak[
modules: handle.moduleSet,
mesa: mesaFile,
loadState: handle.loadState,
sourcePos: position];
IF addr = NIL THEN ERROR NotFound;
address ← addr.absPC;
correspondingPosition ← addr.correspondingMesaPosition;
};
RETURN [address: address, correspondingPosition: correspondingPosition];
};
NotFound: PUBLIC ERROR ~ CODE;
}.