Пример #1
0
/*
 * Release all nodes in the given set back to the free pool.
 */
void
Escher_ClearSet( Escher_ObjectSet_s * set )
{
  if ( set->head != 0 ) {                                    /* empty set  */
    Escher_SetElement_s * slot;
    for ( slot = set->head; ( slot->next != 0 ); slot = slot->next ); /* Find end.  */
    slot->next = node1_FreeList.head;     /* Tie string to free list.      */
    node1_FreeList.head = set->head;      /* Point free list to head.      */
    Escher_InitSet( set );                /* Zero set out.  */
  }
}
Пример #2
0
/*
 * Domain Function:  setup
 */
void
sudoku_setup( void )
{
    sudoku_SEQUENCE * sequence;
  /* SELECT any sequence FROM INSTANCES OF SEQUENCE */
  sequence = (sudoku_SEQUENCE *) Escher_SetGetAny( &pG_sudoku_SEQUENCE_extent.active );
  /* IF ( empty sequence ) */
  if ( ( 0 == sequence ) ) {
    i_t i;sudoku_DIGIT * digit;Escher_ObjectSet_s rows_space; Escher_ObjectSet_s * rows = &rows_space; /* rows (ROW) */sudoku_ROW * row;Escher_ObjectSet_s cells_space; Escher_ObjectSet_s * cells = &cells_space; /* cells (CELL) */sudoku_CELL * cell;
    Escher_InitSet( rows );Escher_InitSet( cells );
    /* ASSIGN i = NVS::space_used() */
    i = NVS_space_used();
    /* IF ( ( i < 100 ) ) */
    if ( ( i < 100 ) ) {
      /* ASSIGN i = NVS::format() */
      i = NVS_format();
      /* IF ( ( i != 0 ) ) */
      if ( ( i != 0 ) ) {
        /* LOG::LogFailure( message:'Error formatting the NVS.' ) */
        LOG_LogFailure( "Error formatting the NVS." );
      }
    }
    /* LOG::LogInfo( message:'Did not find any PEI data, initializing NVS' ) */
    LOG_LogInfo( "Did not find any PEI data, initializing NVS" );
    /* ASSIGN i = NVS::version(first:1, second:2) */
    i = NVS_version( 1, 2 );
    /* ASSIGN i = NVS::checksum(first:1, second:2) */
    i = NVS_checksum( 1, 2 );
    /* ASSIGN i = 9 */
    i = 9;
    /* WHILE ( ( 0 < i ) ) */
    while ( ( 0 < i ) ) {
      sudoku_DIGIT * digit;
      /* CREATE OBJECT INSTANCE digit OF DIGIT */
      digit = (sudoku_DIGIT *) Escher_CreateInstance( sudoku_DOMAIN_ID, sudoku_DIGIT_CLASS_NUMBER );
      /* ASSIGN digit.value = i */
      digit->value = i;
      /* ASSIGN i = ( i - 1 ) */
      i = ( i - 1 );
    }
    /* CREATE OBJECT INSTANCE digit OF DIGIT */
    digit = (sudoku_DIGIT *) Escher_CreateInstance( sudoku_DOMAIN_ID, sudoku_DIGIT_CLASS_NUMBER );
    /* ASSIGN digit.value = 0 */
    digit->value = 0;
    /* ASSIGN i = 9 */
    i = 9;
    /* WHILE ( ( 0 < i ) ) */
    while ( ( 0 < i ) ) {
      sudoku_ROW * row;sudoku_COLUMN * column;sudoku_BOX * box;
      /* CREATE OBJECT INSTANCE sequence OF SEQUENCE */
      sequence = (sudoku_SEQUENCE *) Escher_CreateInstance( sudoku_DOMAIN_ID, sudoku_SEQUENCE_CLASS_NUMBER );
      /* ASSIGN sequence.solved = FALSE */
      sequence->solved = FALSE;
      /* ASSIGN sequence.requests = 0 */
      sequence->requests = 0;
      /* CREATE OBJECT INSTANCE row OF ROW */
      row = (sudoku_ROW *) Escher_CreateInstance( sudoku_DOMAIN_ID, sudoku_ROW_CLASS_NUMBER );
      /* ASSIGN row.number = i */
      row->number = i;
      /* RELATE row TO sequence ACROSS R1 */
      sudoku_ROW_R1_Link( sequence, row );
      /* CREATE OBJECT INSTANCE sequence OF SEQUENCE */
      sequence = (sudoku_SEQUENCE *) Escher_CreateInstance( sudoku_DOMAIN_ID, sudoku_SEQUENCE_CLASS_NUMBER );
      /* ASSIGN sequence.solved = FALSE */
      sequence->solved = FALSE;
      /* ASSIGN sequence.requests = 0 */
      sequence->requests = 0;
      /* CREATE OBJECT INSTANCE column OF COLUMN */
      column = (sudoku_COLUMN *) Escher_CreateInstance( sudoku_DOMAIN_ID, sudoku_COLUMN_CLASS_NUMBER );
      /* ASSIGN column.number = i */
      column->number = i;
      /* RELATE column TO sequence ACROSS R1 */
      sudoku_COLUMN_R1_Link( sequence, column );
      /* CREATE OBJECT INSTANCE sequence OF SEQUENCE */
      sequence = (sudoku_SEQUENCE *) Escher_CreateInstance( sudoku_DOMAIN_ID, sudoku_SEQUENCE_CLASS_NUMBER );
      /* ASSIGN sequence.solved = FALSE */
      sequence->solved = FALSE;
      /* ASSIGN sequence.requests = 0 */
      sequence->requests = 0;
      /* CREATE OBJECT INSTANCE box OF BOX */
      box = (sudoku_BOX *) Escher_CreateInstance( sudoku_DOMAIN_ID, sudoku_BOX_CLASS_NUMBER );
      /* ASSIGN box.number = i */
      box->number = i;
      /* RELATE box TO sequence ACROSS R1 */
      sudoku_BOX_R1_Link( sequence, box );
      /* ASSIGN i = ( i - 1 ) */
      i = ( i - 1 );
    }
    /* SELECT many rows FROM INSTANCES OF ROW */
    Escher_CopySet( rows, &pG_sudoku_ROW_extent.active );
    /* FOR EACH row IN rows */
    { Escher_Iterator_s iter1;
  sudoku_ROW * sudoku_ROWiter1;
  Escher_IteratorReset( &iter1, rows );
  while ( (sudoku_ROWiter1 = (sudoku_ROW *)Escher_IteratorNext( &iter1 )) != 0 ) {
    row = sudoku_ROWiter1; {
      Escher_ObjectSet_s columns_space; Escher_ObjectSet_s * columns = &columns_space; /* columns (COLUMN) */sudoku_COLUMN * column;
      Escher_InitSet( columns );
      /* SELECT many columns FROM INSTANCES OF COLUMN */
      Escher_CopySet( columns, &pG_sudoku_COLUMN_extent.active );
      /* FOR EACH column IN columns */
      { Escher_Iterator_s iter3;
  sudoku_COLUMN * sudoku_COLUMNiter3;
  Escher_IteratorReset( &iter3, columns );
  while ( (sudoku_COLUMNiter3 = (sudoku_COLUMN *)Escher_IteratorNext( &iter3 )) != 0 ) {
    column = sudoku_COLUMNiter3; {
        sudoku_CELL * cell;Escher_ObjectSet_s digits_space; Escher_ObjectSet_s * digits = &digits_space; /* digit (DIGIT) */
        Escher_InitSet( digits );
        /* CREATE OBJECT INSTANCE cell OF CELL */
        cell = (sudoku_CELL *) Escher_CreateInstance( sudoku_DOMAIN_ID, sudoku_CELL_CLASS_NUMBER );
        /* SELECT any digit FROM INSTANCES OF DIGIT WHERE ( SELECTED.value == 0 ) */
        digit = 0;
{ sudoku_DIGIT * selected;
  Escher_Iterator_s iter30_DIGIT;
  Escher_IteratorReset( &iter30_DIGIT, &pG_sudoku_DIGIT_extent.active );
  while ( (selected = (sudoku_DIGIT *) Escher_IteratorNext( &iter30_DIGIT )) != 0 ) {
    if ( ( selected->value == 0 ) ) {
      digit = selected;
      break;
    }
  }
}
        /* RELATE cell TO digit ACROSS R9 */
        sudoku_CELL_R9_Link( digit, cell );
        /* RELATE cell TO row ACROSS R2 */
        sudoku_CELL_R2_Link( row, cell );
        /* RELATE cell TO column ACROSS R3 */
        sudoku_CELL_R3_Link( column, cell );
        /* SELECT many digits FROM INSTANCES OF DIGIT WHERE ( SELECTED.value != 0 ) */
        Escher_ClearSet( digits );
{ sudoku_DIGIT * selected;
  Escher_Iterator_s iter31_DIGIT;
  Escher_IteratorReset( &iter31_DIGIT, &pG_sudoku_DIGIT_extent.active );
  while ( (selected = (sudoku_DIGIT *) Escher_IteratorNext( &iter31_DIGIT )) != 0 ) {
    if ( ( selected->value != 0 ) ) {
      Escher_SetInsertElement( digits, selected );
    }
  }
}
        /* FOR EACH digit IN digits */
        { Escher_Iterator_s iter4;
  sudoku_DIGIT * sudoku_DIGITiter4;
  Escher_IteratorReset( &iter4, digits );
  while ( (sudoku_DIGITiter4 = (sudoku_DIGIT *)Escher_IteratorNext( &iter4 )) != 0 ) {
    digit = sudoku_DIGITiter4; {
          sudoku_ELIGIBLE * eligible;
          /* CREATE OBJECT INSTANCE eligible OF ELIGIBLE */
          eligible = (sudoku_ELIGIBLE *) Escher_CreateInstance( sudoku_DOMAIN_ID, sudoku_ELIGIBLE_CLASS_NUMBER );
          /* RELATE digit TO cell ACROSS R8 USING eligible */
          sudoku_ELIGIBLE_R8_Link( cell, digit, eligible );
          }}
}
        Escher_ClearSet( digits );  /* Clear set: digit */
        }}
}
      Escher_ClearSet( columns );
      }}
}
    /* SELECT many cells FROM INSTANCES OF CELL */
    Escher_CopySet( cells, &pG_sudoku_CELL_extent.active );
    /* FOR EACH cell IN cells */
    { Escher_Iterator_s iter2;
  sudoku_CELL * sudoku_CELLiter2;
  Escher_IteratorReset( &iter2, cells );
  while ( (sudoku_CELLiter2 = (sudoku_CELL *)Escher_IteratorNext( &iter2 )) != 0 ) {
    cell = sudoku_CELLiter2; {
      /* IF ( ( ( cell.row_number <= 3 ) and ( cell.column_number <= 3 ) ) ) */
      if ( ( ( cell->row_number <= 3 ) && ( cell->column_number <= 3 ) ) ) {
        sudoku_BOX * box;
        /* SELECT any box FROM INSTANCES OF BOX WHERE ( SELECTED.number == 1 ) */
        box = 0;
{ sudoku_BOX * selected;
  Escher_Iterator_s iter32_BOX;
  Escher_IteratorReset( &iter32_BOX, &pG_sudoku_BOX_extent.active );
  while ( (selected = (sudoku_BOX *) Escher_IteratorNext( &iter32_BOX )) != 0 ) {
    if ( ( selected->number == 1 ) ) {
      box = selected;
      break;
    }
  }
}
        /* RELATE cell TO box ACROSS R4 */
        sudoku_CELL_R4_Link( box, cell );
      }
      else if ( ( ( cell->row_number <= 3 ) && ( ( 4 <= cell->column_number ) && ( cell->column_number <= 6 ) ) ) ) {
        sudoku_BOX * box;
        /* SELECT any box FROM INSTANCES OF BOX WHERE ( SELECTED.number == 2 ) */
        box = 0;
{ sudoku_BOX * selected;
  Escher_Iterator_s iter33_BOX;
  Escher_IteratorReset( &iter33_BOX, &pG_sudoku_BOX_extent.active );
  while ( (selected = (sudoku_BOX *) Escher_IteratorNext( &iter33_BOX )) != 0 ) {
    if ( ( selected->number == 2 ) ) {
      box = selected;
      break;
    }
  }
}
        /* RELATE cell TO box ACROSS R4 */
        sudoku_CELL_R4_Link( box, cell );
      }
      else if ( ( ( cell->row_number <= 3 ) && ( 7 <= cell->column_number ) ) ) {
        sudoku_BOX * box;
        /* SELECT any box FROM INSTANCES OF BOX WHERE ( SELECTED.number == 3 ) */
        box = 0;
{ sudoku_BOX * selected;
  Escher_Iterator_s iter34_BOX;
  Escher_IteratorReset( &iter34_BOX, &pG_sudoku_BOX_extent.active );
  while ( (selected = (sudoku_BOX *) Escher_IteratorNext( &iter34_BOX )) != 0 ) {
    if ( ( selected->number == 3 ) ) {
      box = selected;
      break;
    }
  }
}
        /* RELATE cell TO box ACROSS R4 */
        sudoku_CELL_R4_Link( box, cell );
      }
      else if ( ( ( ( 4 <= cell->row_number ) && ( cell->row_number <= 6 ) ) && ( cell->column_number <= 3 ) ) ) {
        sudoku_BOX * box;
        /* SELECT any box FROM INSTANCES OF BOX WHERE ( SELECTED.number == 4 ) */
        box = 0;
{ sudoku_BOX * selected;
  Escher_Iterator_s iter35_BOX;
  Escher_IteratorReset( &iter35_BOX, &pG_sudoku_BOX_extent.active );
  while ( (selected = (sudoku_BOX *) Escher_IteratorNext( &iter35_BOX )) != 0 ) {
    if ( ( selected->number == 4 ) ) {
      box = selected;
      break;
    }
  }
}
        /* RELATE cell TO box ACROSS R4 */
        sudoku_CELL_R4_Link( box, cell );
      }
      else if ( ( ( ( 4 <= cell->row_number ) && ( cell->row_number <= 6 ) ) && ( ( 4 <= cell->column_number ) && ( cell->column_number <= 6 ) ) ) ) {
        sudoku_BOX * box;
        /* SELECT any box FROM INSTANCES OF BOX WHERE ( SELECTED.number == 5 ) */
        box = 0;
{ sudoku_BOX * selected;
  Escher_Iterator_s iter36_BOX;
  Escher_IteratorReset( &iter36_BOX, &pG_sudoku_BOX_extent.active );
  while ( (selected = (sudoku_BOX *) Escher_IteratorNext( &iter36_BOX )) != 0 ) {
    if ( ( selected->number == 5 ) ) {
      box = selected;
      break;
    }
  }
}
        /* RELATE cell TO box ACROSS R4 */
        sudoku_CELL_R4_Link( box, cell );
      }
      else if ( ( ( ( 4 <= cell->row_number ) && ( cell->row_number <= 6 ) ) && ( 7 <= cell->column_number ) ) ) {
        sudoku_BOX * box;
        /* SELECT any box FROM INSTANCES OF BOX WHERE ( SELECTED.number == 6 ) */
        box = 0;
{ sudoku_BOX * selected;
  Escher_Iterator_s iter37_BOX;
  Escher_IteratorReset( &iter37_BOX, &pG_sudoku_BOX_extent.active );
  while ( (selected = (sudoku_BOX *) Escher_IteratorNext( &iter37_BOX )) != 0 ) {
    if ( ( selected->number == 6 ) ) {
      box = selected;
      break;
    }
  }
}
        /* RELATE cell TO box ACROSS R4 */
        sudoku_CELL_R4_Link( box, cell );
      }
      else if ( ( ( 7 <= cell->row_number ) && ( cell->column_number <= 3 ) ) ) {
        sudoku_BOX * box;
        /* SELECT any box FROM INSTANCES OF BOX WHERE ( SELECTED.number == 7 ) */
        box = 0;
{ sudoku_BOX * selected;
  Escher_Iterator_s iter38_BOX;
  Escher_IteratorReset( &iter38_BOX, &pG_sudoku_BOX_extent.active );
  while ( (selected = (sudoku_BOX *) Escher_IteratorNext( &iter38_BOX )) != 0 ) {
    if ( ( selected->number == 7 ) ) {
      box = selected;
      break;
    }
  }
}
        /* RELATE cell TO box ACROSS R4 */
        sudoku_CELL_R4_Link( box, cell );
      }
      else if ( ( ( 7 <= cell->row_number ) && ( ( 4 <= cell->column_number ) && ( cell->column_number <= 6 ) ) ) ) {
        sudoku_BOX * box;
        /* SELECT any box FROM INSTANCES OF BOX WHERE ( SELECTED.number == 8 ) */
        box = 0;
{ sudoku_BOX * selected;
  Escher_Iterator_s iter39_BOX;
  Escher_IteratorReset( &iter39_BOX, &pG_sudoku_BOX_extent.active );
  while ( (selected = (sudoku_BOX *) Escher_IteratorNext( &iter39_BOX )) != 0 ) {
    if ( ( selected->number == 8 ) ) {
      box = selected;
      break;
    }
  }
}
        /* RELATE cell TO box ACROSS R4 */
        sudoku_CELL_R4_Link( box, cell );
      }
      else if ( ( ( 7 <= cell->row_number ) && ( 7 <= cell->column_number ) ) ) {
        sudoku_BOX * box;
        /* SELECT any box FROM INSTANCES OF BOX WHERE ( SELECTED.number == 9 ) */
        box = 0;
{ sudoku_BOX * selected;
  Escher_Iterator_s iter40_BOX;
  Escher_IteratorReset( &iter40_BOX, &pG_sudoku_BOX_extent.active );
  while ( (selected = (sudoku_BOX *) Escher_IteratorNext( &iter40_BOX )) != 0 ) {
    if ( ( selected->number == 9 ) ) {
      box = selected;
      break;
    }
  }
}
        /* RELATE cell TO box ACROSS R4 */
        sudoku_CELL_R4_Link( box, cell );
      }
      }}
}
    Escher_ClearSet( rows );Escher_ClearSet( cells );
  }
  else {
    /* LOG::LogInfo( message:'PEI data found.' ) */
    LOG_LogInfo( "PEI data found." );
  }

}
Пример #3
0
/*
 * Domain Function:  cleanup
 */
