3 * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
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; either version 3 of the License, or (at
8 * your option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #ifndef __GSL_MESSAGE_H__
21 #define __GSL_MESSAGE_H__
22 #include <gsl/gsl_types.h>
27 # define __BEGIN_DECLS extern "C" {
28 # define __END_DECLS }
30 # define __BEGIN_DECLS /* empty */
31 # define __END_DECLS /* empty */
36 /* Provide a general messaging service for client use. Messages can
37 * be selectively turned off at compile time by defining an
38 * appropriate message mask. Client code which uses the GSL_MESSAGE()
39 * macro must provide a mask which is or'ed with the GSL_MESSAGE_MASK.
41 * The messaging service can be completely turned off
42 * by defining GSL_MESSAGING_OFF. */
44 void gsl_message(const char * message, const char * file, int line,
47 #ifndef GSL_MESSAGE_MASK
48 #define GSL_MESSAGE_MASK 0xffffffffu /* default all messages allowed */
51 GSL_VAR unsigned int gsl_message_mask ;
53 /* Provide some symolic masks for client ease of use. */
56 GSL_MESSAGE_MASK_A = 1,
57 GSL_MESSAGE_MASK_B = 2,
58 GSL_MESSAGE_MASK_C = 4,
59 GSL_MESSAGE_MASK_D = 8,
60 GSL_MESSAGE_MASK_E = 16,
61 GSL_MESSAGE_MASK_F = 32,
62 GSL_MESSAGE_MASK_G = 64,
63 GSL_MESSAGE_MASK_H = 128
66 #ifdef GSL_MESSAGING_OFF /* throw away messages */
67 #define GSL_MESSAGE(message, mask) do { } while(0)
68 #else /* output all messages */
69 #define GSL_MESSAGE(message, mask) \
71 if (mask & GSL_MESSAGE_MASK) \
72 gsl_message (message, __FILE__, __LINE__, mask) ; \
78 #endif /* __GSL_MESSAGE_H__ */