FakeCirioImpl.mesa
Copyright Ó 1989, 1990, 1991, 1992 by Xerox Corporation. All rights reserved.
Peter B. Kessler, April 18, 1990 5:17 pm PDT
Philip James, March 6, 1992 1:22 pm PST
DIRECTORY
FakeCirio,
TargetArchitecture,
BreakWorldArchitecture,
IncrementalLoad,
Rope,
UXStrings;
FakeCirioImpl: CEDAR PROGRAM
IMPORTS
FakeCirio, TargetArchitecture, BreakWorldArchitecture, IncrementalLoad, Rope, UXStrings
EXPORTS FakeCirio
~ {
PeekContents: PUBLIC BreakWorldArchitecture.PeekContentsProc ~ TRUSTED {
PROCEDURE [address: BreakWorldArchitecture.Address]
RETURNS
[TargetArchitecture.Contents]
contents: TargetArchitecture.Contents ← TargetArchitecture.nullContents;
IF address.IsNullAddress[] THEN {
ERROR FakeCirio.Cant[message: "PeekContents[nullAddress]"];
};
{
targetAddress: TargetArchitecture.Address ~
BreakWorldArchitecture.TargetAddressFromBreakWorldAddress[address: address];
IF targetAddress.IsNullAddress[] THEN {
ERROR FakeCirio.Cant[message: "PeekContents[nullTargetAddress]"];
};
{
contentsAddress: POINTER TO TargetArchitecture.Contents ~ LOOPHOLE[targetAddress];
contents ← contentsAddress^;
};
};
RETURN [contents];
};
PokeContents: PUBLIC BreakWorldArchitecture.PokeContentsProc ~ TRUSTED {
PROCEDURE [address: BreakWorldArchitecture.Address, contents: TargetArchitecture.Contents] RETURNS []
IF address.IsNullAddress[] THEN {
ERROR FakeCirio.Cant[message: "PokeContents[nullAddress]"];
};
{
targetAddress: TargetArchitecture.Address ~
BreakWorldArchitecture.TargetAddressFromBreakWorldAddress[address: address];
IF targetAddress.IsNullAddress[] THEN {
ERROR FakeCirio.Cant[message: "PokeContents[nullTargetAddress]"];
};
{
contentsAddress: POINTER TO TargetArchitecture.Contents ~ LOOPHOLE[targetAddress];
contentsAddress^ ← contents;
};
};
RETURN;
};
GetProcAddress: PUBLIC BreakWorldArchitecture.GetProcAddressProc ~ TRUSTED {
PROCEDURE [breakWorld: breakWorld, procName: Rope.ROPE]
RETURNS
[BreakWorldArchitecture.Address]
procAddress: BreakWorldArchitecture.Address ← BreakWorldArchitecture.nullAddress;
IF breakWorld.IsNullBreakWorld[] THEN {
ERROR FakeCirio.Cant[message: "GetProcAddress[nullBreakWorld]"];
};
IF procName.IsEmpty[] THEN {
ERROR FakeCirio.Cant[message: "GetProcAddress[nullProcName]"];
};
{
procString: IncrementalLoad.charStar ~ UXStrings.Create[from: procName];
symEntry: IncrementalLoad.XRILSymEntry ~ IncrementalLoad.XRILLookupSymEntry[
sym: procString, externOnly: FALSE];
IF symEntry = IncrementalLoad.nullXRILSymEntry THEN {
ERROR FakeCirio.Cant[message: "GetProcAddress[nullSymEntry]"];
};
{
procTargetAddress: TargetArchitecture.Address ~ LOOPHOLE[symEntry.ilsevalue];
IF procTargetAddress.IsNullAddress[] THEN {
ERROR FakeCirio.Cant[message: "GetProcAddress[nullProcTargetAddress]"];
};
procAddress ← BreakWorldArchitecture.NewAddress[
breakWorld: breakWorld, address: procTargetAddress];
};
};
RETURN [procAddress];
};
GetProcDataSegment: PUBLIC BreakWorldArchitecture.GetProcDataSegmentProc ~ TRUSTED {
PROCEDURE [breakWorld: BreakWorld, address: Address] RETURNS [Address];
procDataSegment: BreakWorldArchitecture.Address ← BreakWorldArchitecture.nullAddress;
symEntry: IncrementalLoad.XRILSymEntry;
IF breakWorld.IsNullBreakWorld[] THEN {
ERROR FakeCirio.Cant[message: "GetProcDataSegment[nullBreakWorld]"];
};
IF address.IsNullAddress[] THEN {
ERROR FakeCirio.Cant[message: "GetProcDataSegment[nullAddress]"];
};
{
symEntry ← IncrementalLoad.XRILLookupSymEntryByValue[val: LOOPHOLE[address.address]];
IF symEntry = IncrementalLoad.nullXRILSymEntry THEN {
ERROR FakeCirio.Cant[message: "GetProcDataSegment[nullSymEntry]"];
};
};
RETURN [BreakWorldArchitecture.NewAddress[breakWorld, LOOPHOLE[symEntry.ilseilfe.ilfedAddr]]];
};
GetPatchArea: PUBLIC BreakWorldArchitecture.GetPatchAreaProc ~ TRUSTED {
PROCEDURE [address: BreakWorldArchitecture.Address]
RETURNS
[BreakWorldArchitecture.PatchAreaRep]
patchAreaRep: BreakWorldArchitecture.PatchAreaRep ← BreakWorldArchitecture.nullPatchAreaRep;
IF address.IsNullAddress[] THEN {
ERROR FakeCirio.Cant[message: "GetPatchArea[nullAddress]"];
};
{
breakWorld: BreakWorldArchitecture.BreakWorld ~
BreakWorldArchitecture.BreakWorldFromBreakWorldAddress[address: address];
targetAddress: TargetArchitecture.Address ~
BreakWorldArchitecture.TargetAddressFromBreakWorldAddress[address: address];
IF breakWorld.IsNullBreakWorld[] THEN {
ERROR FakeCirio.Cant[message: "GetPatchArea[nullBreakWorld]"];
};
IF targetAddress.IsNullAddress[] THEN {
ERROR FakeCirio.Cant[message: "GetPatchArea[nullTargetAddress]"];
};
{
symEntry: IncrementalLoad.XRILSymEntry ~
IncrementalLoad.XRILLookupSymEntryByValue[val: LOOPHOLE[targetAddress]];
IF symEntry = IncrementalLoad.nullXRILSymEntry THEN {
ERROR FakeCirio.Cant[message: "GetProcAddress[nullSymEntry]"];
};
{
fileEntry: IncrementalLoad.XRILFileEntry ~ symEntry.ilseilfe;
IF fileEntry = IncrementalLoad.nullXRILFileEntry THEN {
ERROR FakeCirio.Cant[message: "GetPatchArea[nullFileEntry]"];
};
patchAreaRep.address ← BreakWorldArchitecture.NewAddress[
breakWorld: breakWorld, address: LOOPHOLE[fileEntry.ilfepAddr]];
patchAreaRep.byteSize ← fileEntry.ilfepBytes;
};
};
};
RETURN [patchAreaRep];
};
Cant: PUBLIC ERROR [message: Rope.ROPE] ~ CODE;
}.