Fix bug in setting up w3 and w4 games
[capablanca.git] / lasker-2.2.3 / src / utils.h
1 /*
2    Copyright (c) 1993 Richard V. Nash.
3    Copyright (c) 2000 Dan Papasian
4    Copyright (C) Andrew Tridgell 2002
5    
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2 of the License, or
9    (at your option) any later version.
10    
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15    
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21 #ifndef _UTILS_H
22 #define _UTILS_H
23
24 #define MAX_WORD_SIZE 1024
25
26 /* Maximum length of an output line */
27 #define MAX_LINE_SIZE 1024
28
29 /* Maximum size of a filename */
30 #ifdef FILENAME_MAX
31 #  define MAX_FILENAME_SIZE FILENAME_MAX
32 #else
33 #  define MAX_FILENAME_SIZE 1024
34 #endif
35
36 #define FlagON(VAR, FLAG)  (VAR |= (FLAG))
37 #define FlagOFF(VAR, FLAG)  (VAR &= ~(FLAG))   
38 #define CheckFlag(VAR, FLAG)  ((VAR) & (FLAG))
39 #define BoolCheckFlag(VAR, FLAG)  (CheckFlag(VAR, FLAG)  ?  1  :  0)
40 #define ToggleFlag(VAR, FLAG)  (VAR ^= (FLAG))
41 #define SetFlag(VAR, FLAG, VALUE)  ((VALUE) ? FlagON(VAR, FLAG) : FlagOFF(VAR, FLAG))
42
43 #define PFlagON(WHO, FLAG)  FlagON(player_globals.parray[WHO].Flags, FLAG)
44 #define PFlagOFF(WHO, FLAG)  FlagOFF(player_globals.parray[WHO].Flags, FLAG)
45 #define CheckPFlag(WHO, FLAG)  CheckFlag(player_globals.parray[WHO].Flags, FLAG)
46 #define BoolCheckPFlag(WHO, FLAG)  BoolCheckFlag(player_globals.parray[WHO].Flags, FLAG)
47 #define TogglePFlag(WHO, FLAG)  ToggleFlag(player_globals.parray[WHO].Flags, FLAG)
48 #define SetPFlag(WHO, FLAG, VALUE)  ((VALUE) ? PFlagON(WHO, FLAG) : PFlagOFF(WHO, FLAG))
49
50
51 #endif /* _UTILS_H */