tools/adflib: build only host variant which is used by Sam440 target
[AROS.git] / external / openurl / include / macros.h
blob059d3abb90371fa38087fabc4b877b2005f43da1
1 #ifndef _MACROS_H
2 #define _MACROS_H
4 /****************************************************************************/
6 #include "SDI_compiler.h"
8 #if defined(__amigaos4__)
9 #define GETINTERFACE(iface, base) (iface = (APTR)GetInterface((struct Library *)(base), "main", 1L, NULL))
10 #define DROPINTERFACE(iface) (DropInterface((struct Interface *)iface), iface = NULL)
11 #else
12 #define GETINTERFACE(iface, base) TRUE
13 #define DROPINTERFACE(iface)
14 #endif
16 // special flagging macros
17 #define isFlagSet(v,f) (((v) & (f)) == (f)) // return TRUE if the flag is set
18 #define hasFlag(v,f) (((v) & (f)) != 0) // return TRUE if one of the flags in f is set in v
19 #define isFlagClear(v,f) (((v) & (f)) == 0) // return TRUE if flag f is not set in v
20 #define SET_FLAG(v,f) ((v) |= (f)) // set the flag f in v
21 #define CLEAR_FLAG(v,f) ((v) &= ~(f)) // clear the flag f in v
22 #define MASK_FLAG(v,f) ((v) &= (f)) // mask the variable v with flag f bitwise
24 // transforms a define into a string
25 #define STR(x) STR2(x)
26 #define STR2(x) #x
28 #define INITMESSAGE(m,p,l) (((struct Message *)(m))->mn_Node.ln_Type = NT_MESSAGE, \
29 ((struct Message *)(m))->mn_ReplyPort = ((struct MsgPort *)(p)), \
30 ((struct Message *)(m))->mn_Length = ((UWORD)l))
32 #define MIN(a,b) ((a<b) ? (a) : (b))
33 #define MAX(a,b) ((a>b) ? (a) : (b))
34 #define ABS(a) (((a)>0) ? (a) : -(a))
35 #define BOOLSAME(a,b) (((a) ? TRUE : FALSE)==((b) ? TRUE : FALSE))
37 #if !defined(__amigaos4__) && !defined(__AROS__)
38 #define SYS_Error TAG_IGNORE
39 #endif
41 #if defined(__AROS__)
42 #define MAXRMARG 15 /* maximum arguments */
43 #endif
45 // xget()
46 // Gets an attribute value from a MUI object
47 //ULONG xget(Object *obj, const IPTR attr);
48 #if defined(__GNUC__)
49 // please note that we do not evaluate the return value of GetAttr()
50 // as some attributes (e.g. MUIA_Selected) always return FALSE, even
51 // when they are supported by the object. But setting b=0 right before
52 // the GetAttr() should catch the case when attr doesn't exist at all
53 #define xget(OBJ, ATTR) ({IPTR b=0; GetAttr(ATTR, OBJ, &b); b;})
54 #endif
56 /****************************************************************************/
58 #endif /* _MACROS_H */