// CopyDiskRun.bcpl - stuff for the run file version
// Copyright Xerox Corporation 1979, 1980
// Last modified April 20, 1980  4:55 PM by Boggs

get "Streams.d"

external
[
// outgoing procedures
BootRunInit

// incoming procedures
OpenFile; FileLength; Allocate
Resets; Gets; Puts; Closes; Endofs; CreateStringStream

// outgoing statics
bootflag; comCm

// incoming statics
fpComCm; sysZone
]

static
[
bootflag = false
comCm
]

//----------------------------------------------------------------------------
let BootRunInit() be
//----------------------------------------------------------------------------
// Read Com.cm into a core buffer since we are about to
//  Junta away the directory and disk streams modules.
[
let cc = OpenFile("Com.cm", ksTypeReadOnly, charItem, 0, fpComCm)
if cc eq 0 return
let comCmBytes = FileLength(cc)
let ccb = Allocate(sysZone, comCmBytes rshift 1 +1)
comCm = CreateStringStream(ccb, comCmBytes)
Resets(cc); until Endofs(cc) do Puts(comCm, Gets(cc)); Closes(cc)
Closes(comCm); comCm = CreateStringStream(ccb, 0)
]