home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: OtherApp / OtherApp.zip / wincam.zip / winc_src.zip / trace.h < prev    next >
C/C++ Source or Header  |  1997-02-28  |  2KB  |  57 lines

  1. /*
  2.  *
  3.  * simple tracing control, to isolate most of the code from the vagaries
  4.  * of where this stuff should end up.
  5.  *
  6.  * Copyright (C) 1996, Paul G. Fox
  7.  *
  8.  * This program is free software; you can redistribute it and/or modify it
  9.  * under the terms of the GNU General Public License as published by the
  10.  * Free Software Foundation; either version 2 of the License, or (at your
  11.  * option) any later version.
  12.  * 
  13.  * This program is distributed in the hope that it will be useful, but
  14.  * WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16.  * General Public License for more details.
  17.  * 
  18.  * You should have received a copy of the GNU General Public License along
  19.  * with this program; if not, write to the Free Software Foundation, Inc.,
  20.  * 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  *
  22.  * $Header: E:/winc/RCS/trace.h 1.1 1997/03/01 03:44:14 Derek Exp Derek $
  23.  */
  24.  
  25. #include <stdarg.h>
  26.  
  27. /*
  28.  * If we're not using gcc, turn off "attribute" stuff.
  29.  */
  30. #ifndef __GNUC__
  31. #define __attribute__(x)
  32. #endif
  33.  
  34.  
  35. extern int errorlevel;
  36. extern char tracechars[];
  37.  
  38. typedef int (*vprintffunc)( void *, const  char  *,  va_list );
  39. void register_error_func(vprintffunc, void *);
  40. void errormsg(char *fmt, ...)
  41.     __attribute__ ((format (printf, 1, 2)));
  42.  
  43.  
  44. void register_trace_func(vprintffunc, void *);
  45. void set_trace_class(char *newclass);
  46. void tracemsg(char *class, char *fmt, ...)
  47.     __attribute__ ((format (printf, 2, 3)));
  48.  
  49. /* if there's any tracing at all going on, invoke tracemsg() */
  50. #define TRACE if (tracechars[0]) tracemsg
  51. #define TRACE_IS_ACTIVE()   (tracechars[0])
  52.  
  53. /* if there's any tracing at all going on, invoke tracemsg() */
  54. #define ERROR if (errorlevel) errormsg
  55.  
  56.  
  57.