#ifndef EXEC_TYPES_H
#include <exec/types.h>
#endif
typedef void (*__fptr)();
/*------ misc ---------------------------------------------------------*/
ULONG Supervisor(__fptr);
/*------ special functions ---------------------------------------------*/
void InitCode(long, long);
void InitStruct(char *, char *, long);
struct Library *MakeLibrary(long**, char *, __fptr, long, char *);
void MakeFunctions(char *, long**, long);
struct Resident *FindResident(char *);
void InitResident(struct Resident *, char *);
void Alert(long, char *);
void Debug(long);
/*------ interrupts ----------------------------------------------------*/
void Disable(void);
void Enable(void);
void Forbid(void);
void Permit(void);
long SetSR(long, long);
APTR SuperState(void);
void UserState(APTR);
struct Interrupt *SetIntVector(long, struct Interrupt *);
void AddIntServer(long, struct Interrupt *);
void RemIntServer(long, struct Interrupt *);
void Cause(struct Interrupt *);
/*------ memory allocation: ---------------------------------------------*/
void *Allocate(struct MemHeader *, ULONG);
void Deallocate(struct MemHeader *, APTR, ULONG);
void *AllocMem(ULONG, ULONG);
void *AllocAbs(ULONG, APTR);
void FreeMem(void *, ULONG);
ULONG AvailMem(ULONG);
struct MemList * AllocEntry(struct MemList *);
void FreeEntry(struct MemList *);
/*------ lists: ---------------------------------------------------------*/
void Insert(struct List *, struct Node *, struct Node *);
void AddHead(struct List *, struct Node *);
void AddTail(struct List *, struct Node *);
void Remove(struct Node *);
struct Node *RemHead(struct List *);
struct Node *RemTail(struct List *);
void Enqueue(struct List *, struct Node *);
struct Node *FindName(struct List *, char *);
/*------ tasks: ---------------------------------------------------------*/
void AddTask(struct Task *, __fptr, __fptr);
void RemTask(struct Task *);
struct Task *FindTask(char *);
BYTE SetTaskPri(struct Task *, long);
ULONG SetSignal(ULONG, ULONG);
ULONG SetExcept(ULONG, ULONG);
ULONG Wait(ULONG);
void Signal(struct Task *, ULONG);
BYTE AllocSignal(LONG);
void FreeSignal(ULONG);
LONG AllocTrap(LONG);
void FreeTrap(ULONG);
/*------ messages: ------------------------------------------------------*/
void AddPort(struct MsgPort *);
void RemPort(struct MsgPort *);
void PutMsg(struct MsgPort *, struct Message *);
struct Message *GetMsg(struct MsgPort *);
void ReplyMsg(struct Message *);
struct Message *WaitPort(struct MsgPort *);
struct MsgPort *FindPort(char *);
/*------ libraries: -----------------------------------------------------*/
void AddLibrary(struct Library *);
long RemLibrary(struct Library *);
struct Library *OldOpenLibrary(char *);
void CloseLibrary(struct Library *);
__fptr SetFunction(struct Library *, long, __fptr);
void SumLibrary(struct Library *);
/*------ devices: -------------------------------------------------------*/
void AddDevice(struct Device *);
long RemDevice(struct Device *);
long OpenDevice(char *, long, struct IORequest *, long);
void CloseDevice(struct IORequest *);
long DoIO(struct IORequest *);
void SendIO(struct IORequest *);
long CheckIO(struct IORequest *);
long WaitIO(struct IORequest *);
void AbortIO(struct IORequest *);
/*------ resources: ----------------------------------------------------*/
void AddResource(struct Resource *);
void RemResource(struct Resource *);
struct Resource *OpenResource(char *);
/*------ new functions:*/
void RawDoFmt(UBYTE *, APTR, __fptr, APTR);
long GetCC(void);
ULONG TypeOfMem(void *);
long Procure(struct Semaphore *, struct Message *);
void Vacate(struct Semaphore *);
struct Library *OpenLibrary(char *, long);
/*------ 1.2 new semaphore support*/
void InitSemaphore(struct SignalSemaphore *);
void ObtainSemaphore(struct SignalSemaphore *);
void ReleaseSemaphore(struct SignalSemaphore *);
long AttemptSemaphore(struct SignalSemaphore *);
void ObtainSemaphoreList(struct List *);
void ReleaseSemaphoreList(struct List *);
struct SignalSemaphore *FindSemaphore(char *);
void AddSemaphore(struct SignalSemaphore *);
void RemSemaphore(struct SignalSemaphore *);
/*------ 1.2 rom "kickstart" support + memory support*/
ULONG SumKickData(void);
long AddMemList(long, long, long, char *, char *);
void CopyMem(void *, void *, long);
void CopyMemQuick(void *, void *, long);

#ifndef NO_AMIGALIB
/*------ Common support library functions ---------*/
void BeginIO(struct IORequest *);
struct IORequest *CreateExtIO(struct MsgPort *, long);
struct MsgPort *CreatePort(char *, long);
struct IOStdReq *CreateStdIO(struct MsgPort *);
struct Task *CreateTask(char *, LONG, APTR, unsigned long);
void DeleteExtIO(struct IORequest *);
void DeletePort(struct MsgPort *);
void DeleteStdIO(struct IOStdReq *);
void DeleteTask(struct Task *);
void NewList(struct List *);
#endif