void
sudoku_cleanup( void )
{
  Escher_ObjectSet_s eligibles_space; Escher_ObjectSet_s * eligibles = &eligibles_space; /* eligibles (ELIGIBLE) */sudoku_ELIGIBLE * eligible;Escher_ObjectSet_s cells_space; Escher_ObjectSet_s * cells = &cells_space; /* cells (CELL) */sudoku_CELL * cell;Escher_ObjectSet_s digits_space; Escher_ObjectSet_s * digits = &digits_space; /* digits (DIGIT) */sudoku_DIGIT * digit;Escher_ObjectSet_s rows_space; Escher_ObjectSet_s * rows = &rows_space; /* rows (ROW) */sudoku_ROW * row;Escher_ObjectSet_s columns_space; Escher_ObjectSet_s * columns = &columns_space; /* columns (COLUMN) */sudoku_COLUMN * column;Escher_ObjectSet_s boxes_space; Escher_ObjectSet_s * boxes = &boxes_space; /* boxes (BOX) */sudoku_BOX * box;
  Escher_InitSet( eligibles );Escher_InitSet( cells );Escher_InitSet( digits );Escher_InitSet( rows );Escher_InitSet( columns );Escher_InitSet( boxes );
  /* SELECT many eligibles FROM INSTANCES OF ELIGIBLE */
  Escher_CopySet( eligibles, &pG_sudoku_ELIGIBLE_extent.active );
  /* FOR EACH eligible IN eligibles */
  { Escher_Iterator_s iter5;
  sudoku_ELIGIBLE * sudoku_ELIGIBLEiter5;
  Escher_IteratorReset( &iter5, eligibles );
  while ( (sudoku_ELIGIBLEiter5 = (sudoku_ELIGIBLE *)Escher_IteratorNext( &iter5 )) != 0 ) {
    eligible = sudoku_ELIGIBLEiter5; {
    sudoku_CELL * cell; /* cell (CELL) */
sudoku_DIGIT * digit; /* digit (DIGIT) */

    /* SELECT one cell RELATED BY eligible->CELL[R8] */
    cell = eligible->CELL_R8;
    /* SELECT one digit RELATED BY eligible->DIGIT[R8] */
    digit = eligible->DIGIT_R8;
    /* UNRELATE cell TO digit ACROSS R8 USING eligible */
    sudoku_ELIGIBLE_R8_Unlink( cell, digit, eligible );
    /* DELETE OBJECT INSTANCE eligible */
    if ( 0 == eligible ) {
  ROX_EMPTY_HANDLE_TRACE( "ELIGIBLE", "Escher_DeleteInstance" )
}
Escher_DeleteInstance( (Escher_iHandle_t) eligible, sudoku_DOMAIN_ID, sudoku_ELIGIBLE_CLASS_NUMBER );
    }}
}
  /* SELECT many cells FROM INSTANCES OF CELL */
  Escher_CopySet( cells, &pG_sudoku_CELL_extent.active );
  /* FOR EACH cell IN cells */
  { Escher_Iterator_s iter6;
  sudoku_CELL * sudoku_CELLiter6;
  Escher_IteratorReset( &iter6, cells );
  while ( (sudoku_CELLiter6 = (sudoku_CELL *)Escher_IteratorNext( &iter6 )) != 0 ) {
    cell = sudoku_CELLiter6; {
    sudoku_DIGIT * digit; /* digit (DIGIT) */

    /* SELECT one digit RELATED BY cell->DIGIT[R9] */
    digit = cell->DIGIT_R9;
    /* IF ( not_empty digit ) */
    if ( ( 0 != digit ) ) {
      /* UNRELATE cell FROM digit ACROSS R9 */
      sudoku_CELL_R9_Unlink( digit, cell );
    }
    }}
}
  /* SELECT many digits FROM INSTANCES OF DIGIT */
  Escher_CopySet( digits, &pG_sudoku_DIGIT_extent.active );
  /* FOR EACH digit IN digits */
  { Escher_Iterator_s iter7;
  sudoku_DIGIT * sudoku_DIGITiter7;
  Escher_IteratorReset( &iter7, digits );
  while ( (sudoku_DIGITiter7 = (sudoku_DIGIT *)Escher_IteratorNext( &iter7 )) != 0 ) {
    digit = sudoku_DIGITiter7; {
    /* DELETE OBJECT INSTANCE digit */
    if ( 0 == digit ) {
  ROX_EMPTY_HANDLE_TRACE( "DIGIT", "Escher_DeleteInstance" )
}
Escher_DeleteInstance( (Escher_iHandle_t) digit, sudoku_DOMAIN_ID, sudoku_DIGIT_CLASS_NUMBER );
    }}
}
  /* SELECT many rows FROM INSTANCES OF ROW */
  Escher_CopySet( rows, &pG_sudoku_ROW_extent.active );
  /* FOR EACH row IN rows */
  { Escher_Iterator_s iter8;
  sudoku_ROW * sudoku_ROWiter8;
  Escher_IteratorReset( &iter8, rows );
  while ( (sudoku_ROWiter8 = (sudoku_ROW *)Escher_IteratorNext( &iter8 )) != 0 ) {
    row = sudoku_ROWiter8; {
    sudoku_SEQUENCE * sequence; /* sequence (SEQUENCE) */

    /* SELECT many cells RELATED BY row->CELL[R2] */
    Escher_ClearSet( cells );
if ( 0 != row ) {
  Escher_CopySet( cells, &row->CELL_R2 );
}
    /* FOR EACH cell IN cells */
    { Escher_Iterator_s iter11;
  sudoku_CELL * sudoku_CELLiter11;
  Escher_IteratorReset( &iter11, cells );
  while ( (sudoku_CELLiter11 = (sudoku_CELL *)Escher_IteratorNext( &iter11 )) != 0 ) {
    cell = sudoku_CELLiter11; {
      /* UNRELATE row FROM cell ACROSS R2 */
      sudoku_CELL_R2_Unlink( row, cell );
      }}
}
    /* SELECT one sequence RELATED BY row->SEQUENCE[R1] */
    sequence = row->SEQUENCE_R1;
    /* DELETE OBJECT INSTANCE sequence */
    if ( 0 == sequence ) {
  ROX_EMPTY_HANDLE_TRACE( "SEQUENCE", "Escher_DeleteInstance" )
}
Escher_DeleteInstance( (Escher_iHandle_t) sequence, sudoku_DOMAIN_ID, sudoku_SEQUENCE_CLASS_NUMBER );
    /* DELETE OBJECT INSTANCE row */
    if ( 0 == row ) {
  ROX_EMPTY_HANDLE_TRACE( "ROW", "Escher_DeleteInstance" )
}
Escher_DeleteInstance( (Escher_iHandle_t) row, sudoku_DOMAIN_ID, sudoku_ROW_CLASS_NUMBER );
    }}
}
  /* SELECT many columns FROM INSTANCES OF COLUMN */
  Escher_CopySet( columns, &pG_sudoku_COLUMN_extent.active );
  /* FOR EACH column IN columns */
  { Escher_Iterator_s iter9;
  sudoku_COLUMN * sudoku_COLUMNiter9;
  Escher_IteratorReset( &iter9, columns );
  while ( (sudoku_COLUMNiter9 = (sudoku_COLUMN *)Escher_IteratorNext( &iter9 )) != 0 ) {
    column = sudoku_COLUMNiter9; {
    sudoku_SEQUENCE * sequence; /* sequence (SEQUENCE) */

    /* SELECT many cells RELATED BY column->CELL[R3] */
    Escher_ClearSet( cells );
if ( 0 != column ) {
  Escher_CopySet( cells, &column->CELL_R3 );
}
    /* FOR EACH cell IN cells */
    { Escher_Iterator_s iter12;
  sudoku_CELL * sudoku_CELLiter12;
  Escher_IteratorReset( &iter12, cells );
  while ( (sudoku_CELLiter12 = (sudoku_CELL *)Escher_IteratorNext( &iter12 )) != 0 ) {
    cell = sudoku_CELLiter12; {
      /* UNRELATE column FROM cell ACROSS R3 */
      sudoku_CELL_R3_Unlink( column, cell );
      }}
}
    /* SELECT one sequence RELATED BY column->SEQUENCE[R1] */
    sequence = column->SEQUENCE_R1;
    /* DELETE OBJECT INSTANCE sequence */
    if ( 0 == sequence ) {
  ROX_EMPTY_HANDLE_TRACE( "SEQUENCE", "Escher_DeleteInstance" )
}
Escher_DeleteInstance( (Escher_iHandle_t) sequence, sudoku_DOMAIN_ID, sudoku_SEQUENCE_CLASS_NUMBER );
    /* DELETE OBJECT INSTANCE column */
    if ( 0 == column ) {
  ROX_EMPTY_HANDLE_TRACE( "COLUMN", "Escher_DeleteInstance" )
}
Escher_DeleteInstance( (Escher_iHandle_t) column, sudoku_DOMAIN_ID, sudoku_COLUMN_CLASS_NUMBER );
    }}
}
  /* SELECT many boxes FROM INSTANCES OF BOX */
  Escher_CopySet( boxes, &pG_sudoku_BOX_extent.active );
  /* FOR EACH box IN boxes */
  { Escher_Iterator_s iter10;
  sudoku_BOX * sudoku_BOXiter10;
  Escher_IteratorReset( &iter10, boxes );
  while ( (sudoku_BOXiter10 = (sudoku_BOX *)Escher_IteratorNext( &iter10 )) != 0 ) {
    box = sudoku_BOXiter10; {
    sudoku_SEQUENCE * sequence; /* sequence (SEQUENCE) */

    /* SELECT many cells RELATED BY box->CELL[R4] */
    Escher_ClearSet( cells );
if ( 0 != box ) {
  Escher_CopySet( cells, &box->CELL_R4 );
}
    /* FOR EACH cell IN cells */
    { Escher_Iterator_s iter13;
  sudoku_CELL * sudoku_CELLiter13;
  Escher_IteratorReset( &iter13, cells );
  while ( (sudoku_CELLiter13 = (sudoku_CELL *)Escher_IteratorNext( &iter13 )) != 0 ) {
    cell = sudoku_CELLiter13; {
      /* UNRELATE box FROM cell ACROSS R4 */
      sudoku_CELL_R4_Unlink( box, cell );
      /* DELETE OBJECT INSTANCE cell */
      if ( 0 == cell ) {
  ROX_EMPTY_HANDLE_TRACE( "CELL", "Escher_DeleteInstance" )
}
Escher_DeleteInstance( (Escher_iHandle_t) cell, sudoku_DOMAIN_ID, sudoku_CELL_CLASS_NUMBER );
      }}
}
    /* SELECT one sequence RELATED BY box->SEQUENCE[R1] */
    sequence = box->SEQUENCE_R1;
    /* DELETE OBJECT INSTANCE sequence */
    if ( 0 == sequence ) {
  ROX_EMPTY_HANDLE_TRACE( "SEQUENCE", "Escher_DeleteInstance" )
}
Escher_DeleteInstance( (Escher_iHandle_t) sequence, sudoku_DOMAIN_ID, sudoku_SEQUENCE_CLASS_NUMBER );
    /* DELETE OBJECT INSTANCE box */
    if ( 0 == box ) {
  ROX_EMPTY_HANDLE_TRACE( "BOX", "Escher_DeleteInstance" )
}
Escher_DeleteInstance( (Escher_iHandle_t) box, sudoku_DOMAIN_ID, sudoku_BOX_CLASS_NUMBER );
    }}
}
  Escher_ClearSet( eligibles );Escher_ClearSet( cells );Escher_ClearSet( digits );Escher_ClearSet( rows );Escher_ClearSet( columns );Escher_ClearSet( boxes );

}
/*
 * class operation:  solve
 */
