// IfsScavKbd.bcpl - various keyboard interaction procedures // Copyright Xerox Corporation 1979 // Last modified December 27, 1979 1:44 PM by Boggs get "CmdScan.decl" get "Disks.d" external [ // outgoing procedures OpenDisk; ScavConfirm // incoming procedures TFSInit; BFSInit DefaultArgs; Dismiss Resets; Errors; Ws; Wss; Gets; Puts; Closes CreateKeywordTable; DestroyKeywordTable; InsertKeyword InitCmd; EnableCatch; EndCatch; TerminatingChar BeginDefaultPhrase; EndDefaultPhrase GetKeyword; GetNumber; InvertWindow // incoming statics sysZone; sysDisk; keys; dsp; tfsDDMgr; bfsDDMgr ] //---------------------------------------------------------------------------- let OpenDisk(string, alloc, fresh, diablo; numargs na) = valof //---------------------------------------------------------------------------- [ DefaultArgs(lv na, 1, true, false, false) let cs = InitCmd(256, 5); if cs eq 0 resultis 0 Wss(cs, string) let dKT = nil if EnableCatch(cs) then [ DestroyKeywordTable(dKT); EndCatch(cs) ] dKT = CreateKeywordTable(2, 1) if diablo then InsertKeyword(dKT, "DP")!0 = -1 InsertKeyword(dKT, "TP")!0 = 1 let trident = GetKeyword(cs, dKT, false, PhraseTerminator)!0 gr 0 let termChar = TerminatingChar(cs) // there must be a better way to do this... BeginDefaultPhrase(cs) Puts(cs, termChar) EndDefaultPhrase(cs) cs>>CS.editControl = editAppend let driveNumber = GetNumber(cs, 8) let disk = nil test trident ifso disk = TFSInit(sysZone, alloc, driveNumber, tfsDDMgr, fresh) ifnot test driveNumber eq sysDisk>>DSK.driveNumber ifso disk = sysDisk ifnot disk = BFSInit(sysZone, true, driveNumber, bfsDDMgr) if disk eq 0 then Errors(cs, 0) DestroyKeywordTable(dKT) Closes(cs) resultis disk ] //---------------------------------------------------------------------------- and PhraseTerminator(cs, char) = //---------------------------------------------------------------------------- char ls $A % (char gr $Z & char ls $a) % char gr $z //---------------------------------------------------------------------------- and ScavConfirm(string; numargs na) = valof //---------------------------------------------------------------------------- [ if na gr 0 then Ws(string) Ws(" [Confirm] ") switchon Gets(keys) into [ case $Y: case $y: case $*N: [ Ws("Yes."); resultis true ] case $N: case $n: case $*177: [ Ws("No."); resultis false ] case $?: [ Ws("Yes = Y|y|<cr>, No = N|n|<del>"); endcase ] default: [ InvertWindow(dsp>>ST.par1) Dismiss(100) InvertWindow(dsp>>ST.par1) Resets(keys) ] ] repeat ]