• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kviewshell

debug.h File Reference

#include <stdio.h>

Include dependency graph for debug.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


Defines

debug.h
Files #"debug.h"# and #"debug.cpp"# implement means to print debug messages in a multithread safe way.

Message are also marked with a thread identifier. Under Windows, debug messages are directly sent to the debugger using the Win32 function OutputDebugString#. Under Unix, debug messages are printed on the controlling terminal, preferably using device #/dev/tty#.

The preprocessor variable DEBUGLVL# defines which debug code is going to be compiled. Selecting #-DDEBUGLVL=0# (the default) disables all debugging code. Selecting a positive values (e.g. #-DDEBUGLVL=4#) enables more and more debugging code.

Message output is controlled by the current debugging level (an integer between #0# and DEBUGLVL#). Greater values enable more messages. The initial debugging level is set to the maximum value. The debugging level can be changed using macro {DEBUG_SET_LEVEL}.

Message indentation can be modified using macro {DEBUG_MAKE_INDENT}. Messages are generated by macro {DEBUG_MSG} or its variants. The argument of the macro can contain several components separated by operator #<<#, as demonstrated in the example below: {verbatim} DEBUG_MSG("The value of a[" << n << "] is " << a[n] << '
'); {verbatim}

One more preprocessor variable RUNTIME_DEBUG_ONLY# enables compilation of debug code, but does not enable the debug messages automatically. In order to see them the program should use {DEBUG_SET_LEVEL} to change the level to anything greater than 0. Normally this happens when user specifies option #-debug# in the command line. Usage of RUNTIME_DEBUG_ONLY# implies DEBUGLVL=1# if not specified otherwise.

Finally, #-DNO_DEBUG# or #-DNDEBUG# can be used instead of #-DDEBUGLVL=0#, and #-D_DEBUG# can be used instead of #-DDEBUGLVL=0#.

{ Historical Comment} --- Debug macros are rarely used in the reference DjVu library because Leon thinks that debugging messages unnecessarily clutter the code. Debug macros are used everywhere in the plugin code because Andrew thinks that code without debugging messages is close to useless. No agreement could be reached. Neither could they agree on if cluttering header files with huge documentation chunks helps to improve code readability.

Macros for printing debug messages.

Version:
$Id: debug.h,v 1.12 2005/05/27 14:26:01 leonb Exp $#
Author:
Andrew Erofeev <eaf@geocities.com> -- initial implementation \ Leon Bottou <leonb@research.att.com> -- cleanups


#define DEBUG1_MSG(x)
#define DEBUG1_MSGF(x)
#define DEBUG2_MSG(x)
#define DEBUG2_MSGF(x)
#define DEBUG3_MSG(x)
#define DEBUG3_MSGF(x)
#define DEBUG4_MSG(x)
#define DEBUG4_MSGF(x)
#define DEBUG_MAKE_INDENT(x)
#define DEBUG_MSG(x)   DEBUG1_MSG(x)
#define DEBUG_MSG_LVL(level, x)
#define DEBUG_MSGF(x)   DEBUG1_MSGF(x)
#define DEBUG_MSGN(x)   DEBUG_MSG(x<<'\n')
#define DEBUG_MSGN_LVL(level, x)
#define DEBUG_RUNTIME_SET_LEVEL(level)   DEBUG_SET_LEVEL(level)
#define DEBUG_SET_LEVEL(level)
#define DEBUGLVL   0

Define Documentation

#define DEBUG1_MSG ( x   ) 

Definition at line 257 of file debug.h.

#define DEBUG1_MSGF ( x   ) 

Definition at line 258 of file debug.h.

#define DEBUG2_MSG ( x   ) 

Definition at line 265 of file debug.h.

#define DEBUG2_MSGF ( x   ) 

Definition at line 266 of file debug.h.

#define DEBUG3_MSG ( x   ) 

Definition at line 273 of file debug.h.

#define DEBUG3_MSGF ( x   ) 

Definition at line 274 of file debug.h.

#define DEBUG4_MSG ( x   ) 

Definition at line 281 of file debug.h.

#define DEBUG4_MSGF ( x   ) 

Definition at line 282 of file debug.h.

#define DEBUG_MAKE_INDENT ( x   ) 

Definition at line 171 of file debug.h.

#define DEBUG_MSG ( x   )     DEBUG1_MSG(x)

Generates a level 1 message.

Definition at line 287 of file debug.h.

#define DEBUG_MSG_LVL ( level,
x   ) 

Definition at line 173 of file debug.h.

#define DEBUG_MSGF ( x   )     DEBUG1_MSGF(x)

Generates a level 1 message without indentation.

Definition at line 289 of file debug.h.

#define DEBUG_MSGN ( x   )     DEBUG_MSG(x<<'\n')

Generates a level 1 message terminated with a newline.

Definition at line 291 of file debug.h.

#define DEBUG_MSGN_LVL ( level,
x   ) 

Definition at line 174 of file debug.h.

#define DEBUG_RUNTIME_SET_LEVEL ( level   )     DEBUG_SET_LEVEL(level)

Definition at line 285 of file debug.h.

#define DEBUG_SET_LEVEL ( level   ) 

Definition at line 172 of file debug.h.

#define DEBUGLVL   0

Definition at line 156 of file debug.h.

kviewshell

Skip menu "kviewshell"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • kviewshell
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal