-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug-utilities.h
More file actions
45 lines (39 loc) · 785 Bytes
/
debug-utilities.h
File metadata and controls
45 lines (39 loc) · 785 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef DEBUGUTILITIES_H_
#define DEBUGUTILITIES_H_
enum {PRINT_CHARACTER, PRINT_DECIMAL};
#ifdef LOG_ENABLED
#if (LOG_ENABLED >= 3)
#include <ctype.h> //for isprint
#include <stdio.h>
/// //DY : FIX_ME : FOR DEBUG PURPOSE - delete later
static void printBuffer(char* buf,unsigned int len,int type)
{
unsigned int i = 0;
printf("--->");
for ( i=0; i<len ;i++ )
{
if ( type == PRINT_CHARACTER )
{
if ( isprint(buf[i]) )
{
printf("%c",buf[i]);
}
else
{
printf("(%d)",buf[i]);
}
}
else if ( type == PRINT_DECIMAL )
{
printf("(%d)",buf[i]);
}
}
printf("<---\n");
}
#else
#define printBuffer(...)
#endif
#else
#define printBuffer(...)
#endif //LOG_ENABLED
#endif /*DEBUGUTILITIES_H_*/