summaryrefslogtreecommitdiff
path: root/src/slices.c
blob: edae571aef6d9bfe4c3e43175b2f4a2e376dbc92 (plain)
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
#include <string.h>
#include "slices.h"

slice_t *sliceNew(address_t begin, address_t end, sliceStatus_t status, slice_t *next) {
	slice_t *s = malloc(1*sizeof(slice_t));
	if (s!=NULL) {
		s->begin=begin;
		s->end=end;
		s->status=status;
		s->next=next;
	}	

	return s;
}

int sliceSplit(slice_t *slice, address_t splitAt, sliceStatus_t statusBefore, sliceStatus_t statusAt, sliceStatus_t statusAfter) {
	return 1;
}

slices_t *slicesNew() {
	slices_t *ss = malloc(1*sizeof(slices_t));
	if (ss!=NULL) {
		ss->count=0;
		ss->first=NULL;
		ss->last=NULL;
	}

	return ss;
}

void slicesAppend(slices_t *slices, slice_t *slice) {

}

slice_t *slicesFindLargest(slices_t *slices, sliceStatus_t status) {
	return NULL;
}

char *slicesDump(slices_t *slices, int charCount, address_t begin, address_t end) {
	slice_t *curr = slices->first;
	address_t sb,se, blockSize=(end-begin)/(charCount+1);
	char *dump=malloc(1*charCount+1);
	memset(dump, ' ', charCount);

	while (curr != NULL) {
		sb=curr->begin;
		// TODO : boucle pour dessiner les caractères correspondant selon le type de zone. Attention aux cas ou 1 caractère contient la frontière de plusieurs zones (ne pas toujours écraser avec la dernière valeur)

		curr=curr->next;
	}

	return dump;
}