// IfsScavOvInit.bcpl - once only code
// Copyright Xerox Corporation 1979
// Last modified December 22, 1979  3:03 PM by Boggs

get "Disks.d"

external
[
// outgoing procedures
DeclareAllOEPs; InitDisksFinish

// incoming procedures
Pass1; Pass2; DiskEditor; DumpLPT; DumpTree

DeclareOEP; InitBTreeOEP; InitDiskStreamsOEP
InitCmdScanOEP; InitKeywordOEP; InitStringOEP

TFSWritePages; TFSAssignDiskPage; TFSCreateFile
TFSDeletePages; TFSReleaseDiskPage; TFSClose
IFSOpenDD; BFSFlushDD; BFSDestroyDDMgr
IFSCloseDD; IFSLockDD; IFSUnlockDD; IFSReadDDPage
BFSCloseDD; BFSLockDD; BFSUnlockDD; BFSReadDDPage
BFSWritePages; BFSAssignDiskPage; BFSCreateFile
BFSDeletePages; BFSReleaseDiskPage; BFSClose

IFSFinish; Wss; IFSError; PrintRealDA

// incoming statics
lvUserFinishProc; bfsDDMgr; sysDisk
]

manifest ecBadUFP = 23

//---------------------------------------------------------------------------
let DeclareAllOEPs(oev) be
//---------------------------------------------------------------------------
[
InitBTreeOEP(oev)
InitDiskStreamsOEP(oev)
InitCmdScanOEP(oev)
InitKeywordOEP(oev)
InitStringOEP(oev)

if @lvUserFinishProc ne IFSFinish then IFSError(ecBadUFP)

DeclareOEP(oev, lv DiskEditor, lv Pass1, lv Pass2,
 lv DumpLPT, lv DumpTree)
DeclareOEP(oev, lv IFSOpenDD, lv IFSCloseDD, lv IFSLockDD,
 lv IFSUnlockDD, lv IFSReadDDPage)
DeclareOEP(oev, lv TFSWritePages, lv TFSDeletePages, lv TFSCreateFile,
 lv TFSAssignDiskPage, lv TFSReleaseDiskPage, lv TFSClose)
DeclareOEP(oev, lv BFSCloseDD, lv BFSLockDD, lv BFSUnlockDD,
 lv BFSReadDDPage, lv BFSFlushDD, lv BFSDestroyDDMgr)
DeclareOEP(oev, lv BFSWritePages, lv BFSDeletePages, lv BFSCreateFile,
 lv BFSAssignDiskPage, lv BFSReleaseDiskPage, lv BFSClose)
DeclareOEP(oev, lv IFSFinish, lv Wss, lv PrintRealDA)
]

//---------------------------------------------------------------------------
and InitDisksFinish() be
//---------------------------------------------------------------------------
[
@lvUserFinishProc = IFSFinish  //now install pointer to swappable version

sysDisk>>DSK.WriteDiskPages = BFSWritePages
sysDisk>>DSK.AssignDiskPage = BFSAssignDiskPage
sysDisk>>DSK.CreateDiskFile = BFSCreateFile
sysDisk>>DSK.DeleteDiskPages = BFSDeletePages
sysDisk>>DSK.ReleaseDiskPage = BFSReleaseDiskPage
sysDisk>>DSK.CloseDisk = BFSClose

bfsDDMgr>>DDMgr.LockDD = BFSLockDD
bfsDDMgr>>DDMgr.ReadDDPage = BFSReadDDPage
bfsDDMgr>>DDMgr.UnlockDD = BFSUnlockDD
bfsDDMgr>>DDMgr.FlushDD = BFSFlushDD
bfsDDMgr>>DDMgr.CloseDD = BFSCloseDD
bfsDDMgr>>DDMgr.DestroyDDMgr = BFSDestroyDDMgr
]