1 // Copyright (c) 2000  Max-Planck-Institute Saarbruecken (Germany).
2 // All rights reserved.
3 //
4 // This file is part of CGAL (www.cgal.org)
5 //
6 // $URL: https://github.com/CGAL/cgal/blob/v5.3/Nef_2/include/CGAL/Nef_2/debug.h $
7 // $Id: debug.h ce7d06d 2020-12-05T08:12:56+00:00 Giles Bathgate
8 // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
9 //
10 //
11 // Author(s)     : Michael Seel <seel@mpi-sb.mpg.de>
12 
13 #ifndef CGAL_NEF_2_DEBUG_H
14 #define CGAL_NEF_2_DEBUG_H
15 
16 #include <iostream>
17 
18 #ifdef NDEBUG
19 #undef CGAL_USE_TRACE
20 #endif
21 
22 #ifndef CGAL_NEF_DEBUG
23 #define CGAL_NEF_DEBUG 1
24 #endif
25 
26 #ifdef CGAL_USE_TRACE
27   static int debugthread=1;
28 #endif
29 
30 #undef CGAL_NEF_TRACE
31 #undef CGAL_NEF_TRACEN
32 #undef CGAL_NEF_TRACEV
33 #undef CGAL_NEF_CTRACE
34 #undef CGAL_NEF_CTRACEN
35 #undef CGAL_NEF_SETDTHREAD
36 
37 #ifdef CGAL_USE_TRACE
38 #define CGAL_NEF_SETDTHREAD(l) debugthread=l
39 #else
40 #define CGAL_NEF_SETDTHREAD(l)
41 #endif
42 
43 #ifdef CGAL_USE_TRACE
44 #define CGAL_NEF_TRACE(t) if((debugthread%CGAL_NEF_DEBUG)==0) \
45     { std::cerr<<" "<<t; }
46 #else
47 #define CGAL_NEF_TRACE(t) (static_cast<void>(0))
48 #endif
49 
50 #ifdef CGAL_USE_TRACE
51 #define CGAL_NEF_TRACEV(t) if((debugthread%CGAL_NEF_DEBUG)==0) \
52     { std::cerr<<" "<<#t<<" = "<<(t)<<std::endl; }
53 #else
54 #define CGAL_NEF_TRACEV(t) (static_cast<void>(0))
55 #endif
56 
57 #ifdef CGAL_USE_TRACE
58 #define CGAL_NEF_TRACEN(t) if((debugthread%CGAL_NEF_DEBUG)==0) \
59     { std::cerr<< " "<<t<<std::endl; }
60 #else
61 #define CGAL_NEF_TRACEN(t) (static_cast<void>(0))
62 #endif
63 
64 #ifdef CGAL_USE_TRACE
65 #define CGAL_NEF_CTRACE(b,t) if(b) {std::cerr<<" "<<t;} else {std::cerr<<" 0"}
66 #else
67 #define CGAL_NEF_CTRACE(b,t) (static_cast<void>(0))
68 #endif
69 
70 #ifdef CGAL_USE_TRACE
71 #define CGAL_NEF_CTRACEN(b,t) if(b){ std::cerr<<" "<<t<<"\n";} else {std::cerr<<" 0\n"}
72 #else
73 #define CGAL_NEF_CTRACEN(b,t) (static_cast<void>(0))
74 #endif
75 
76 #endif // CGAL_NEF_2_DEBUG_H
77