#ifndef  NO_PRAGMAS
/*------ misc ----------------------------------------------------------*/
#pragma libcall SysBase Supervisor 1e D01
/*------ special functions ---------------------------------------------*/
#pragma libcall SysBase InitCode 48 1002
#pragma libcall SysBase InitStruct 4e a903
#pragma libcall SysBase MakeLibrary 54 10a9805
#pragma libcall SysBase MakeFunctions 5a a9803
#pragma libcall SysBase FindResident 60 901
#pragma libcall SysBase InitResident 66 1902
#pragma libcall SysBase Alert 6c d702
#pragma libcall SysBase Debug 72 0
/*------ interrupts ----------------------------------------------------*/
#pragma libcall SysBase Disable 78 0
#pragma libcall SysBase Enable 7e 0
#pragma libcall SysBase Forbid 84 0
#pragma libcall SysBase Permit 8a 0
#pragma libcall SysBase SetSR 90 1002
#pragma libcall SysBase SuperState 96 0
#pragma libcall SysBase UserState 9c 1
#pragma libcall SysBase SetIntVector a2 9002
#pragma libcall SysBase AddIntServer a8 9002
#pragma libcall SysBase RemIntServer ae 9002
#pragma libcall SysBase Cause b4 901
/*------ memory allocation: ---------------------------------------------*/
#pragma libcall SysBase Allocate ba 802
#pragma libcall SysBase Deallocate c0 9803
#pragma libcall SysBase AllocMem c6 1002
#pragma libcall SysBase AllocAbs cc 9002
#pragma libcall SysBase FreeMem d2 902
#pragma libcall SysBase AvailMem d8 101
#pragma libcall SysBase AllocEntry de 801
#pragma libcall SysBase FreeEntry e4 801
/*------ lists: ---------------------------------------------------------*/
#pragma libcall SysBase Insert ea a9803
#pragma libcall SysBase AddHead f0 9802
#pragma libcall SysBase AddTail f6 9802
#pragma libcall SysBase Remove fc 901
#pragma libcall SysBase RemHead 102 801
#pragma libcall SysBase RemTail 108 801
#pragma libcall SysBase Enqueue 10e 9802
#pragma libcall SysBase FindName 114 9802
/*------ tasks: ---------------------------------------------------------*/
#pragma libcall SysBase AddTask 11a ba903
#pragma libcall SysBase RemTask 120 901
#pragma libcall SysBase FindTask 126 901
#pragma libcall SysBase SetTaskPri 12c 902
#pragma libcall SysBase SetSignal 132 1002
#pragma libcall SysBase SetExcept 138 1002
#pragma libcall SysBase Wait 13e 1
#pragma libcall SysBase Signal 144 902
#pragma libcall SysBase AllocSignal 14a 1
#pragma libcall SysBase FreeSignal 150 1
#pragma libcall SysBase AllocTrap 156 1
#pragma libcall SysBase FreeTrap 15c 1
/*------ messages: ------------------------------------------------------*/
#pragma libcall SysBase AddPort 162 901
#pragma libcall SysBase RemPort 168 901
#pragma libcall SysBase PutMsg 16e 9802
#pragma libcall SysBase GetMsg 174 801
#pragma libcall SysBase ReplyMsg 17a 901
#pragma libcall SysBase WaitPort 180 801
#pragma libcall SysBase FindPort 186 901
/*------ libraries: -----------------------------------------------------*/
#pragma libcall SysBase AddLibrary 18c 901
#pragma libcall SysBase RemLibrary 192 901
#pragma libcall SysBase OldOpenLibrary 198 901
#pragma libcall SysBase CloseLibrary 19e 901
#pragma libcall SysBase SetFunction 1a4 8903
#pragma libcall SysBase SumLibrary 1aa 901
/*------ devices: -------------------------------------------------------*/
#pragma libcall SysBase AddDevice 1b0 901
#pragma libcall SysBase RemDevice 1b6 901
#pragma libcall SysBase OpenDevice 1bc 190804
#pragma libcall SysBase CloseDevice 1c2 901
#pragma libcall SysBase DoIO 1c8 901
#pragma libcall SysBase SendIO 1ce 901
#pragma libcall SysBase CheckIO 1d4 901
#pragma libcall SysBase WaitIO 1da 901
#pragma libcall SysBase AbortIO 1e0 901
/*------ resources: ----------------------------------------------------*/
#pragma libcall SysBase AddResource 1e6 901
#pragma libcall SysBase RemResource 1ec 901
#pragma libcall SysBase OpenResource 1f2 901
/*------ new functions:*/
#pragma libcall SysBase RawDoFmt 20a BA9804
#pragma libcall SysBase GetCC 210 0
#pragma libcall SysBase TypeOfMem 216 901
#pragma libcall SysBase Procure 21c 9802
#pragma libcall SysBase Vacate 222 801
#pragma libcall SysBase OpenLibrary 228 902
/*------ 1.2 new semaphore support*/
#pragma libcall SysBase InitSemaphore 22e 801
#pragma libcall SysBase ObtainSemaphore 234 801
#pragma libcall SysBase ReleaseSemaphore 23a 801
#pragma libcall SysBase AttemptSemaphore 240 801
#pragma libcall SysBase ObtainSemaphoreList 246 801
#pragma libcall SysBase ReleaseSemaphoreList 24c 801
#pragma libcall SysBase FindSemaphore 252 801
#pragma libcall SysBase AddSemaphore 258 801
#pragma libcall SysBase RemSemaphore 25e 801
/*------ 1.2 rom "kickstart" support + memory support*/
#pragma libcall SysBase SumKickData 264 0
#pragma libcall SysBase AddMemList 26a 9821005
#pragma libcall SysBase CopyMem 270 9803
#pragma libcall SysBase CopyMemQuick 276 9803
#endif
