Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 10:03:50

0001 /* err/gsl_message.h
0002  * 
0003  * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
0004  * 
0005  * This program is free software; you can redistribute it and/or modify
0006  * it under the terms of the GNU General Public License as published by
0007  * the Free Software Foundation; either version 3 of the License, or (at
0008  * your option) any later version.
0009  * 
0010  * This program is distributed in the hope that it will be useful, but
0011  * WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013  * General Public License for more details.
0014  * 
0015  * You should have received a copy of the GNU General Public License
0016  * along with this program; if not, write to the Free Software
0017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0018  */
0019 
0020 #ifndef __GSL_MESSAGE_H__
0021 #define __GSL_MESSAGE_H__
0022 #include <gsl/gsl_types.h>
0023 
0024 #undef __BEGIN_DECLS
0025 #undef __END_DECLS
0026 #ifdef __cplusplus
0027 # define __BEGIN_DECLS extern "C" {
0028 # define __END_DECLS }
0029 #else
0030 # define __BEGIN_DECLS /* empty */
0031 # define __END_DECLS /* empty */
0032 #endif
0033 
0034 __BEGIN_DECLS
0035 
0036 /* Provide a general messaging service for client use.  Messages can
0037  * be selectively turned off at compile time by defining an
0038  * appropriate message mask. Client code which uses the GSL_MESSAGE()
0039  * macro must provide a mask which is or'ed with the GSL_MESSAGE_MASK.
0040  *
0041  * The messaging service can be completely turned off
0042  * by defining GSL_MESSAGING_OFF.  */
0043 
0044 void gsl_message(const char * message, const char * file, int line,
0045                  unsigned int mask);
0046 
0047 #ifndef GSL_MESSAGE_MASK
0048 #define GSL_MESSAGE_MASK 0xffffffffu /* default all messages allowed */
0049 #endif
0050 
0051 GSL_VAR unsigned int gsl_message_mask ;
0052 
0053 /* Provide some symolic masks for client ease of use. */
0054 
0055 enum {
0056   GSL_MESSAGE_MASK_A = 1,
0057   GSL_MESSAGE_MASK_B = 2,
0058   GSL_MESSAGE_MASK_C = 4,
0059   GSL_MESSAGE_MASK_D = 8,
0060   GSL_MESSAGE_MASK_E = 16,
0061   GSL_MESSAGE_MASK_F = 32,
0062   GSL_MESSAGE_MASK_G = 64,
0063   GSL_MESSAGE_MASK_H = 128
0064 } ;
0065 
0066 #ifdef GSL_MESSAGING_OFF        /* throw away messages */ 
0067 #define GSL_MESSAGE(message, mask) do { } while(0)
0068 #else                           /* output all messages */
0069 #define GSL_MESSAGE(message, mask) \
0070        do { \
0071        if (mask & GSL_MESSAGE_MASK) \
0072          gsl_message (message, __FILE__, __LINE__, mask) ; \
0073        } while (0)
0074 #endif
0075 
0076 __END_DECLS
0077 
0078 #endif /* __GSL_MESSAGE_H__ */
0079 
0080