/* trace.h Tracing & error message definitions for ebstrans Copyright (C) 1993/94 C.Taegert-Kilger, Institut fuer Physiologie und Biokybernetik (IPB), Universitaet Erlangen, Deutschland Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and related publications and that both that copyright notice and this permission notice appear in supporting documentation. The authors make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. Send your comments, suggestions or bug reports to ftpebs@uni-erlangen.de Or mail to Institut fuer Physiologie und Biokybernetik Markus Prosch Universitaetsstrasse 17 D-91054 Erlangen Germany $Id: trace.h,v 1.2 1994/12/15 10:52:35 msprosch Exp $ */ #include #include #ifdef TRACE #define P_TRACE printf("%s %i: ",__FILE__,__LINE__); printf #else #define P_TRACE if (1) {} else printf #endif #ifndef __TRACE #define __TRACE // Some inline functions // Error handling: Create error inline void ERROR(char *desc, char *mess1, char *mess2) { fprintf(stderr,"Error: %s : ",desc); if (mess1) fprintf(stderr,"%s",mess1); if (mess2) fprintf(stderr,"%s",mess2); fprintf(stderr,"\n"); exit(-1); } // Error handling: Create warning inline void WARNING(char *desc, char *mess1, char *mess2) { fprintf(stderr,"Warning: %s ",desc); if (mess1) fprintf(stderr,"%s",mess1); if (mess2) fprintf(stderr,"%s",mess2); fprintf(stderr,"\n"); } // Create message inline void MESSAGE (char *mess1, char *mess2, char *mess3) { fprintf(stderr,"%s",mess1); if (mess2) fprintf(stderr,"%s",mess2); if (mess3) fprintf(stderr,"%s",mess3); } #if 0 // Error handling: Create error #define ERROR(desc,mess1,mess2)\ { \ fprintf(stderr,"Error: %s : ",desc); \ if (mess1) fprintf(stderr,"%s",mess1); \ if (mess2) fprintf(stderr,"%s",mess2); \ fprintf(stderr,"\n"); \ exit(-1); \ } // Error handling: Create warning #define WARNING(desc,mess1,mess2)\ { \ fprintf(stderr,"Warning: %s ",desc); \ if (mess1) fprintf(stderr,"%s",mess1); \ if (mess2) fprintf(stderr,"%s",mess2); \ fprintf(stderr,"\n"); \ } // Create message #define MESSAGE(mess1,mess2,mess3)\ { \ fprintf(stderr,"%s",mess1); \ if (mess2) fprintf(stderr,"%s",mess2); \ if (mess3) fprintf(stderr,"%s",mess3); \ } #endif #endif // define __TRACE