Stunt: get codesetslib from its own Sourceforge repository.
[cake.git] / workbench / libs / codesetslib / src / macros.h
blob500e0690a8737206a222fd25546321b213b0d9a2
1 /***************************************************************************
3 codesets.library - Amiga shared library for handling different codesets
4 Copyright (C) 2001-2005 by Alfonso [alfie] Ranieri <alforan@tin.it>.
5 Copyright (C) 2005-2007 by codesets.library Open Source Team
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 codesets.library project: http://sourceforge.net/projects/codesetslib/
19 $Id$
21 ***************************************************************************/
23 #ifndef _MACROS_H
24 #define _MACROS_H
26 /****************************************************************************/
28 ** Some useful macros
31 #ifndef __AROS__
32 #include "SDI_compiler.h"
33 #endif
35 #if defined(__amigaos4__)
36 #define GETINTERFACE(iface, base) (iface = (APTR)GetInterface((struct Library *)(base), "main", 1L, NULL))
37 #define DROPINTERFACE(iface) (DropInterface((struct Interface *)iface), iface = NULL)
38 #else
39 #define GETINTERFACE(iface, base) TRUE
40 #define DROPINTERFACE(iface)
41 #endif
43 // special flagging macros
44 #define isFlagSet(v,f) (((v) & (f)) == (f)) // return TRUE if the flag is set
45 #define hasFlag(v,f) (((v) & (f)) != 0) // return TRUE if one of the flags in f is set in v
46 #define isFlagClear(v,f) (((v) & (f)) == 0) // return TRUE if flag f is not set in v
47 #define SET_FLAG(v,f) ((v) |= (f)) // set the flag f in v
48 #define CLEAR_FLAG(v,f) ((v) &= ~(f)) // clear the flag f in v
49 #define MASK_FLAG(v,f) ((v) &= (f)) // mask the variable v with flag f bitwise
51 /****************************************************************************/
53 #endif /* _MACROS_H */