Diff for /imach/src/imach.c between versions 1.306 and 1.307

version 1.306, 2021/02/20 15:44:02 version 1.307, 2021/03/08 18:11:32
Line 1 Line 1
 /* $Id$  /* $Id$
   $State$    $State$
   $Log$    $Log$
     Revision 1.307  2021/03/08 18:11:32  brouard
     Summary: 0.99r22 fixed bug on result:
   
   Revision 1.306  2021/02/20 15:44:02  brouard    Revision 1.306  2021/02/20 15:44:02  brouard
   Summary: Version 0.99r21    Summary: Version 0.99r21
   
Line 9591  int decoderesult ( char resultline[], in Line 9594  int decoderesult ( char resultline[], in
   char stra[80], strb[80], strc[80], strd[80],stre[80];    char stra[80], strb[80], strc[80], strd[80],stre[80];
   
   removefirstspace(&resultline);    removefirstspace(&resultline);
   printf("decoderesult:%s\n",resultline);  
   
   if (strstr(resultline,"v") !=0){    if (strstr(resultline,"v") !=0){
     printf("Error. 'v' must be in upper case 'V' result: %s ",resultline);      printf("Error. 'v' must be in upper case 'V' result: %s ",resultline);
Line 9606  int decoderesult ( char resultline[], in Line 9608  int decoderesult ( char resultline[], in
     TKresult[nres]=0; /* Combination for the nresult and the model */      TKresult[nres]=0; /* Combination for the nresult and the model */
     return (0);      return (0);
   }    }
       
   if( j != cptcovs ){ /* Be careful if a variable is in a product but not single */    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);      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);      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);
Line 12417  Please run with mle=-1 to get a correct Line 12418  Please run with mle=-1 to get a correct
     }      }
             
     /* Results */      /* Results */
       endishere=0;
     nresult=0;      nresult=0;
     do{      do{
       if(!fgets(line, MAXLINE, ficpar)){        if(!fgets(line, MAXLINE, ficpar)){
         endishere=1;          endishere=1;
         parameterline=14;  
       }else if (line[0] == '#') {        }else if (line[0] == '#') {
         /* If line starts with a # it is a comment */          /* If line starts with a # it is a comment */
         numlinepar++;          numlinepar++;
Line 12434  Please run with mle=-1 to get a correct Line 12435  Please run with mle=-1 to get a correct
         parameterline=11;          parameterline=11;
       else if(sscanf(line,"prevbackcast=%[^\n]\n",modeltemp))        else if(sscanf(line,"prevbackcast=%[^\n]\n",modeltemp))
         parameterline=12;          parameterline=12;
       else if(sscanf(line,"result:%[^\n]\n",modeltemp))        else if(sscanf(line,"result:%[^\n]\n",modeltemp)){
         parameterline=13;          parameterline=13;
         }
       else{        else{
         parameterline=14;          parameterline=14;
       }        }
Line 12487  Please run with mle=-1 to get a correct Line 12489  Please run with mle=-1 to get a correct
         }          }
         break;          break;
       case 13:        case 13:
         if((num_filled=sscanf(line,"result:%[^\n]\n",resultline)) !=EOF){          num_filled=sscanf(line,"result:%[^\n]\n",resultline);
           if (num_filled == 0){          nresult++; /* Sum of resultlines */
             resultline[0]='\0';          printf("Result %d: result:%s\n",nresult, resultline);
             printf("Warning %d: no result line! It should be at minimum 'result: V2=0 V1=1 or result:.\n%s\n", num_filled, line);          if(nresult > MAXRESULTLINES){
             fprintf(ficlog,"Warning %d: no result line! It should be at minimum 'result: V2=0 V1=1 or result:.\n%s\n", num_filled, line);            printf("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);
             break;            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);
           } else if (num_filled != 1){            goto end;
             printf("ERROR %d: result line! It should be at minimum 'result: V2=0 V1=1 or result:.' %s\n",num_filled, line);  
             fprintf(ficlog,"ERROR %d: result line! It should be at minimum 'result: V2=0 V1=1 or result:.' %s\n",num_filled, line);  
           }  
           nresult++; /* Sum of resultlines */  
           printf("Result %d: result=%s\n",nresult, resultline);  
           if(nresult > MAXRESULTLINES){  
             printf("ERROR: Current version of IMaCh limits the number of resultlines to %d, you used %d\n",MAXRESULTLINES,nresult);  
             fprintf(ficlog,"ERROR: Current version of IMaCh limits the number of resultlines to %d, you used %d\n",MAXRESULTLINES,nresult);  
             goto end;  
           }  
           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);  
           break;  
         case 14:  
           printf("Error: Unknown command '%s'\n",line);  
           fprintf(ficlog,"Error: Unknown command '%s'\n",line);  
           if(ncovmodel >=2 && nresult==0 ){  
             printf("ERROR: no result lines! It should be at minimum 'result: V2=0 V1=1 or result:.' %s\n",line);  
             fprintf(ficlog,"ERROR: no result lines! It should be at minimum 'result: V2=0 V1=1 or result:.' %s\n",line);  
           }  
           /* goto end; */  
           break;  
         default:  
           nresult=1;  
           decoderesult(".",nresult ); /* No covariate */  
         }          }
           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);
           break;
         case 14:
           printf("Error: Unknown command '%s'\n",line);
           fprintf(ficlog,"Error: Unknown command '%s'\n",line);
           if(ncovmodel >=2 && nresult==0 ){
             printf("ERROR: no result lines! It should be at minimum 'result: V2=0 V1=1 or result:.' %s\n",line);
             fprintf(ficlog,"ERROR: no result lines! It should be at minimum 'result: V2=0 V1=1 or result:.' %s\n",line);
           }
           /* goto end; */
           break;
         default:
           nresult=1;
           decoderesult(".",nresult ); /* No covariate */
       } /* End switch parameterline */        } /* End switch parameterline */
         parameterline=0;
     }while(endishere==0); /* End do */      }while(endishere==0); /* End do */
           
     /* freqsummary(fileres, agemin, agemax, s, agev, nlstate, imx,Tvaraff,nbcode, ncodemax,mint,anint); */      /* freqsummary(fileres, agemin, agemax, s, agev, nlstate, imx,Tvaraff,nbcode, ncodemax,mint,anint); */

Removed from v.1.306  
changed lines
  Added in v.1.307


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>