(********************************************************************** :Program. MemSystem.def :Contents. Lowlevel System Support :Author. Nicolas Benezan [bne] :Address. Postwiesenstr. 2, D7000 Stuttgart 60 :Phone. 711/333679 :Copyright. all rights reserved :Language. Modula-2 :Translator. M2Amiga AMSoft :ModHistory. V1.0 [bne] 17.06.88 (private) :ModHistory. V1.1 [bne] 09.07.88 (+ TaskMem) **********************************************************************) DEFINITION MODULE MemSystem; FROM SYSTEM IMPORT ADDRESS; FROM Intuition IMPORT IDCMPFlagSet,WindowPtr; CONST CANCEL="Cancel"; RETRY="Retry"; ABORT="Abort"; IGNORE="Ignore"; CONTINUE="Continue"; VAR Window:WindowPtr; minMemory:LONGINT; (* Default=20kB *) Hysteresis:LONGINT;(* Default=30kB *) ErrHeader:ARRAY [0..32] OF CHAR; PROCEDURE Allocate(VAR Pointer:ADDRESS;Size:LONGINT); (*:Input. Size: Amount of required memory (Bytes) :Output. Pointer: Address of the allocated memory or :Output. NIL if the allocation failed :Semantic. Allocates memory - see MemSystem.doc for further detailes *) PROCEDURE AllocMem(VAR Pointer:ADDRESS;Size:LONGINT;Chip:BOOLEAN); (*:Input. Size: Amount of required memory (Bytes) :Input. Chip: TRUE: ChipMem required FALSE: doesn't matter which :Output. Pointer: Address of the allocated memory or :Output. NIL if the allocation failed :Semantic. Allocates memory - see MemSystem.doc for further detailes *) PROCEDURE Deallocate(VAR Pointer:ADDRESS); (*:Input. Pointer: Address of the memory to be deallocated :Output. Pointer is set to NIL :Semantic. Deallocates Memory blocks allocated with :Semantic. MemSystem.Allocate() or MemSystem.AllocMem() *) PROCEDURE YesNoRequest(BodyText,PositiveText,NegativeText:ADDRESS; PosFlags:IDCMPFlagSet;VAR Answer:BOOLEAN); (*:Input. ReqBody: Pointer to the Headline of the requester :Input. PositiveText: Pointer to the text of the Ok-gadget :Input. NegativeText: Pointer to the text of the Cancel-gadget :Input. PosFlags: IDCMPFlags which cause EndRequest() :Output. Answer: TRUE: Ok-gadget FALSE: Cancel or error :Semantic. simplified Intuition.AutoRequest() *) PROCEDURE RecoverableExit(ReqBody,PosText,NegText:ADDRESS); (*:Input. ReqBody: Pointer to the Headline of the requester :Input. PosText: Pointer to the text of the Ok-gadget :Input. NegText: Pointer to the text of the Cancel-gadget :Semantic. Displays a requester, Cancel terminates the :Semantic. programm, Ok lets it continue *) PROCEDURE DeadEndExit(ReqBody:ADDRESS); (*:Input. ReqBody: Pointer to a String :Semantic. Displays a Requester with ErrHeader as Headline and ReqBody :Semantic. as second line. The Cancel-gadget terminates the program.*) PROCEDURE ExitQuiet; (*:Semantic. simply terminates the program (TermProcedures work :Semantic. normally) END MemSystem.