diff --git a/Makefile b/Makefile index 038c985..df69feb 100755 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ LFLAGS= all: bin/colloscope test: bin/colloscope - bin/colloscope -v S3-creneaux.txt 31 S3-colleurs.txt 16 7 15 3000 output-S3.csv 3 6 + bin/colloscope -v S3-creneaux.txt 31 S3-colleurs.txt 16 7 15 1000 output-S3.csv 3 6 mem: bin/ valgrind --leak-check=full ./bin/colloscope -v S3-creneaux.txt 31 S3-colleurs.txt 16 7 15 100 output-S3.csv 3 6 diff --git a/S3-tds.txt b/S3-tds.txt index b4f5449..55ccace 100755 --- a/S3-tds.txt +++ b/S3-tds.txt @@ -1,23 +1,27 @@ 14 23 4 2024 -A +T-3-1 + 1 2 3 + 12 22 4 2024 -A +T-1-1 + 1 2 3 + 14 24 4 2024 -A +T-1-1 + 1 2 3 + 13 22 4 2024 -A +T-1-1 + 1 2 3 diff --git a/src/structure.c b/src/structure.c index aa47e31..9f83331 100755 --- a/src/structure.c +++ b/src/structure.c @@ -522,6 +522,10 @@ void import_tds(creneau* edt, int len_edt, int len_oneweek, char* filename) { char method; int buffer = 0; + int buffer2 = 0; + + int ban_cooldown = 0; + int ban_init = 0 ; date d; @@ -551,6 +555,25 @@ void import_tds(creneau* edt, int len_edt, int len_oneweek, char* filename) { k++; os = 1; } + } else if(method == 'T') { + int k = 0; + int os = 1; + while(edtptr + k*len_oneweek >= 0 && edtptr + k*len_oneweek < len_edt) { + //info("[%d, %d]", buffer, edtptr + k*len_oneweek); + //usleep(1000000); + if((k+ban_init)%ban_cooldown == 0) { + edt[edtptr + k*len_oneweek].allow_grps[buffer-1] = false; + } + while(equal_d(edt[edtptr + k*len_oneweek].date, edt[edtptr + k*len_oneweek + os].date)) { + //info("[%d, %d]", buffer, edtptr + k*len_oneweek + os); + if((k+ban_init)%ban_cooldown == 0) { + edt[edtptr + k*len_oneweek + os].allow_grps[buffer-1] = false; + } + os++; + } + k++; + os = 1; + } } else { fatal("Unknown method %d. Check if the method used is valid, or ask a dev to fix it ", method); exit(1); @@ -574,8 +597,21 @@ void import_tds(creneau* edt, int len_edt, int len_oneweek, char* filename) { } else if((int)(c) >= 48 && (int)(c) <= 57) { buffer *= 10; buffer += (int)(c) - 48; - } else if(current == 1) { + } else if(current == 1) { // method method = c; + c = fgetc(ptr); + while(c != EOF && c != '\n') { + if((int)(c) >= 48 && (int)(c) <= 57) { + buffer2 *= 10; + buffer2 += (int)(c) - 48 ; + } else { + ban_cooldown = buffer2; + buffer2 = 0; + } + c = fgetc(ptr); + } + ban_init = buffer2; + buffer2 = 0; } c = fgetc(ptr); }