5 /****************************************************************************/
17 #define M_DISP(n) static ULONG _##n(void)
19 struct IClass *cl = (struct IClass *)REG_A0; \
20 Object *obj = (Object *)REG_A2; \
21 Msg msg = (Msg)REG_A1;
22 #define M_DISPEND(n) static struct EmulLibEntry n = {TRAP_LIB,0,(void *)_##n};
23 #define DISP(n) ((APTR)&n)
25 #else /* __MORPHOS__ */
27 #if !defined(__amigaos4__)
28 #define SAVEDS __saveds
30 #define REGARGS __regargs
31 #define STDARGS __stdargs
33 #define REG(x,p) register __ ## x p
34 #define __attribute(a)
36 #define LIBCALL SAVEDS ASM
38 #define M_DISP(n) static ULONG SAVEDS ASM n(REG(a0,struct IClass *cl),REG(a2,Object *obj),REG(a1,Msg msg))
43 #endif /* __MORPHOS__ */
46 #define NODE(a) ((struct Node *)(a))
49 #define MINNODE(a) ((struct MinNode *)(a))
52 #define LIST(a) ((struct List *)(a))
55 #define MINLIST(a) ((struct MinList *)(a))
58 #define MESSAGE(m) ((struct Message *)(m))
61 #define NEWLIST(l) (LIST(l)->lh_Head = NODE(&LIST(l)->lh_Tail), \
62 LIST(l)->lh_Tail = NULL, \
63 LIST(l)->lh_TailPred = NODE(&LIST(l)->lh_Head))
66 #define QUICKNEWLIST(l) (LIST(l)->lh_Head = NODE(&LIST(l)->lh_Tail), \
67 LIST(l)->lh_TailPred = NODE(&LIST(l)->lh_Head))
70 #define ADDTAIL(l,n) AddTail(LIST(l),NODE(n))
73 #define PORT(p) ((struct MsgPort *)(p))
76 #define INITPORT(p,s) (PORT(p)->mp_Flags = PA_SIGNAL, \
77 PORT(p)->mp_SigBit = (UBYTE)(s), \
78 PORT(p)->mp_SigTask = FindTask(NULL), \
79 NEWLIST(&(PORT(p)->mp_MsgList)))
82 #define QUICKINITPORT(p,s,t) (PORT(p)->mp_Flags = PA_SIGNAL, \
83 PORT(p)->mp_SigBit = (UBYTE)(s), \
84 PORT(p)->mp_SigTask = (t), \
85 QUICKNEWLIST(&(PORT(p)->mp_MsgList)))
88 #define INITMESSAGE(m,p,l) (MESSAGE(m)->mn_Node.ln_Type = NT_MESSAGE, \
89 MESSAGE(m)->mn_ReplyPort = PORT(p), \
90 MESSAGE(m)->mn_Length = ((UWORD)l))
93 #define MAKE_ID(a,b,c,d) ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | (ULONG) (d))
96 #define MIN(a,b) ((a<b) ? (a) : (b))
99 #define MAX(a,b) ((a>b) ? (a) : (b))
102 #define ABS(a) (((a)>0) ? (a) : -(a))
105 #define BOOLSAME(a,b) (((a) ? TRUE : FALSE)==((b) ? TRUE : FALSE))
111 /****************************************************************************/
113 #endif /* _MACROS_H */