(FILECREATED "16-Jul-86 19:07:12" {QV}<NOTECARDS>1.3K>FGHPATCH094.;1 4155
changes to: (VARS FGHPATCH094COMS)
(FNS NC.CardOperationsInProgress))
(* Copyright (c) 1986 by Xerox Corporation. All rights reserved.)
(PRETTYCOMPRINT FGHPATCH094COMS)
(RPAQQ FGHPATCH094COMS ((* * Fix to NC.MapCards macro and to one of its callers)
(MACRO NC.MapCards)
(FNS NC.CardOperationsInProgress)))
(* * Fix to NC.MapCards macro and to one of its callers)
(DECLARE: EVAL@COMPILE
(DEFMACRO NC.MapCards (NoteFile Function &OPTIONAL CollectResultPredicate)
(* * Map over the entries in a NoteFiles hash array applying function to the CardID and
Hash table value for each entry.)
(* * rht 7/14/86: Changed from function to macro.)
(* * fgh 7/16/86 Fixed several bugs and reorganized macro.)
(COND (CollectResultPredicate (BQUOTE (LET (CollectionList)
(MAPHASH (fetch (NoteFile HashArray)
of , NoteFile)
(FUNCTION
(LAMBDA
(Value Key)
(LET (PredicateResult)
(BLOCK)
(COND ((SETQ PredicateResult
(APPLY* ,
CollectResultPredicate
Value))
(SETQ
CollectionList
(CONS (APPLY* ,
Function
Value
PredicateResult)
CollectionList))
)
(T (APPLY* , Function
Value)))))))
CollectionList)))
(T (BQUOTE (MAPHASH (fetch (NoteFile HashArray)
of , NoteFile)
(FUNCTION (LAMBDA (Value Key)
(BLOCK)
(APPLY* , Function Value))))))))
)
(DEFINEQ
(NC.CardOperationsInProgress
(LAMBDA (NoteFile AskAndTerminateFlg) (* fgh: "16-Jul-86 18:59")
(* * Check if any cards have operations in progress. If so, either return their processes or Ask the user if they
should be terminated and termionate them, depending on AskAndTerminateFlg. If the user say no terminations, then
return the LITATOM ABORT.)
(* * fgh 6/13/86 First created)
(* * fgh 7/16/86 Due to change of NC.MapCards from fn to macro had to change the RETFROM NC.MapVCards to a RETFROM
MAPHASH.)
(LET (FoundOpInProgress)
(NC.MapCards NoteFile
(FUNCTION (LAMBDA (Card Process)
(if (PROCESSP Process)
then
(* This card has an operation in progress. If this is the first one found, ask the Ask the user if operations in
progress should be killed.)
(if (NULL AskAndTerminateFlg)
then (* Just Return a lst of proceses)
Process
else (* ask the user what to do.)
(if (AND (NOT FoundOpInProgress)
(NOT (NC.AskYesOrNo
(CONCAT
"There are cards with operations in progress."
(CHARACTER 13)
"Do you want to terminate these operations?"
(CHARACTER 13))
"-->"
(QUOTE Yes)
T
(WFROMMENU (fetch (NoteFile
Menu)
of NoteFile)))))
then (* User doesn't want to kill active operations.
Get out of close.)
(SETQ CollectionList (QUOTE ABORT))
(RETFROM (FUNCTION MAPHASH)
(QUOTE ABORT))
else (* Okay, kill the operation in progress.
And allow a list of terminated processes to be
returned.)
(SETQ FoundOpInProgress T)
(NC.TerminateCardOperationInProgress Card)
Process)))))
(FUNCTION (LAMBDA (Card)
(NC.FetchUserDataProp Card (QUOTE ProcessInProgress))))))))
)
(PRETTYCOMPRINT FGHPATCH094COMS)
(RPAQQ FGHPATCH094COMS ((* * Fix to NC.MapCards macro and to one of its callers)
(MACROS NC.MapCards)
(FNS NC.CardOperationsInProgress)))
(PUTPROPS FGHPATCH094 COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
(FILEMAP (NIL (1679 3887 (NC.CardOperationsInProgress 1689 . 3885)))))
STOP