ARB
Main Page
Namespaces
Classes
Files
File List
File Members
AISC_COM
C
trace.h
Go to the documentation of this file.
1
// =============================================================== //
2
// //
3
// File : trace.h //
4
// Purpose : //
5
// //
6
// Coded by Ralf Westram (coder@reallysoft.de) in May 2007 //
7
// Institute of Microbiology (Technical University Munich) //
8
// http://www.arb-home.de/ //
9
// //
10
// =============================================================== //
11
#ifndef TRACE_H
12
#define TRACE_H
13
14
#if defined(DEBUG)
15
// #define DUMP_COMMUNICATION
16
#endif // DEBUG
17
18
// --------------------------------------------------------------------------------
19
20
#if defined(DUMP_COMMUNICATION)
21
22
inline
void
aisc_dump_hex(
const
char
*
title
,
const
char
*
data
,
int
datasize) {
23
const
unsigned
char
*
udata
= (
const
unsigned
char
*)data;
24
int
d;
25
26
fprintf(stderr,
"%s"
, title);
27
for
(d = 0; d<datasize; d++) {
28
fprintf(stderr,
"%02X"
, udata[d]);
29
}
30
fprintf(stderr,
"\n"
);
31
}
32
33
inline
void
aisc_dump_int(
const
char
*where,
const
char
*varname,
int
var) {
34
fprintf(stderr,
"AISC_DUMP: %s: int %s=%i "
, where, varname, var);
35
aisc_dump_hex(
"Hex: "
, (
const
char
*)&var,
sizeof
(var));
36
}
37
inline
void
aisc_dump_long(
const
char
*where,
const
char
*varname,
long
var) {
38
fprintf(stderr,
"AISC_DUMP: %s: long %s=%li "
, where, varname, var);
39
aisc_dump_hex(
"Hex: "
, (
const
char
*)&var,
sizeof
(var));
40
}
41
inline
void
aisc_dump_double(
const
char
*where,
const
char
*varname,
double
var) {
42
fprintf(stderr,
"AISC_DUMP: %s: double %s=%f "
, where, varname, (
float
)var);
43
aisc_dump_hex(
"Hex: "
, (
const
char
*)&var,
sizeof
(var));
44
}
45
inline
void
aisc_dump_charPtr(
const
char
*where,
const
char
*varname,
const
char
*var) {
46
fprintf(stderr,
"AISC_DUMP: %s: cPtr %s='%s' "
, where, varname, var);
47
aisc_dump_hex(
"Hex: "
, var, strlen(var)+1);
48
}
49
inline
void
aisc_dump_voidPtr2(
const
char
*where,
const
char
*varname,
void
*var) {
50
fprintf(stderr,
"AISC_DUMP: %s: ptr %s=%p\n"
, where, varname, var);
51
}
52
53
#define aisc_dump_voidPtr(w, n, v) aisc_dump_voidPtr2(w, n, (void*)v)
54
#define AISC_DUMP(where, type, var) aisc_dump_##type(#where, #var, var)
55
#define AISC_DUMP_SEP() fprintf(stderr, "-----------------------------\n")
56
57
#else
58
#define AISC_DUMP(where, type, var)
59
#define AISC_DUMP_SEP()
60
#endif // DUMP_COMMUNICATION
61
62
// --------------------------------------------------------------------------------
63
64
#else
65
#error trace.h included twice
66
#endif // TRACE_H
67
udata
const char * udata() const
Definition:
probe_tree.h:46
title
const char * title
Definition:
readseq.c:22
aisc_hash_node::data
long data
Definition:
struct_man.c:31
Generated by
1.8.8