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
| void GenererLesRegles2fr1en(FILE*pfOut, MotCompact const *pcLeft, MotCompact const *pcRight,TableHachageMot *DblTableHash1fr,TableHachageMot *DblTableHash2fr,TableHachageMot *DblTableHash1en,TableHachageMot *DblTableHash2en)
{
int sortie=0;
double imc=0;
size_t iLigneLeft = 0;
size_t iLigneRight = 0;
int const * pcCoordLeft = ligne_GetPremierC(pcLeft, &iLigneLeft);
int const * pcCoordRight = ligne_GetPremierC(pcRight, &iLigneRight);
while(pcCoordLeft!=NULL && (!sortie) && pcCoordRight!=NULL)
{
{
int ligneRight = *pcCoordRight;
while(pcCoordLeft!=NULL && (*pcCoordLeft)>ligneRight)
pcCoordLeft = ligne_GetNextC(pcLeft, &iLigneLeft);
}
if(pcCoordLeft==NULL)
break;
{
int ligneLeft = *pcCoordLeft;
while(pcCoordRight!=NULL && (!sortie)&& ligneLeft<(*pcCoordRight))
pcCoordRight = ligne_GetNextC(pcRight, &iLigneRight);
}
if(pcCoordRight==NULL)
break;
if(*pcCoordLeft == *pcCoordRight)
{
char const*Left=GetMotCompact(pcLeft);
char const*Right=GetMotCompact(pcRight);
ChainonMot *PcL=RechercheDoubleHashEx(DblTableHash2fr, Left);
ChainonMot *PcR=RechercheDoubleHashEx(DblTableHash1en, Right);
fprintf(pfOut,"%s",GetMotCompact(pcLeft));
fprintf(pfOut,"->");
fprintf(pfOut,"%s\n",GetMotCompact(pcRight));
imc=info_mut_cond(PcL,PcR,DblTableHash1fr);
fprintf(pfOut,"IMC = ");
fprintf(pfOut,"%e \n",imc);
sortie=1;
pcCoordLeft = ligne_GetNextC(pcLeft, &iLigneLeft);
pcCoordRight = ligne_GetNextC(pcRight, &iLigneRight);
}
}
} |
Partager