forked from keenerd/quickblob
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdebugstuff.c
65 lines (58 loc) · 1.35 KB
/
debugstuff.c
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void show(struct blob* b)
{
printf("%i:%i (%i, %i) %.2f, %.2f %X\n", b->x1, b->x2, b->size, b->color, b->center_x, b->center_y, b);
}
void show_sib(struct blob* b)
{
if (b == NULL)
{printf("NULL\n"); return;}
printf("%X %i:%i @%i (%i) %X %X\n", b, b->x1, b->x2, b->y, b->size, b->sib_p, b->sib_n);
}
void show_link(struct blob* b)
{
if (b == NULL)
{printf("NULL\n"); return;}
printf("%X (%X %X) (%X %X)\n", b, b->prev, b->next, b->sib_p, b->sib_n);
}
void show_status(struct blob* bl_start, struct stream_state* stream)
{
struct blob* b;
int i=0, j=0;
printf("stream %i %i %i\n", stream->x, stream->y, stream->wrap);
b = bl_start;
while (b)
{
if (b->size == 0)
{i++;}
else
{j++;}
b = b->next;
}
printf("blobs %i %i %i\n", i, j, i+j);
}
void show_blobs(struct blob* bl_start)
{
struct blob* b;
b = bl_start;
while (b)
{
if (b->x1 != -1 && b->size != 0)
{show_sib(b);}
b = b->next;
}
}
void show_dead_sibs(struct blob* bl_start)
{
struct blob* b;
b = bl_start;
while (b)
{
if ((b->sib_p != NULL && b->sib_p->size == 0) ||
(b->sib_n != NULL && b->sib_n->size == 0))
{printf("DEAD %X\n", b);}
b = b->next;
}
}