Rev 18 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | pmbaty | 1 | #include "harness/trace.h" |
2 | |||
3 | #include <stdarg.h> |
||
4 | #include <stddef.h> |
||
5 | #include <stdio.h> |
||
6 | #include <sys/types.h> |
||
7 | |||
8 | int harness_debug_level = 4; |
||
9 | |||
10 | void debug_printf(const char* fmt, const char* fn, const char* fmt2, ...) { |
||
11 | va_list ap; |
||
12 | |||
13 | printf(fmt, fn); |
||
14 | |||
15 | va_start(ap, fmt2); |
||
16 | vprintf(fmt2, ap); |
||
17 | va_end(ap); |
||
18 | |||
19 | puts("\033[0m"); |
||
20 | } |
||
21 | |||
22 | void debug_print_vector3(const char* fmt, const char* fn, char* msg, br_vector3* v) { |
||
23 | printf(fmt, fn); |
||
24 | printf("%s %f, %f, %f\n", msg, v->v[0], v->v[1], v->v[2]); |
||
25 | puts("\033[0m"); |
||
26 | } |
||
27 | |||
28 | void debug_print_matrix34(const char* fmt, const char* fn, char* msg, br_matrix34* m) { |
||
29 | printf(fmt, fn); |
||
30 | printf("matrix34 \"%s\"\n", msg); |
||
31 | for (int i = 0; i < 4; i++) { |
||
32 | printf(" %f, %f, %f\n", m->m[i][0], m->m[i][1], m->m[i][2]); |
||
33 | } |
||
34 | puts("\033[0m"); |
||
35 | } |
||
36 | |||
37 | void debug_print_matrix4(const char* fmt, const char* fn, char* msg, br_matrix4* m) { |
||
38 | printf(fmt, fn); |
||
39 | printf("matrix34 \"%s\"\n", msg); |
||
40 | for (int i = 0; i < 4; i++) { |
||
41 | printf(" %f, %f, %f, %f\n", m->m[i][0], m->m[i][1], m->m[i][2], m->m[i][3]); |
||
42 | } |
||
43 | puts("\033[0m"); |
||
44 | } |
||
45 | |||
46 | // int count_open_fds(void) { |
||
47 | // DIR* dp = opendir("/dev/fd/"); |
||
48 | // struct dirent* de; |
||
49 | // int count = -3; // '.', '..', dp |
||
50 | |||
51 | // if (dp == NULL) |
||
52 | // return -1; |
||
53 | |||
54 | // while ((de = readdir(dp)) != NULL) |
||
55 | // count++; |
||
56 | |||
57 | // (void)closedir(dp); |
||
58 | |||
59 | // return count; |
||
60 | // } |