InnerFacade.mesa
last modified by Satterthwaite, June 7, 1983 10:38 am
DIRECTORY
CompilerOps: TYPE USING [
StreamId, Transaction,
AppendHerald, CompilerVersion, DefaultSwitches, DoTransaction, Start, Stop],
OldCompilerOps: TYPE CompilerOps USING [LetterSwitches, StreamId, Transaction],
BridgeCompilerOps: TYPE USING [],
FileParms: TYPE USING [ActualId, BindingProc, Name, SymbolSpace],
OldFileParms: TYPE FileParms USING [ActualId, BindingProc, SymbolSpace],
FileSegment: TYPE USING [Pages],
OldFileSegment: TYPE FileSegment USING [Pages],
Stream: TYPE USING [Handle],
Strings: TYPE USING [String],
TimeStamp: TYPE USING [Stamp];
InnerFacade: PROGRAM IMPORTS C: CompilerOps EXPORTS BridgeCompilerOps ~ {
LetterSwitches: TYPE ~ OldCompilerOps.LetterSwitches;
Transaction: TYPE ~ OldCompilerOps.Transaction;
ActualId: TYPE ~ FileParms.ActualId;
Name: TYPE ~ FileParms.Name;
SymbolSpace: TYPE ~ FileParms.SymbolSpace;
Pages: TYPE ~ FileSegment.Pages;
MapActualId: PROC [id: OldFileParms.ActualId] RETURNS [ActualId] ~ INLINE {
RETURN [[version~id.version, locator~id.locator]]};
UnmapActualId: PROC [id: ActualId] RETURNS [OldFileParms.ActualId] ~ INLINE {
RETURN [[version~id.version, locator~id.locator]]};
MapSymbolSpace: PROC [s: OldFileParms.SymbolSpace] RETURNS [SymbolSpace] ~ INLINE {
RETURN MapPages[s]};
UnmapSymbolSpace: PROC [s: SymbolSpace] RETURNS [OldFileParms.SymbolSpace] ~ INLINE {
RETURN UnmapPages[s]};
MapPages: PROC [s: OldFileSegment.Pages] RETURNS [Pages] ~ INLINE {
RETURN [[file~s.file, span~[s.span.base, s.span.pages]]]};
UnmapPages: PROC [s: Pages] RETURNS [OldFileSegment.Pages] ~ INLINE {
RETURN [[file~s.file, span~[s.span.base, s.span.pages]]]};
inquiries
DefaultSwitches: PUBLIC PROC RETURNS [LetterSwitches] ~ {
RETURN [C.DefaultSwitches[]]};
CompilerVersion: PUBLIC PROC RETURNS [TimeStamp.Stamp] ~ {
RETURN [C.CompilerVersion[]]};
AppendHerald: PUBLIC PROC [s: Strings.String] ~ {C.AppendHerald[s]};
operations
Start: PUBLIC PROC [scratchZone: UNCOUNTED ZONE] ~ {C.Start[scratchZone]};
DoTransaction: PUBLIC PROC [parms: POINTER TO Transaction] ~ {
mapStreamId: ARRAY C.StreamId[$source..$log] OF OldCompilerOps.StreamId ~ [
source~$source, object~$object, log~$log];
GetStream: PROC [id: C.StreamId] RETURNS [Stream.Handle] ~ {
RETURN [parms.getStream[mapStreamId[id]]]};
MapBinding: PROC [
formalId, formalType: Name,
defaultLocator: Strings.String,
binder: FileParms.BindingProc] ~ {
UnmappedBinder: OldFileParms.BindingProc ~ {
binder[MapActualId[actual]]};
parms.fileParms.Binding[formalId, formalType, defaultLocator, UnmappedBinder]};
MapAcquire: PROC [id: Name, actual: ActualId] RETURNS [SymbolSpace] ~ {
RETURN [MapSymbolSpace[parms.fileParms.Acquire[id, UnmapActualId[actual]]]]};
MapRelease: PROC [s: SymbolSpace] ~ {parms.fileParms.Release[UnmapSymbolSpace[s]]};
MapForget: PROC [id: FileParms.ActualId] ~ {parms.fileParms.Forget[UnmapActualId[id]]};
p: C.Transaction ← [
op ~ IF parms.op = $replace THEN $replace ELSE $compile,
source ~ MapActualId[parms.source],
sourceStream ~ parms.sourceStream,
fileParms ~ [
Binding~MapBinding, Acquire~MapAcquire, Release~MapRelease, Forget~MapForget],
switches ~ parms.switches,
pattern ~ MapActualId[parms.pattern],
objectName ~ parms.objectName, objectFile ~ parms.objectFile,
debugPass ~ parms.debugPass,
objectVersion ~ TRASH,
interface ~ TRASH,
matched ~ TRASH,
sourceTokens ~ TRASH,
nErrors ~ TRASH, nWarnings ~ TRASH,
objectBytes ~ TRASH, objectFrameSize ~ TRASH, linkCount ~ TRASH,
bcdPages ~ TRASH, codePages ~ TRASH, symbolPages ~ TRASH,
getStream ~ GetStream,
startPass ~ parms.startPass];
C.DoTransaction[@p];
parms.objectVersion ← p.objectVersion;
parms.matched ← p.matched;
parms.sourceTokens ← p.sourceTokens;
parms.nErrors ← p.nErrors; parms.nWarnings ← p.nWarnings;
parms.objectBytes ← p.objectBytes;
parms.objectFrameSize ← p.objectFrameSize; parms.linkCount ← p.linkCount};
Stop: PUBLIC PROC ~ {C.Stop[]};
Punt: PUBLIC ERROR ~ CODE;
}.