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

kviewshell

debug.h

Go to the documentation of this file.
00001 //C-  -*- C++ -*-
00002 //C- -------------------------------------------------------------------
00003 //C- DjVuLibre-3.5
00004 //C- Copyright (c) 2002  Leon Bottou and Yann Le Cun.
00005 //C- Copyright (c) 2001  AT&T
00006 //C-
00007 //C- This software is subject to, and may be distributed under, the
00008 //C- GNU General Public License, Version 2. The license should have
00009 //C- accompanied the software or you may obtain a copy of the license
00010 //C- from the Free Software Foundation at http://www.fsf.org .
00011 //C-
00012 //C- This program is distributed in the hope that it will be useful,
00013 //C- but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 //C- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 //C- GNU General Public License for more details.
00016 //C- 
00017 //C- DjVuLibre-3.5 is derived from the DjVu(r) Reference Library
00018 //C- distributed by Lizardtech Software.  On July 19th 2002, Lizardtech 
00019 //C- Software authorized us to replace the original DjVu(r) Reference 
00020 //C- Library notice by the following text (see doc/lizard2002.djvu):
00021 //C-
00022 //C-  ------------------------------------------------------------------
00023 //C- | DjVu (r) Reference Library (v. 3.5)
00024 //C- | Copyright (c) 1999-2001 LizardTech, Inc. All Rights Reserved.
00025 //C- | The DjVu Reference Library is protected by U.S. Pat. No.
00026 //C- | 6,058,214 and patents pending.
00027 //C- |
00028 //C- | This software is subject to, and may be distributed under, the
00029 //C- | GNU General Public License, Version 2. The license should have
00030 //C- | accompanied the software or you may obtain a copy of the license
00031 //C- | from the Free Software Foundation at http://www.fsf.org .
00032 //C- |
00033 //C- | The computer code originally released by LizardTech under this
00034 //C- | license and unmodified by other parties is deemed "the LIZARDTECH
00035 //C- | ORIGINAL CODE."  Subject to any third party intellectual property
00036 //C- | claims, LizardTech grants recipient a worldwide, royalty-free, 
00037 //C- | non-exclusive license to make, use, sell, or otherwise dispose of 
00038 //C- | the LIZARDTECH ORIGINAL CODE or of programs derived from the 
00039 //C- | LIZARDTECH ORIGINAL CODE in compliance with the terms of the GNU 
00040 //C- | General Public License.   This grant only confers the right to 
00041 //C- | infringe patent claims underlying the LIZARDTECH ORIGINAL CODE to 
00042 //C- | the extent such infringement is reasonably necessary to enable 
00043 //C- | recipient to make, have made, practice, sell, or otherwise dispose 
00044 //C- | of the LIZARDTECH ORIGINAL CODE (or portions thereof) and not to 
00045 //C- | any greater extent that may be necessary to utilize further 
00046 //C- | modifications or combinations.
00047 //C- |
00048 //C- | The LIZARDTECH ORIGINAL CODE is provided "AS IS" WITHOUT WARRANTY
00049 //C- | OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
00050 //C- | TO ANY WARRANTY OF NON-INFRINGEMENT, OR ANY IMPLIED WARRANTY OF
00051 //C- | MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
00052 //C- +------------------------------------------------------------------
00053 // 
00054 // $Id: debug.h,v 1.12 2005/05/27 14:26:01 leonb Exp $
00055 // $Name: release_3_5_15 $
00056 
00057 #ifndef _DEBUG_H_
00058 #define _DEBUG_H_
00059 
00060 #ifdef HAVE_CONFIG_H
00061 # include "config.h"
00062 #endif
00063 #if NEED_GNUG_PRAGMAS
00064 # pragma interface
00065 #endif
00066 
00067 #include <stdio.h>
00068 #ifdef WIN32
00069 # include <atlbase.h> // USES_CONVERSION, A2CT macro
00070 # include <windows.h> // OutputDebugString
00071 #endif 
00072 
00073 
00074 #ifdef HAVE_NAMESPACES
00075 namespace DJVU {
00076 # ifdef NOT_DEFINED // Just to fool emacs c++ mode
00077 }
00078 # endif
00079 #endif
00080 
00134 
00135 #ifndef DEBUGLVL
00136 # ifdef NDEBUG
00137 #  define DEBUGLVL 0
00138 # endif 
00139 #endif
00140 #ifndef DEBUGLVL
00141 # ifdef NO_DEBUG
00142 #  define DEBUGLVL 0
00143 # endif 
00144 #endif
00145 #ifndef DEBUGLVL
00146 # ifdef RUNTIME_DEBUG_ONLY
00147 #  define DEBUGLVL 1
00148 # endif 
00149 #endif
00150 #ifndef DEBUGLVL
00151 # ifdef _DEBUG
00152 #  define DEBUGLVL 1
00153 # endif 
00154 #endif
00155 #ifndef DEBUGLVL
00156 #  define DEBUGLVL 0
00157 #endif
00158 
00159 #if DEBUGLVL <= 0
00160 
00161 # ifndef NO_DEBUG
00162 #  define NO_DEBUG
00163 # endif
00164 # ifndef NDEBUG
00165 #  define NDEBUG
00166 # endif
00167 # ifdef _DEBUG
00168 #  undef _DEBUG
00169 # endif
00170 
00171 # define DEBUG_MAKE_INDENT(x)
00172 # define DEBUG_SET_LEVEL(level)
00173 # define DEBUG_MSG_LVL(level,x)
00174 # define DEBUG_MSGN_LVL(level,x)
00175 
00176 #else
00177 
00178 # ifdef NO_DEBUG
00179 #  undef NO_DEBUG
00180 # endif
00181 # ifdef NDEBUG
00182 #  undef NDEBUG
00183 # endif
00184 # ifndef _DEBUG
00185 #  define _DEBUG
00186 # endif
00187 
00188 class GUTF8String;
00189 
00190 // ------------ SUPPORT
00191 
00192 class DjVuDebug // DJVU_CLASS
00193 {
00194 private:
00195   int    id;
00196   int    block;
00197   int    indent;
00198   void   format(const char *fmt, ... );
00199 public:
00200   // construction
00201   DjVuDebug();
00202   ~DjVuDebug();
00203   // access
00204   static void   set_debug_level(int lvl);
00205   static void   set_debug_file(FILE * file);
00206   void          modify_indent(int rindent);
00207   static DjVuDebug& lock(int lvl, int noindent);
00208   void          unlock();
00209   // printing
00210   DjVuDebug &   operator<<(bool b);
00211   DjVuDebug &   operator<<(char c);
00212   DjVuDebug &   operator<<(unsigned char c);
00213   DjVuDebug &   operator<<(int i);
00214   DjVuDebug &   operator<<(unsigned int i);
00215   DjVuDebug &   operator<<(short int i);
00216   DjVuDebug &   operator<<(unsigned short int i);
00217   DjVuDebug &   operator<<(long i);
00218   DjVuDebug &   operator<<(unsigned long i);
00219   DjVuDebug &   operator<<(const char * const ptr);
00220   DjVuDebug &   operator<<(const unsigned char * const ptr);
00221   DjVuDebug&    operator<<(const GUTF8String &ptr);
00222   DjVuDebug &   operator<<(float f);
00223   DjVuDebug &   operator<<(double d);
00224   DjVuDebug &   operator<<(const void * const p);
00225 };
00226 
00227 class DjVuDebugIndent // DJVU_CLASS
00228 {
00229 private:
00230   int inc;
00231 public:
00232   DjVuDebugIndent(int inc=2);
00233   ~DjVuDebugIndent();
00234 //#define DEBUG_MAKE_INDENT_2(x, y) DjVuDebugIndent debug_indent ## y (x)
00235 //#define DEBUG_MAKE_INDENT_1(x, y) DEBUG_MAKE_INDENT_2(x, y)
00236 #define DEBUG_MAKE_INDENT_1(x, y) DjVuDebugIndent debug_indent ## y (x)
00237 };
00238 
00239 // ------------ MAIN MACROS
00240 
00241 # define DEBUG_MAKE_INDENT(x)     DEBUG_MAKE_INDENT_1(x, __LINE__)
00242 # define DEBUG_SET_LEVEL(level)   DjVuDebug::set_debug_level(level)
00243 # define DEBUG_MSG_LVL(level,x)   { ( DjVuDebug::lock(level,0) << x ).unlock(); }
00244 # define DEBUG_MSGN_LVL(level,x)  { ( DjVuDebug::lock(level,1) << x ).unlock(); }
00245 # define DEBUG_MSGF_LVL(level,x)  { ( DjVuDebug::lock(level,1) << x ).unlock(); }
00246 
00247 #endif
00248 
00249 
00250 // ------------ EAF MACROS
00251 
00252 #if ( DEBUGLVL >= 1 )
00253 
00254 # define DEBUG1_MSG(x)  DEBUG_MSG_LVL(1,x)
00255 # define DEBUG1_MSGF(x) DEBUG_MSGF_LVL(1,x)
00256 #else
00257 # define DEBUG1_MSG(x)
00258 # define DEBUG1_MSGF(x)
00259 #endif
00260 #if ( DEBUGLVL >= 2 )
00261 
00262 # define DEBUG2_MSG(x)  DEBUG_MSG_LVL(2,x)
00263 # define DEBUG2_MSGF(x) DEBUG_MSGF_LVL(2,x)
00264 #else
00265 # define DEBUG2_MSG(x)
00266 # define DEBUG2_MSGF(x)
00267 #endif
00268 #if ( DEBUGLVL >= 3 )
00269 
00270 # define DEBUG3_MSG(x)  DEBUG_MSG_LVL(3,x)
00271 # define DEBUG3_MSGF(x) DEBUG_MSGF_LVL(3,x)
00272 #else
00273 # define DEBUG3_MSG(x)
00274 # define DEBUG3_MSGF(x)
00275 #endif
00276 #if ( DEBUGLVL >= 4 )
00277 
00278 # define DEBUG4_MSG(x)  DEBUG_MSG_LVL(4,x)
00279 # define DEBUG4_MSGF(x) DEBUG_MSGF_LVL(4,x)
00280 #else
00281 # define DEBUG4_MSG(x)
00282 # define DEBUG4_MSGF(x)
00283 #endif
00284 
00285 #define DEBUG_RUNTIME_SET_LEVEL(level) DEBUG_SET_LEVEL(level)
00286 
00287 #define DEBUG_MSG(x)  DEBUG1_MSG(x)
00288 
00289 #define DEBUG_MSGF(x) DEBUG1_MSGF(x)
00290 
00291 #define DEBUG_MSGN(x) DEBUG_MSG(x<<'\n')
00292 
00294 
00295 // ------------ THE END
00296 
00297 #ifdef HAVE_NAMESPACES
00298 }
00299 # ifndef NOT_USING_DJVU_NAMESPACE
00300 using namespace DJVU;
00301 # endif
00302 #endif
00303 
00304 #endif // 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