Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3399 in orxonox.OLD for orxonox/branches/nico/src/debug.h


Ignore:
Timestamp:
Feb 6, 2005, 11:27:25 PM (20 years ago)
Author:
bensch
Message:

orxonox/branches/nico: merged trunk into branches/nico
merged with command:
svn merge ../trunk/ nico/ -r 3238:HEAD
resolved conflict in favor of branches/nico.

Location:
orxonox/branches/nico
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/nico

    • Property svn:externals set to
  • orxonox/branches/nico/src/debug.h

    r3238 r3399  
     1/*
     2   orxonox - the future of 3D-vertical-scrollers
     3
     4   Copyright (C) 2004 orx
     5
     6   This program is free software; you can redistribute it and/or modify
     7   it under the terms of the GNU General Public License as published by
     8   the Free Software Foundation; either version 2, or (at your option)
     9   any later version.
     10
     11   ### File Specific:
     12   main-programmer: Benjamin Grauer
     13   co-programmer: ...
     14*/
     15
     16/*!
     17    \file debug.h
     18    \brief Handles output to console for different Verbose-Modes.
     19*/
     20
    121#ifndef _DEBUG_H
    222#define _DEBUG_H
    323
     24#define NO              0
     25#define ERROR           1
     26#define WARNING         2
     27#define INFORMATION     3
     28#define DEBUGING        4
     29
     30#include <stdio.h>
     31
     32///////////////////////////////////////////////////
     33/// PRINTF: prints with filename and linenumber ///
     34///////////////////////////////////////////////////
     35
    436#ifdef  DEBUG
     37extern int verbose;
    538#define PRINTF(x) \
    639           PRINTF ## x
    740
    8 #if DEBUG >= 1
     41#if DEBUG >= ERROR
    942#define PRINTF1 \
    10     if (verbose >= 1 ) \
     43    if (verbose >= ERROR) \
    1144      printf("%s:%d::", __FILE__, __LINE__) && printf
    1245#else
    13 #define PRINTF1 //
     46#define PRINTF1 if (NO)
    1447#endif
    1548     
    16 #if DEBUG >= 2
     49#if DEBUG >= WARNING
    1750#define PRINTF2 \
    18      if (verbose >= 2 ) \
     51     if (verbose >= WARNING) \
    1952       printf("%s:%d::", __FILE__, __LINE__) && printf
    2053         
    2154#else
    22 #define PRINTF2 //
     55#define PRINTF2 if (NO)
    2356#endif
    2457     
    25 #if DEBUG >= 3
     58#if DEBUG >= INFORMATION
    2659#define PRINTF3 \
    27      if (verbose >= 3 ) \
     60     if (verbose >= INFORMATION) \
    2861       printf("%s:%d::", __FILE__, __LINE__) && printf
    2962#else
    30 #define PRINTF3 //
     63#define PRINTF3 if (NO)
    3164#endif
    3265     
    33 #if DEBUG >= 4
     66#if DEBUG >= DEBUGING
    3467#define PRINTF4 \
    35      if (verbose >= 4 ) \
     68     if (verbose >= DEBUGING) \
    3669       printf("%s:%d::", __FILE__, __LINE__) && printf
    3770#else
    38 #define PRINTF4 //
     71#define PRINTF4 if (NO)
    3972#endif
    4073     
    4174     
    4275#else 
    43 #define PRINTF(x) //
     76#define PRINTF(x) if (NO)
    4477#endif
    4578
     
    4780    printf("%s:%d::", __FILE__, __LINE__) && printf
    4881
     82
     83///////////////////////////////////////////////////
     84///  PRINT: just prints output as is            ///
     85///////////////////////////////////////////////////
     86#ifdef  DEBUG
     87extern int verbose;
     88#define PRINT(x) \
     89  PRINT ## x
     90
     91#if DEBUG >= ERROR
     92#define PRINT1  \
     93  if (verbose >= ERROR) \
     94    printf
     95#else
     96#define PRINT1 if (NO)
     97#endif
     98
     99#if DEBUG >= WARNING
     100#define PRINT2 \
     101  if (verbose >= WARNING) \
     102    printf
     103
     104#else
     105#define PRINT2 if (NO)
     106#endif
     107
     108#if DEBUG >= INFORMATION
     109#define PRINT3 \
     110  if (verbose >= INFORMATION) \
     111    printf
     112#else
     113#define PRINT3 if (NO)
     114#endif
     115
     116#if DEBUG >= DEBUGING
     117#define PRINT4 \
     118  if (verbose >= DEBUGING) \
     119    printf
     120#else
     121#define PRINT4 if (NO)
     122#endif
     123
     124
     125#else 
     126#define PRINT(x) if (NO)
     127#endif
     128
     129#define PRINT0 \
     130  printf
     131
     132///////////////////////////////////////////////////
     133/// COUT: simple cout print with verbose-check  ///
     134///////////////////////////////////////////////////
     135#ifdef  DEBUG
     136#define COUT(x) \
     137           COUT ## x
     138
     139#if DEBUG >= 1
     140#define COUT1 \
     141    if (verbose >= 1 ) \
     142      cout
     143#else
     144#define COUT1 if (NO) cout
     145#endif
     146     
     147#if DEBUG >= 2
     148#define COUT2 \
     149     if (verbose >= 2 ) \
     150       cout
     151
     152#else
     153#define COUT2 if (NO) cout
     154#endif
     155     
     156#if DEBUG >= 3
     157#define COUT3 \
     158     if (verbose >= 3 ) \
     159       cout
     160#else
     161#define COUT3 if (NO) cout
     162#endif
     163     
     164#if DEBUG >= 4
     165#define COUT4 \
     166     if (verbose >= 4 ) \
     167       cout
     168#else
     169#define COUT4 if (NO) cout
     170#endif
     171     
     172     
     173#else 
     174#define COUT(x) if (NO) cout
     175#endif
     176
     177#define COUT0 \
     178           cout
     179
    49180#endif /* _DEBUG_H */
Note: See TracChangeset for help on using the changeset viewer.