Fixed binary search: no more infinite loops when vendor is unknown.
[tangerine.git] / workbench / libs / openurl / include / macros.h
blob03bcee44a23eb0e0f40fa73b3efd4b5b5bb4b923
2 #ifndef _MACROS_H
3 #define _MACROS_H
5 /****************************************************************************/
7 #ifdef __MORPHOS__
9 #define SAVEDS
10 #define ASM
11 #define REGARGS
12 #define STDARGS
13 #define INLINE inline
14 #define REG(x,p) p
15 #define LIBCALL
17 #define M_DISP(n) static ULONG _##n(void)
18 #define M_DISPSTART \
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
29 #define ASM __asm
30 #define REGARGS __regargs
31 #define STDARGS __stdargs
32 #define INLINE inline
33 #define REG(x,p) register __ ## x p
34 #define __attribute(a)
35 #endif
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))
39 #define M_DISPSTART
40 #define M_DISPEND(n)
41 #define DISP(n) (n)
43 #endif /* __MORPHOS__ */
45 #undef NODE
46 #define NODE(a) ((struct Node *)(a))
48 #undef MINNODE
49 #define MINNODE(a) ((struct MinNode *)(a))
51 #undef LIST
52 #define LIST(a) ((struct List *)(a))
54 #undef MINLIST
55 #define MINLIST(a) ((struct MinList *)(a))
57 #undef MESSAGE
58 #define MESSAGE(m) ((struct Message *)(m))
60 #undef NEWLIST
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))
65 #undef QUICKNEWLIST
66 #define QUICKNEWLIST(l) (LIST(l)->lh_Head = NODE(&LIST(l)->lh_Tail), \
67 LIST(l)->lh_TailPred = NODE(&LIST(l)->lh_Head))
69 #undef ADDTAIL
70 #define ADDTAIL(l,n) AddTail(LIST(l),NODE(n))
72 #undef PORT
73 #define PORT(p) ((struct MsgPort *)(p))
75 #undef INITPORT
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)))
81 #undef QUICKINITPORT
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)))
87 #undef INITMESSAGE
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))
92 #undef MAKE_ID
93 #define MAKE_ID(a,b,c,d) ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | (ULONG) (d))
95 #undef MIN
96 #define MIN(a,b) ((a<b) ? (a) : (b))
98 #undef MAX
99 #define MAX(a,b) ((a>b) ? (a) : (b))
101 #undef ABS
102 #define ABS(a) (((a)>0) ? (a) : -(a))
104 #undef BOOLSAME
105 #define BOOLSAME(a,b) (((a) ? TRUE : FALSE)==((b) ? TRUE : FALSE))
107 #ifndef __AROS__
108 typedef ULONG IPTR;
109 #endif
111 /****************************************************************************/
113 #endif /* _MACROS_H */