modules/up/src/util/debug.cc

/* [<][>]
[^][v][top][bottom][index][help] */

FUNCTIONS

This source file includes following functions.
  1. dbgstream
  2. enable
  3. disable
  4. enable
  5. disable
  6. enabledp
  7. enabledp
  8. Abort
  9. copy_constructor

   1 //  $Id: debug.cc,v 1.1.1.1 2000/03/10 16:32:15 engin Exp $
   2 //
   3 //  Copyright (c) 1994 by the University of Southern California
   4 //  All rights reserved.
   5 //
   6 //  Permission to use, copy, modify, and distribute this software and its
   7 //  documentation in source and binary forms for lawful non-commercial
   8 //  purposes and without fee is hereby granted, provided that the above
   9 //  copyright notice appear in all copies and that both the copyright
  10 //  notice and this permission notice appear in supporting documentation,
  11 //  and that any documentation, advertising materials, and other materials
  12 //  related to such distribution and use acknowledge that the software was
  13 //  developed by the University of Southern California, Information
  14 //  Sciences Institute. The name of the USC may not be used to endorse or
  15 //  promote products derived from this software without specific prior
  16 //  written permission.
  17 //
  18 //  THE UNIVERSITY OF SOUTHERN CALIFORNIA DOES NOT MAKE ANY
  19 //  REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY
  20 //  PURPOSE.  THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
  21 //  IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  22 //  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE,
  23 //  TITLE, AND NON-INFRINGEMENT.
  24 //
  25 //  IN NO EVENT SHALL USC, OR ANY OTHER CONTRIBUTOR BE LIABLE FOR ANY
  26 //  SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES, WHETHER IN CONTRACT, TORT,
  27 //  OR OTHER FORM OF ACTION, ARISING OUT OF OR IN CONNECTION WITH, THE USE
  28 //  OR PERFORMANCE OF THIS SOFTWARE.
  29 //
  30 //  Questions concerning this software should be directed to
  31 //  ratoolset@isi.edu.
  32 
  33 // Copyright (C) 1993 Cengiz Alaettinoglu <ca@cs.umd.edu>
  34 //
  35 // This program is free software; you can redistribute it and/or modify
  36 // it under the terms of the GNU General Public License as published by
  37 // the Free Software Foundation; either version 2, or (at your option)
  38 // any later version.
  39 //
  40 // This program is distributed in the hope that it will be useful,
  41 // but WITHOUT ANY WARRANTY; without even the implied warranty of
  42 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  43 // GNU General Public License for more details.
  44 //
  45 // You didn't receive a copy of the GNU General Public License along
  46 // with this program; so, write to the Free Software Foundation, Inc.,
  47 // 675 Mass Ave, Cambridge, MA 02139, USA.
  48 //
  49 // Author(s): Cengiz Alaettinoglu <ca@cs.umd.edu>
  50 //            Computer Science Department
  51 //            University of Maryland
  52 //            College Park, MD 20742
  53 
  54 #include "config.h"
  55 #ifdef DEBUG
  56 #include <cstdlib>
  57 #include "debug.hh"
  58 
  59 dbgstream dbg;
  60 
  61 dbgstream::dbgstream() { 
     /* [<][>][^][v][top][bottom][index][help] */
  62    level=0; 
  63    enabled=0; 
  64    // only DBG_ERR and DBG_INFO levels are initially enabled
  65    enable(DBG_ERR);
  66    enable(DBG_INFO);
  67 }
  68 
  69 void dbgstream::enable() {
     /* [<][>][^][v][top][bottom][index][help] */
  70    enabled |= (1 << level);
  71 }
  72 void dbgstream::disable() {
     /* [<][>][^][v][top][bottom][index][help] */
  73    enabled &= ~(1 << level);
  74 }
  75 void dbgstream::enable(int level) {
     /* [<][>][^][v][top][bottom][index][help] */
  76    enabled |= (1 << level);
  77 }
  78 void dbgstream::disable(int level) {
     /* [<][>][^][v][top][bottom][index][help] */
  79    enabled &= ~(1 << level);
  80 }
  81 int dbgstream::enabledp() {
     /* [<][>][^][v][top][bottom][index][help] */
  82    return (enabled & (1 << level));
  83 }
  84 int dbgstream::enabledp(int level) {
     /* [<][>][^][v][top][bottom][index][help] */
  85    return (enabled & (1 << level));
  86 }
  87 void Abort() {
     /* [<][>][^][v][top][bottom][index][help] */
  88    abort();
  89 }
  90 
  91 void copy_constructor(char *p) {
     /* [<][>][^][v][top][bottom][index][help] */
  92    cerr << "Copy constructor called for " << p << "\n";
  93 }
  94 
  95 #endif /* DEBUG */
  96 

/* [<][>][^][v][top][bottom][index][help] */