--- imach/src/imach.c 2021/05/20 12:39:14 1.309 +++ imach/src/imach.c 2022/03/17 08:45:53 1.310 @@ -1,6 +1,12 @@ -/* $Id: imach.c,v 1.309 2021/05/20 12:39:14 brouard Exp $ +/* $Id: imach.c,v 1.310 2022/03/17 08:45:53 brouard Exp $ $State: Exp $ $Log: imach.c,v $ + Revision 1.310 2022/03/17 08:45:53 brouard + Summary: 99r25 + + Improving detection of errors: result lines should be compatible with + the model. + Revision 1.309 2021/05/20 12:39:14 brouard Summary: Version 0.99r24 @@ -1153,12 +1159,12 @@ typedef struct { #define ODIRSEPARATOR '\\' #endif -/* $Id: imach.c,v 1.309 2021/05/20 12:39:14 brouard Exp $ */ +/* $Id: imach.c,v 1.310 2022/03/17 08:45:53 brouard Exp $ */ /* $State: Exp $ */ #include "version.h" char version[]=__IMACH_VERSION__; char copyright[]="March 2021,INED-EUROREVES-Institut de longevite-Japan Society for the Promotion of Science (Grant-in-Aid for Scientific Research 25293121), Intel Software 2015-2020, Nihon University 2021, INED 2000-2021"; -char fullversion[]="$Revision: 1.309 $ $Date: 2021/05/20 12:39:14 $"; +char fullversion[]="$Revision: 1.310 $ $Date: 2022/03/17 08:45:53 $"; char strstart[80]; char optionfilext[10], optionfilefiname[FILENAMELENGTH]; int erreur=0, nberr=0, nbwarn=0; /* Error number, number of errors number of warnings */ @@ -1574,7 +1580,7 @@ char *cutl(char *blocc, char *alocc, cha { /* cuts string in into blocc and alocc where blocc ends before FIRST occurence of char 'occ' and alocc starts after first occurence of char 'occ' : ex cutv(blocc,alocc,"abcdef2ghi2j",'2') - gives blocc="abcdef" and alocc="ghi2j". + gives alocc="abcdef" and blocc="ghi2j". If occ is not found blocc is null and alocc is equal to in. Returns blocc */ char *s, *t; @@ -9619,13 +9625,13 @@ int decoderesult ( char resultline[], in return (0); } if( j != cptcovs ){ /* Be careful if a variable is in a product but not single */ - printf("ERROR: the number of variable in the resultline, %d, differs from the number of variable used in the model line, %d.\n",j, cptcovs); - fprintf(ficlog,"ERROR: the number of variable in the resultline, %d, differs from the number of variable used in the model line, %d.\n",j, cptcovs); + printf("ERROR: the number of variables in the resultline, %d, differs from the number of variables used in the model line, %d.\n",j, cptcovs); + fprintf(ficlog,"ERROR: the number of variables in the resultline, %d, differs from the number of variables used in the model line, %d.\n",j, cptcovs); } for(k=1; k<=j;k++){ /* Loop on any covariate of the result line */ if(nbocc(resultsav,'=') >1){ cutl(stra,strb,resultsav,' '); /* keeps in strb after the first ' ' - resultsav= V4=1 V5=25.1 V3=0 strb=V3=0 stra= V4=1 V5=25.1 */ + resultsav= V4=1 V5=25.1 V3=0 stra= V5=25.1 V3=0 strb= V4=1 */ cutl(strc,strd,strb,'='); /* strb:V4=1 strc=1 strd=V4 */ }else cutl(strc,strd,resultsav,'='); @@ -9650,7 +9656,9 @@ int decoderesult ( char resultline[], in } } if(match == 0){ - printf("Error in result line: %d value missing; result: %s, model=%s\n",k1, resultline, model); + printf("Error in result line: V%d is missing in result: %s according to model=%s\n",k1, resultline, model); + fprintf(ficlog,"Error in result line: V%d is missing in result: %s according to model=%s\n",k1, resultline, model); + return 1; } } } @@ -9667,8 +9675,12 @@ int decoderesult ( char resultline[], in } if(match == 0){ printf("Error in result line: %d value missing; result: %s, model=%s\n",k1, resultline, model); + fprintf(ficlog,"Error in result line: %d value missing; result: %s, model=%s\n",k1, resultline, model); + return 1; }else if(match > 1){ printf("Error in result line: %d doubled; result: %s, model=%s\n",k2, resultline, model); + fprintf(ficlog,"Error in result line: %d doubled; result: %s, model=%s\n",k2, resultline, model); + return 1; } } @@ -12509,10 +12521,12 @@ Please run with mle=-1 to get a correct fprintf(ficlog,"ERROR: Current version of IMaCh limits the number of resultlines to %d, you used %d\nYou can use the 'r' parameter file '%s' which uses option mle=0 to get other results. ",MAXRESULTLINES,nresult,rfileres); goto end; } - decoderesult(resultline, nresult); /* Fills TKresult[nresult] combination and Tresult[nresult][k4+1] combination values */ + if(!decoderesult(resultline, nresult)){ /* Fills TKresult[nresult] combination and Tresult[nresult][k4+1] combination values */ fprintf(ficparo,"result: %s\n",resultline); fprintf(ficres,"result: %s\n",resultline); fprintf(ficlog,"result: %s\n",resultline); + } else + goto end; break; case 14: printf("Error: Unknown command '%s'\n",line);