|
|
|
@ -28,10 +28,9 @@ char *readAdress(FILE *flot)
|
|
|
|
|
return adresse;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Precedence *loadPrec(int *tmax)
|
|
|
|
|
Precedence *loadPrec(int *tmax,int *tlog)
|
|
|
|
|
{
|
|
|
|
|
FILE *prec;
|
|
|
|
|
int i=0, (*tmax)=5;
|
|
|
|
|
Precedence *tabP, *s, pre;
|
|
|
|
|
prec=fopen("précédence.txt", "r");
|
|
|
|
|
if (prec == NULL)
|
|
|
|
@ -41,7 +40,7 @@ Precedence *loadPrec(int *tmax)
|
|
|
|
|
tabP = (Precedence *)malloc(tmax*sizeof(Precedence));
|
|
|
|
|
while(!feof(prec))
|
|
|
|
|
{
|
|
|
|
|
if(i==tmax)
|
|
|
|
|
if(*tlog==*tmax)
|
|
|
|
|
{
|
|
|
|
|
(*tmax)+=5;
|
|
|
|
|
s = (Precedence *)malloc((*tmax)*sizeof(Precedence));
|
|
|
|
@ -53,7 +52,7 @@ Precedence *loadPrec(int *tmax)
|
|
|
|
|
tabP = s;
|
|
|
|
|
}
|
|
|
|
|
fscanf("%s %s",p.travauxPrec, p.travauxSucc);
|
|
|
|
|
i++;
|
|
|
|
|
(*tlog)++;
|
|
|
|
|
}
|
|
|
|
|
fclose(prec);
|
|
|
|
|
}
|
|
|
|
@ -61,7 +60,8 @@ Precedence *loadPrec(int *tmax)
|
|
|
|
|
Tache **chargeTaches(Offre *tabTravaux[])
|
|
|
|
|
{
|
|
|
|
|
Tache *tabTache[8];
|
|
|
|
|
int i;
|
|
|
|
|
Precedence *prec;
|
|
|
|
|
int i, tmaxPrec=5, tlogPrec;
|
|
|
|
|
Tache *t;
|
|
|
|
|
for (i=0; i<tmaxTravaux; i++)
|
|
|
|
|
{
|
|
|
|
@ -75,9 +75,33 @@ Tache **chargeTaches(Offre *tabTravaux[])
|
|
|
|
|
t->tache = tabTravaux[i]->travaux;
|
|
|
|
|
t->duree = tabTravaux[i]->ldevis->duree;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
prec = loadPrec(&tmaxPrec, &tlogPrec);
|
|
|
|
|
|
|
|
|
|
t->nbPred = nombrePred(tabTravaux[i]->travaux, prec);
|
|
|
|
|
|
|
|
|
|
tabTache[i] = t;
|
|
|
|
|
}
|
|
|
|
|
return tabTache;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int nombrePred(char travaux[], Precedence prec[], int tlog)
|
|
|
|
|
{
|
|
|
|
|
int nbPred, i;
|
|
|
|
|
for (i=0; i<tlog; i++)
|
|
|
|
|
{
|
|
|
|
|
if (strcmp(travaux, prec[i]->travauxSucc)==0)
|
|
|
|
|
nbPred++;
|
|
|
|
|
}
|
|
|
|
|
return nbPred;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Liste lstSucc(char travaux[], Precedence prec[], int tlog)
|
|
|
|
|
{
|
|
|
|
|
Liste succ;
|
|
|
|
|
MaillonSucc *ms;
|
|
|
|
|
int i;
|
|
|
|
|
for (i=0; i<tlog; i++)
|
|
|
|
|
{
|
|
|
|
|
//Faire la liste
|
|
|
|
|
}
|
|
|
|
|
}
|