Main Page   Reference Manual   Compound List   File List  

libecc/debug.h

Go to the documentation of this file.
00001 //
00011 //
00012 // This file is part of the libecc package.
00013 // Copyright (C) 2002, 2004 by
00014 //
00015 // Carlo Wood, Run on IRC <carlo@alinoe.com>
00016 // RSA-1024 0x624ACAD5 1997-01-26                    Sign & Encrypt
00017 // Fingerprint16 = 32 EC A7 B6 AC DB 65 A6  F6 F6 55 DD 1C DC FF 61
00018 //
00019 // This program is free software; you can redistribute it and/or
00020 // modify it under the terms of the GNU General Public License
00021 // as published by the Free Software Foundation; either version 2
00022 // of the License, or (at your option) any later version.
00023 //
00024 // This program is distributed in the hope that it will be useful,
00025 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00026 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00027 // GNU General Public License for more details.
00028 //
00029 // You should have received a copy of the GNU General Public License
00030 // along with this program; if not, write to the Free Software
00031 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00032 
00033 #ifndef LIBECC_DEBUG_H
00034 #define LIBECC_DEBUG_H
00035 
00036 #include "libecc/config.h"
00037 
00038 #ifdef CWDEBUG
00039 #include <libcwd/libraries_debug.h>
00040 
00041 namespacelibecc {
00042   namespacedebug {
00043     namespacechannels {
00044       namespacedc {
00045         using namespacelibcwd::channels::dc;
00046         extern libcwd::channel_ct ecc;
00047         extern libcwd::channel_ct polynomial;
00048         extern libcwd::channel_ct bitsetfind1;
00049         extern libcwd::channel_ct bitsetshift;
00050         extern libcwd::channel_ct gaussj;
00051       }
00052     }
00053   }
00054 }
00055 #endif // CWDEBUG
00056 
00057 #if ECC_DEBUG
00058 // Define private debug output macros for use in header files of the library.
00059 #define LibEccDebug(STATEMENT...) LibcwDebug(libecc::debug::channels, STATEMENT)
00060 #define LibEccDout(cntrl, data) do { LibcwDout(libecc::debug::channels, libcwd::libcw_do, cntrl, data); } while(0)
00061 #define LibEccDoutFatal(cntrl, data) LibcwDoutFatal(libecc::debug::channels, libcwd::libcw_do, cntrl, data)
00062 #define LibEccForAllDebugChannels(STATEMENT...) LibcwdForAllDebugChannels(libecc::debug::channels, STATEMENT)
00063 #define LibEccForAllDebugObjects(STATEMENT...) LibcwdForAllDebugObjects(libecc::debug::channels, STATEMENT)
00064 #else
00065 #define LibEccDebug(STATEMENT...) do { } while(0)
00066 #define LibEccDout(cntrl, data) do { } while(0)
00067 #define LibEccDoutFatal(cntrl, data) do { std::cerr << data << std::endl; abort(); } while(0)
00068 #define LibEccForAllDebugChannels(STATEMENT...) do { } while(0)
00069 #define LibEccForAllDebugObjects(STATEMENT...) do { } while(0)
00070 #endif
00071 
00072 // All other macros might be used in header files of libecc, but need to be
00073 // defined by the debug.h of the application that uses it.
00074 // LIBECC_INTERNAL is defined when the library itself is being compiled (see below).
00075 #if !defined(Debug) && !defined(LIBECC_INTERNAL)
00076 #error The application source file (.cc or .cpp) must use '#include "debug.h"' _before_ including the header file that it includes now, that led to this error.
00077 #endif
00078 
00079 #endif // LIBECC_DEBUG_H
Copyright © 2002-2008 Carlo Wood.  All rights reserved.