MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
macros.h
1 /*
2  Copyright (C) 2005, 2006 MySQL AB
3  All rights reserved. Use is subject to license terms.
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; version 2 of the License.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 
19 #ifndef MACROS_H
20 #define MACROS_H
21 
22 #include <ndb_global.h>
23 #include <NdbOut.hpp>
24 
25 #define ERROR(x) {ndbout_c((x));}
26 #define ERROR1(x,y) {ndbout_c((x), (y));}
27 #define ERROR2(x,y,z) {ndbout_c((x), (y), (z));}
28 #define ERROR3(x,y,z,u) {ndbout_c((x), (y), (z), (u));}
29 #define ERROR4(x,y,z,u,w) {ndbout_c((x), (y), (z), (u), (w));}
30 
31 #define INIT_RANDOM(x) srand48((x))
32 #define UI_RANDOM(x) ((unsigned int)(lrand48()%(x)))
33 
34 #define ASSERT(cond, message) \
35  { if(!(cond)) { ERROR(message); exit(-1); }}
36 
37 #ifdef DEBUG_ON
38 #define DEBUG(x) {ndbout_c((x));}
39 #define DEBUG1(x,y) {ndbout_c((x), (y));}
40 #define DEBUG2(x,y,z) {ndbout_c((x), (y), (z));}
41 #define DEBUG3(x,y,z,u) {ndbout_c((x), (y), (z), (u));}
42 #define DEBUG4(x,y,z,u,w) {ndbout_c((x), (y), (z), (u), (w));}
43 #define DEBUG5(x,y,z,u,w, v) {ndbout_c((x), (y), (z), (u), (w), (v));}
44 #else
45 #define DEBUG(x)
46 #define DEBUG1(x,y)
47 #define DEBUG2(x,y,z)
48 #define DEBUG3(x,y,z,u)
49 #define DEBUG4(x,y,z,u,w)
50 #define DEBUG5(x,y,z,u,w, v)
51 #endif
52 
53 #endif