from 2,[0=0,2=0]
to   2,[0=1,2=0]

remaining factor is 1 range 7



from 0,[]
to   3,[0=0,1=0,2=0]



ok = 1
for(fromcondition = 0, fromcondition < fromconditions; fromcondition++) {
  if !((condition[fromcondition] == states[fromcondition]) || (condition[fromcondition] == -1))   ok = 0;
}

if (ok == 1) link();



void FSMlink (FSM_t * this, int * maxNameLen, int * conditions) {

       int i,j;
       int * stateItter;
       int entries;
       int ok;

       stateItter = malloc( sizeof(int)*this->factors );
       entries = 1;       
       
       for (i = 0; i < this->factors; i++ )  entries *= this->states[i];
       
       printf("//------------\n  //  ");
       for(i = this->factors - 1; i >= 0; i--) {
         if (this->states[i] > 1) printf ("  %s  ,", this->factorNames[i]);  
       }
       printf("\n");
              
       printf("stateEntry_t stateTable[] = {   \n");
       
       for (i = 0; i < entries; i++) {
       
         fromIndex(this->states, this->factors, stateItter, i);
                 
         printf("  { %3d, {", i); 
         ok = 1;
         for(j = this->factors - 1; j >= 0; j--) {
           if (this->states[j] > 1) {
             printf (" %s ", this->stateNames[j][stateItter[j]]);  
                
             postPad(this->stateNames[j][stateItter[j]], maxNameLen[j]);
             if (j != 0)printf (",");  
                          
             if !((conditions[j] == states[stateItter[j]]) || (conditions[j] == -1)) ok = 0;
              
           }           
         }    
         
         if (ok == 1)     printf(" /* match */"); 
         
         if (i+1 == entries) { printf("}}   /*   index: %u   */",i);   
         } else {              printf("}},  /*   index: %u   */",i); 
         }
         
           printf("\n");
       }
       printf("};\n");
       free(stateItter);
   
}
