Text preview for : MakeImage.mesa_Oct77.pdf part of xerox MakeImage.mesa Oct77 xerox mesa 3.0_1977 listing MakeImage.mesa_Oct77.pdf



Back to : MakeImage.mesa_Oct77.pdf | Home

makeiMAGE.mESA 24-0CT-77 18:38:25 Page 1


-- Makelmage.Mesa Edited by Sandman on October 6, 1977 5:35 PM
DIRECTORY
AltoDefs: FROM "altodefs",
AltoFileDefs: FROM "altofiledefs",
8cdDefs: FROM "BcdDefs",
BcdMergeDefs: FROM "BcdMergeDefs",
BcdTnbDefs: FROM "bcdtabdefs",
BcdTableDefs: FROM "bcdtabledefs",
BFSDefs: FROM "bfsdefs",
BootDefs: FROM "bootdefs",
ControlDefs: FROM "controldefs",
CoreSwapDefs: FROM "coreswapdefs",
DirectoryDefs: FROM "directorydefs",
DiskDefs: FROM "diskdefs",
DiskKDDefs: FROM "diskkddefs",
FrameDefs: FROM "framedefs",
ImageDefs: FROM "imagedeFs",
InlineDefs: FROM "inlinedefs",
LoaderBcdUtilDefs: FROM "LoaderBcdUtilDefs",
LoadStateDefs: FROM "LoadStateDefs",
MakeImageUtilDefs: FROM "makeimageutildefs",
MiscDefs: FROM "miscdefs",
OsStnticDefs: FROM "osstaticdefs",
ProcessDefs: FROM "processdefs",
SegmentDefs: FROM "segmentdefs",
StreamDefs: FROM "streamdefs",
StringDefs: FROM "stringdefs",
SystemDefs: FROM "systemdefs",
TimeDefs: FROM "timedefs";
DEFINITIONS FROM
LoadStateDefs, OiskDefs, ImageDefs, ControlDefs. SegmentDefs, MakeImageUtilDefs;
MakeImage: PROGRAM
IMPORTS BcdMergeDefs, BcdTabDefs, BcdTableDefs, BFSDefs, BootDefs, CoreSwapDefs,
DirectoryDefs, DiskDefs, DiskKDDefs, FrameDefs, ImageDefs, LoaderBcdUtilDefs,
LoadStateDefs, MiscDefs, SegmentDefs, StreamDefs, StringDefs. SystemDefs,
MakelmageUtilDefs
EXPORTS ImageDefs SHARES ProcessDefs, DiskDefs, SegmentDefs, ControlDefs. ImageDefs
BEGIN
CFA: TYPE = AltoFileDefs.CFA;
DataSegmentHandle: TYPE = SegmentDefs.DataSegmentHandle;
FP: TYPE = AltoFileDefs.FP;
FileHandle: TYPE = SegmentDefs.FileHandle;
FileSegmentHandle: TYPE = SegmentDefs.FileSegmentHandle;
PageCount: TYPF = AltoDefs.PageCount:
PageNumber: TYPE = AltoDefs.PageNumber;
ProcessRegister: TYPE = ProcessDefs.ProcessRegister:
ProcessHandle: TYPE = ProcessDefs.ProcessHandle:
ProcessVeetor: TYPE = ProcessDefs.ProcessVector:
shortFileRequest: TYPE = short ImageDefs.FileRequest:
vDA: TYPE = AltoFileDefs.vDA:
GlobalrrameHandle: TYPE = ControlDefs.GlobalFrameHandle:
LoadStateGFT: TYPE = LoadStateDefs.LoadStateGFT;
ConfigIndex: TYPE = LoadSlateDeFs.Configlndex:
S t reamlland 1e: TYPE = S t reamDefs. S treamHand 1 e:
ProcDesc: TYPE = ConlrolDeFs.ProcDesc:
-- Bcd Merging Management
MergeAllBeds: PRDCrDURF [initialgft: LoadStateGrT. code. symbols: BOOLEAN.
names: OrSCRIPTOR fOR ARRAY Of STRING] =
B[GIN OprN loadSlaleOefs. BcdMergeDefs:
MergeloadedBcds: PRocroURr [config: ConfigIndex. addr: BedAddress] RETURNS [BOOlrAN]
BfGIN OPfN LoaderBcdUlilOers. LoadStateOefs;
rel: Relocalion +- Inllial iloRolocation[config];
bcdseg: rileSegml'lllllandle +- BcdSegrl'omLoadSlale[collfig]:
bed: BedRase P SetUpBcd[bcdseg];
MergeBcd[bcd. rel. O. lnitialgft. code. symbols. names[config]];
ReleaseBcdSeg[bcdseg];
ReleaseReloealion[rel];
RrTURN [rAlSr];
[NO;
makeiMAGE.mESA 24-0CT-77 18:38:25 Page 2


MergeCopiedFrames: PROCEDURE [frame: GlobalFrameHandle] RETURNS [BOOLEAN] ~
BEGIN
copied: GlobalFrameHandle;
config: ConfigIndex:
ModuleCopiedFrom: PROCEDURE [f: GlobalFrameHandle] RETURNS [BOOLEAN] =
BEGIN
RETURN [f # frame AND f.codesegment = frame.codesegment AND
(config ~ MapRealToConfig[f.gftindex.gftindex].config) # ConfigNull]:
END:
IF MapRealToConfig[frame.gftindex.gftindex].config # ConfigNull THEN RETURN [FALSE]:
IF (copied~FrameDefs.EnumerateGlobalFrames[ModuleCopiedFrom]) # NULLFrame THEN
BEGIN
MergeModule[frame, copied, initialgft]:
RETURN [FALSE]:
END:
RETURN (FALSE]:
END:
InitializeMerge[TableSize, NumberGFIlnConfig[initialgft, 0]]:
[] ~ EnumerateLoadStateBcds[recentlast, MergeLoadedBcds]:
[] ~ FrameDefs.EnumerateGlobalFrames[MergeCopiedframes]:
[] ~ MergedBcdSize[]:
WriteMergedBcd[MoveWords]:
FinalizeMerge[]:
END:
MergeABcd: PROCEDURE [config: ConfigIndex, initgft: LoadStateGFT, code, symbols: BOOLEAN,
names: DESCRIPTOR FOR ARRAY OF STRING] ~
BEGIN OPEN BcdMergeDefs, LoaderBcdUtilDefs, LoadStateDefs:
rel: Relocation ~ InitializeRelocation[config]:
bcdseg: FileSegmentHandle ~ BcdSegFromLoadState[config]:
bcd: BcdBase ~ SetUpBcd[bcdseg]:
InitializeMerge[bcdseg.pages+1. NumberGFIInConfig[initgft, config]]:
MergeBcd[bcd, rel, config. initgft, code, symbols, names[config]]:
ReleaseBcdSeg[bcdseg]:
ReleaseRelocation[rel]:
[] ~ MergedBcdS WriteMergedBcd[MoveWords]:
FinalizeMerge[]:
END:
MoveWords: PROCEDURE [source: POINTER, nwords: CARDINAL] =
BEGIN
IF nwords H StreamDefs.WriteBlock[stream: bcdstream. address: source. words: nwords]
THEN ERROR:
END:
NewBcdSegmentFromStream: PROCEDURE [stream: StreamDefs.DiskHandle, page: PageNumber]
RETURNS [newpage: PageNul11ber, seg: FileSegmentHandle]
BEGIN
index: StreamDefs.StreamIndex:
index ~ StreaI11Defs.GetIndex[stream]:
IF index.byte H 0 THEN
BEGIN
index.byte ~ 0:
index.page ~ index.page + 1:
S t reamDe fs. Se tI ndex[ stream. index]:
END:
seg ~ NewFileSegment[stream.file. page+l, index.page-page. Read+Write];
seg.class ~ bcd;
maxbcdsize ~ MAX[maxbcdsiLe. seg.pages]:
newpage ~ index.page;
RETURN
[NO:
MapSegl11entsInBcd: PROCfDURE [
iniLialGrT: loadStateGFT. config: ConfigIndex. bcdseg: flleSegmentllandle]
RrTURNS [unresolved, expol'ts: BOOI [AN] =
BfGIN OPfN LoaderBcdUtilDefs. LoadStateDefs;
bed: BcdBase ~ SelUpBcd[bcdseg];
MapSeglllenls: PROC[QUR[ [Illlb: CARDINAL. mli: BCdDefs.MTIndex] RETURNS [BOOlEAN]
BfGIN OPfN m: I11lb+lllli;
frame: GloLJalfl'tlllleliandle;
!'gfi: GfTInuex;
fOR "gf i IN [0 .. (RfGTSTfR[SOreg]+sGfTLenglh)1') DO
Tr illilialGrT[rgfi] - [collfig: config, gfi: m.gfi] TllfN fXTT;
makeiMAGE.mESA 24-0CT-77 18:38:25 Page 3


ENDLOOP;
IF m.cseg.file = BcdDefs.FTSelf THEN
BEGIN
frame ~ LOOPHOLE[REGISTER[GFTreg], gftp]~[rgfi].frame;
m.cseg.base ~ frame.codesegment.base;
END;
IF m.sseg.file = BcdDefs.FTSelf THEN
BEGIN
frame ~ LOOPHOLE[REGISTER[GFTreg], gftp]'I'[rgfi].frame;
IF frame. symbol segment # NIL THEN m.sseg.base ~ frame. symbol segment. base;
END;
RETURN[FALSE] ;
END;
[] ~ EnumerateModuleTable[bcd, MapSegments];
unresolved ~ bcd.nlmports # 0;
exports ~ bcd.nExports # 0;
Unlock[bcdseg);
SwapOut[bcdseg];
END;
TableSize: CARDINAL = 15