-- File: IntAnswerCom.Mesa -- edited by Horning, February 27, 1979 5:45 PM -- edited by Brotz, February 13, 1981 4:39 PM -- edited by Levin, February 13, 1981 4:33 PM -- edited by Schroeder, Wednesday Nov. 5, 1980 3:06 pm PST DIRECTORY Answer, Editor, exD: FROM "ExceptionDefs", Inline, intCommon: FROM "IntCommon", inD: FROM "InteractorDefs", ovD: FROM "OverviewDefs", prD: FROM "ProtectionDefs", Storage, tsD: FROM "TOCSelectionDefs", vmD: FROM "VirtualMgrDefs"; IntAnswerCom: PROGRAM IMPORTS Answer, Editor, exD, Inline, intC: intCommon, inD, prD, Storage, tsD, vmD EXPORTS inD = BEGIN AnswerCommand: PUBLIC PROCEDURE [hp: inD.HousePtr, confirmed: BOOLEAN] = -- Clears old composed message and initializes a new one to the standard reply. Refreshes -- display of the composed message. BEGIN answerError: BOOLEAN _ FALSE; mnp: inD.MessageTextNbrPtr = intC.cmTextNbr; answerMessage: vmD.ComposeMessagePtr; getMessage: vmD.DisplayMessagePtr; GetChar: PROCEDURE [index: CARDINAL] RETURNS [CHARACTER] = {RETURN[vmD.GetMessageChar[getMessage, index]]}; PutBlock: PROCEDURE [block: Answer.Block] = BEGIN [] _ vmD.InsertSubstringInMessage [answerMessage, LOOPHOLE[Inline.LowHalf[block.buffer] - 2, STRING], 0, block.length]; END; -- of PutBlock -- GetPages: PROCEDURE [nPages: CARDINAL] RETURNS [LONG POINTER] = {RETURN[Storage.Pages[nPages]]}; FreePages: PROCEDURE [p: LONG POINTER] = {Storage.FreePages[Inline.LowHalf[p]]}; answerBody: STRING ="Message "L; -- main body of AnswerCommand IF tsD.TOCSelectionEmpty[] THEN {exD.DisplayException[exD.cantAnswer]; RETURN}; IF ~confirmed AND intC.composedMessageEdited AND vmD.GetMessageSize[mnp.message] # 0 AND ~inD.AskUserToConfirm[exD.willReplaceMessage] THEN RETURN; getMessage _ vmD.AllocateDisplayMessageObject[]; [] _ vmD.VirtualizeMessage[tsD.FirstSelectedEntry[], getMessage]; Editor.SwapMessageWithDeletionBuffer[mnp]; Editor.ResetInsertionBuffer[mnp]; answerMessage _ vmD.MapVirtualToComposeMessage[mnp.message]; vmD.InitComposeMessage[answerMessage, ""L]; vmD.StartMessageInsertion[answerMessage, 0]; answerError _ Answer.MakeHeader [getChar: GetChar, getLength: vmD.GetMessageSize[getMessage], putBlock: PutBlock, getPages: GetPages, freePages: FreePages, userName: intC.user.name, userRegistry: intC.user.registry, arpaGatewayHostNames: intC.arpaGatewayHostNames, cForCopies: intC.cForCopies]; [] _ vmD.InsertSubstringInMessage[answerMessage, answerBody, 0, answerBody.length]; vmD.StopMessageInsertion[answerMessage]; vmD.FreeVirtualMessageObject[getMessage]; -- Answer form complete: make Editor and Interactor happy BEGIN OPEN inD, Editor; newMessageLength: ovD.CharIndex _ vmD.GetMessageSize[answerMessage]; intC.source _ TextSelection[mnp, 0, 0, 0, char, FALSE]; intC.actionPoint _ 0; intC.commandType _ get; intC.target _ TextSelection [mnp: mnp, start: newMessageLength - 11, end: newMessageLength - 2, point: newMessageLength - 11, mode: char, pendingDelete: intC.editorType = modeless]; intC.newTargetSelection _ TRUE; intC.pendingDeleteSetByControl _ FALSE; SetHighWaterMark[0]; mnp.haveMessage _ TRUE; intC.composedMessageEdited _ FALSE; intC.runCommandMode _ FALSE; IF mnp.protectedFieldPtr # NIL THEN prD.UnprotectAllFields[@mnp.protectedFieldPtr]; RefreshSoThatFirstCharStartsLine[firstChar: 0, firstLine: mnp.lines, mnp: mnp]; intC.deliverCommandHouse.text.length _ 0; intC.deliverCommandHouse.typeface _ italicFace; intC.deliverCommandHouse.callable _ FALSE; TextHouseRefresher[intC.deliverCommandHouse]; IF answerError THEN exD.DisplayException[exD.answerIncomplete]; END; -- of OPEN -- END; -- of AnswerCommand -- END. -- IntAnswerCom -- z19932(635)\f1