void
sudoku_SEQUENCE_op_solve( void )
{
  i_t i;Escher_ObjectSet_s sequences_space; Escher_ObjectSet_s * sequences = &sequences_space; /* sequences (SEQUENCE) */
  Escher_InitSet( sequences );
  /* ASSIGN i = 0 */
  i = 0;
  /* SELECT many sequences FROM INSTANCES OF SEQUENCE */
  Escher_CopySet( sequences, &pG_sudoku_SEQUENCE_extent.active );
  /* WHILE ( ( 25 > i ) ) */
  while ( ( 25 > i ) ) {
    i_t j;sudoku_SEQUENCE * sequence;
    /* ASSIGN j = 0 */
    j = 0;
    /* WHILE ( ( 25 > j ) ) */
    while ( ( 25 > j ) ) {
      Escher_ObjectSet_s eligibles_space; Escher_ObjectSet_s * eligibles = &eligibles_space; /* eligibles (ELIGIBLE) */i_t count1;i_t count2;sudoku_SEQUENCE * sequence;
      Escher_InitSet( eligibles );
      /* ::display(  ) */
      sudoku_display();
      /* SELECT many eligibles FROM INSTANCES OF ELIGIBLE */
      Escher_CopySet( eligibles, &pG_sudoku_ELIGIBLE_extent.active );
      /* ASSIGN count1 = cardinality eligibles */
      count1 = Escher_SetCardinality( eligibles );
      /* ASSIGN count2 = 0 */
      count2 = 0;
      /* FOR EACH sequence IN sequences */
      { Escher_Iterator_s iter29;
  sudoku_SEQUENCE * sudoku_SEQUENCEiter29;
  Escher_IteratorReset( &iter29, sequences );
  while ( (sudoku_SEQUENCEiter29 = (sudoku_SEQUENCE *)Escher_IteratorNext( &iter29 )) != 0 ) {
    sequence = sudoku_SEQUENCEiter29; {
        i_t k;
        /* ASSIGN k = sequence.solve_by_pruning() */
        k = sudoku_SEQUENCE_op_solve_by_pruning(sequence);
        }}
}
      /* SELECT many eligibles FROM INSTANCES OF ELIGIBLE */
      Escher_CopySet( eligibles, &pG_sudoku_ELIGIBLE_extent.active );
      /* ASSIGN count2 = cardinality eligibles */
      count2 = Escher_SetCardinality( eligibles );
      /* IF ( ( ( 81 == CELL::score() ) or ( count1 == count2 ) ) ) */
      if ( ( ( 81 == sudoku_CELL_op_score() ) || ( count1 == count2 ) ) ) {
        /* BREAK */
        break;
      }
      /* ASSIGN j = ( j + 1 ) */
      j = ( j + 1 );
      Escher_ClearSet( eligibles );
    }
    /* FOR EACH sequence IN sequences */
    { Escher_Iterator_s iter28;
  sudoku_SEQUENCE * sudoku_SEQUENCEiter28;
  Escher_IteratorReset( &iter28, sequences );
  while ( (sudoku_SEQUENCEiter28 = (sudoku_SEQUENCE *)Escher_IteratorNext( &iter28 )) != 0 ) {
    sequence = sudoku_SEQUENCEiter28; {
      i_t k;
      /* ASSIGN k = sequence.solve_by_elimination() */
      k = sudoku_SEQUENCE_op_solve_by_elimination(sequence);
      }}
}
    /* IF ( ( 81 == CELL::score() ) ) */
    if ( ( 81 == sudoku_CELL_op_score() ) ) {
      /* BREAK */
      break;
    }
    /* ASSIGN i = ( i + 1 ) */
    i = ( i + 1 );
  }
  Escher_ClearSet( sequences );

}