|##########| |#MAGIC #|CLABLJAF |#PROJECT #|"" |#PATHS #|"StdProject" |#FLAGS #|xx---x--x-x-x-x----------------- |#USERSW #|-------------------------------- |#USERMASK#|-------------------------------- |#SWITCHES#|xx---xxxxx-xx--- |##########| DEFINITION MODULE T_Exec; (* $A- *) FROM System IMPORT BITSET,LONGSET,PROC,SysStringPtr,BPTR,Regs; FROM Resources IMPORT ContextPtr; FROM Hardware IMPORT IntFlags; FROM Exec IMPORT NodeType,NodePtr,MinListPtr,MinNodePtr,MinNode,Node, MinList,List,ListPtr,Interrupt,InterruptPtr,IntVector, SoftIntList,MemReqs,MemReqSet,MemTypeSet,MemChunkPtr, MemChunk,MemHeader,MemHeaderPtr,MemEntry,MemList, MemListPtr,TaskFlags,TaskFlagSet,TaskState, MsgPortAction,SigAbort,SigChild,SigBlit,SigSingle,SigDos, vectSize,reserved,base,userDef,nonStd,extFunc,expunge, close,open,LibFlags,LibFlagSet,Device,TaskSignals, DevicePtr,UnitFlags,UnitFlagSet,UnitPtr,Unit,invalid,reset, read,write,update,clear,stop,start,flush,nonstd,abortIO, beginIO,IOFlagSet,quick,openFail,aborted,noCmd,badLength, Semaphore,SemaphorePtr,SemaphoreRequest, ResidentFlags,ResidentFlagSet,ResidentPtr,Resident,matchWord, AttnFlags,AttnFlagSet,ExecBaseType,ExecBasePtr,ExecBase, AddLibrary,MakeFunctions,MakeLibrary,RemLibrary,SetFunction, SumLibrary,InitCode,InitStruct,InitResident,FindResident,Alert,Debug, RawDoFmt,RawIOInit,RawPutChar,Disable, Enable,Forbid,Permit,SetSR,SuperState,UserState,SetIntVector, Cause,Allocate,Deallocate,AllocMem,AllocAbs,FreeMem,AvailMem, TypeOfMem,NewList,Insert,AddHead,AddTail,Remove,RemHead,RemTail, Enqueue,FindName,AddTask,RemTask,FindTask,SetTaskPri,SetSignal, SetExcept,Wait,Signal,AddPort,AddPort,RemPort, PutMsg,WaitPort,FindPort,AddDevice,RemDevice,DoIO, SendIO,CheckIO,WaitIO,AbortIO,AddResource,RemResource,OpenResource, InitSemaphore,AttemptSemaphore,FindSemaphore,AddSemaphore,RemSemaphore, Procure,Vacate,SumKickData,AddMemList,CopyMem,CopyMemQuick, ObtainSemaphore,ReleaseSemaphore, ObtainSemaphoreList,ReleaseSemaphoreList, SignalSemaphore,SignalSemaphorePtr, TaskSignals,IOReturn,TaskSigSet, IOCommand,nonstdVAL,IOFlags,IOReturn; TYPE MsgPortPtr = POINTER TO MsgPort; MessagePtr = POINTER TO Message; LibraryPtr = POINTER TO Library; IORequestPtr = POINTER TO IORequest; IOStdReqPtr = POINTER TO IOStdReq; TaskPtr = POINTER TO Task; DEFINITION MODULE PortRes = Resources.ResHandles(MsgPortPtr); DEFINITION MODULE MsgRes = Resources.ResHandles(MessagePtr); DEFINITION MODULE LibRes = Resources.ResHandles(LibraryPtr); DEFINITION MODULE IoRes = Resources.ResHandles(IORequestPtr); DEFINITION MODULE TaskRes = Resources.ResHandles(TaskPtr); TYPE MsgPort = RECORD OF Exec.MsgPort,PortRes.ResHandle END; Message = RECORD OF Exec.Message,MsgRes.ResHandle END; Library = RECORD OF Exec.Library,LibRes.ResHandle END; IORequest = RECORD OF Exec.IORequest,IoRes.ResHandle END; IOStdReq = RECORD OF Exec.IOStdReq,IORequest END; Task = RECORD OF Exec.Task,TaskRes.ResHandle END; EXCEPTION NoFreeSignal : "No signal available"; NoMsgPort : "Failed to create msg port"; OpenError : "Could not open Device"; NotEnoughStackSpace : "Not enough stack space"; CantKillMainTask : "Can not kill main task"; TaskNeedsName : "Task needs a name"; (*========================== Library =========================================*) PROCEDURE OpenLibrary(REF name : STRING; version : LONGINT):LibraryPtr; PROCEDURE CloseLibrary(library : LibraryPtr); PROCEDURE OldOpenLibrary(REF libName IN A1 : STRING):LibraryPtr; GROUP LibGrp = OpenLibrary,CloseLibrary,AddLibrary,MakeFunctions,MakeLibrary, RemLibrary,OldOpenLibrary,SetFunction,SumLibrary,LibraryPtr,BPTR; (*----------------------------------------------------------------------------*) (* Listen-Funktionen *) (*----------------------------------------------------------------------------*) GROUP ListGrp = NodeType,Node,NodePtr,List,ListPtr, MinNode,MinNodePtr,MinList,MinListPtr, NewList,Insert,AddHead,AddTail,Remove,RemHead,RemTail, Enqueue,FindName; (*----------------------------------------------------------------------------*) (* Task-Funktionen *) (*----------------------------------------------------------------------------*) PROCEDURE CreateTask(REF name : STRING; priority : SHORTINT; initPC : ANYPTR; stackSize : LONGINT := 20000; context : ContextPtr := NIL):TaskPtr; PROCEDURE DeleteTask(task : TaskPtr); GROUP TaskGrp = TaskPtr,Task,TaskFlags,TaskFlagSet,TaskState, AddTask,RemTask,CreateTask,DeleteTask, FindTask,SetTaskPri; (*----------------------------------------------------------------------------*) (* Message-Funktionen *) (*----------------------------------------------------------------------------*) PROCEDURE CreatePort(REF portName : STRING :=""; priority : SHORTINT := 0; context : ContextPtr := NIL):MsgPortPtr; PROCEDURE DeletePort(port : MsgPortPtr); PROCEDURE GetMsg(port : MsgPortPtr;context : ContextPtr := NIL):MessagePtr; PROCEDURE ReplyMsg(msg : MessagePtr); GROUP PortGrp = MsgPort,MsgPortPtr,MsgPortAction,MessagePtr, AddPort,RemPort,CreatePort,DeletePort, FindPort; MsgGrp = MsgPortPtr,MessagePtr, PutMsg,GetMsg,ReplyMsg,WaitPort,FindPort; (*----------------------------------------------------------------------------*) (* Device-Funktionen *) (*----------------------------------------------------------------------------*) | Funktion : Öffnet ein Device | Parameter : packet <- Zeiger auf einen IORequest. Prägt man dieses Modul | mit einem Nachfolger aus, so muß man die Customfelder | selbst initialisieren. | name <- Name des Devices | len <- Wirkliche Länge des Verwendeteten Typen | unit <- Unit des Devices, die geöffnet werden soll | context <- Context, zu dem dieses Device geöffnet werden soll | PROCEDURE OpenDevice( packet : IORequestPtr; REF name : STRING; len : CARDINAL; unit : LONGCARD :=0; flags :=LONGSET:{}; context : ContextPtr:=NIL); | | Funktion : Schließt ein mit diesem Modul geöffnetes Device | Parameter : packet <- Zeiger auf den IORequest des Devices, das geschlossen | werden soll. | PROCEDURE CloseDevice(packet : IORequestPtr); GROUP DeviceGrp = Device,DevicePtr,IORequest, AddDevice,RemDevice; ExecIOGrp = IORequestPtr,IOStdReqPtr,DoIO,SendIO,CheckIO,WaitIO,AbortIO, invalid,reset,read,write,update,clear,stop,start, flush,quick; (*----------------------------------------------------------------------------*) (* Resource-Funktionen *) (*----------------------------------------------------------------------------*) GROUP ResourceGrp = AddResource,RemResource,OpenResource; (*----------------------------------------------------------------------------*) (* Semaphore-Funktionen *) (*----------------------------------------------------------------------------*) GROUP SemaphoreGrp = SignalSemaphore,List, InitSemaphore,ObtainSemaphore,ReleaseSemaphore, AttemptSemaphore,ObtainSemaphoreList, ReleaseSemaphoreList, FindSemaphore,AddSemaphore,RemSemaphore; GROUP KickGrp = SumKickData,AddMemList,CopyMem,CopyMemQuick; All = LibGrp,ListGrp,TaskGrp,PortGrp, MsgGrp,DeviceGrp,ExecIOGrp,ResourceGrp,SemaphoreGrp,KickGrp, SoftIntList,IntVector,MemChunkPtr,MemChunk,MemTypeSet,MemHeaderPtr, MemEntry,SigAbort,SigChild,SigBlit,SigSingle,SigDos,vectSize, reserved,base,userDef,nonStd,extFunc,expunge,close,open,LibFlags, LibFlagSet,Library,Device,DevicePtr,UnitFlags,UnitFlagSet,UnitPtr, Unit,openFail,aborted,noCmd,badLength,ResidentFlagSet,ResidentPtr, Resident,matchWord,AttnFlags,AttnFlagSet,ExecBaseType,ExecBase; END T_Exec.