/*--------------------------------------------------------------------- * Generate delayed event to the application. * Deactivate fired timer. *-------------------------------------------------------------------*/ static void timer_fire( ETimer_t * const t ) { t->expiration = ( t->recurrence == 0 ) ? 0 : t->expiration + t->recurrence; Escher_SendEvent( t->event ); if ( 0 != t->recurrence ) { Escher_xtUMLEvent_t * e = Escher_AllocatextUMLEvent(); Escher_memmove( e, t->event, sizeof( Escher_xtUMLEvent_t ) ); t->event = e; #ifdef ESCHER_TASKING_POSIX Escher_mutex_lock( SEMAPHORE_FLAVOR_TIMER ); #endif animate = animate->next; /* Remove from front of list. */ timer_insert_sorted( t ); #ifdef ESCHER_TASKING_POSIX Escher_mutex_unlock( SEMAPHORE_FLAVOR_TIMER ); #endif } else { #ifdef ESCHER_TASKING_POSIX Escher_mutex_lock( SEMAPHORE_FLAVOR_TIMER ); #endif animate = animate->next; /* Remove from active list. */ t->next = inanimate; /* Connect to inactive list. */ inanimate = t; #ifdef ESCHER_TASKING_POSIX Escher_mutex_unlock( SEMAPHORE_FLAVOR_TIMER ); #endif } }
/* * Domain Function: display */ void sudoku_display( void ) { i_t i; /* ASSIGN i = 1 */ i = 1; /* LOG::LogInfo( message:'\n|-+-+-+-+-+-+-+-+-|\n' ) */ LOG_LogInfo( "\n|-+-+-+-+-+-+-+-+-|\n" ); /* WHILE ( ( i <= 9 ) ) */ while ( ( i <= 9 ) ) { i_t j;i_t b[9]; /* ASSIGN j = 1 */ j = 1; /* ASSIGN b[8] = 0 */ Escher_memmove( (void * const) &(b[8]), (void const * const) &(0), sizeof( 0 ) ); /* WHILE ( ( j <= 9 ) ) */ while ( ( j <= 9 ) ) { sudoku_CELL * cell;i_t a; /* SELECT any cell FROM INSTANCES OF CELL WHERE ( ( SELECTED.row_number == i ) and ( SELECTED.column_number == j ) ) */ cell = 0; { sudoku_CELL * selected; Escher_Iterator_s iter41_CELL; Escher_IteratorReset( &iter41_CELL, &pG_sudoku_CELL_extent.active ); while ( (selected = (sudoku_CELL *) Escher_IteratorNext( &iter41_CELL )) != 0 ) { if ( ( ( selected->row_number == i ) && ( selected->column_number == j ) ) ) { cell = selected; break; } } } /* ASSIGN a = cell.answer_value */ a = cell->answer_value; /* ASSIGN b[( j - 1 )] = a */ Escher_memmove( (void * const) &(b[( j - 1 )]), (void const * const) &(a), sizeof( a ) ); /* ASSIGN j = ( j + 1 ) */ j = ( j + 1 ); } /* LOG::LogInteger( message:b ) */ LOG_LogInteger( b ); /* ASSIGN i = ( i + 1 ) */ i = ( i + 1 ); } /* LOG::LogInfo( message:'\n|-+-+-+-+-+-+-+-+-|\n' ) */ LOG_LogInfo( "\n|-+-+-+-+-+-+-+-+-|\n" ); }
/*--------------------------------------------------------------------- * Generate delayed event to the application. * Deactivate fired timer. *-------------------------------------------------------------------*/ static void timer_fire( ETimer_t * const t ) { t->expiration = ( t->recurrence == 0 ) ? 0 : t->expiration + t->recurrence; Escher_SendEvent( t->event ); if ( 0 != t->recurrence ) { Escher_xtUMLEvent_t * e = Escher_AllocatextUMLEvent(); Escher_memmove( e, t->event, sizeof( Escher_xtUMLEvent_t ) ); t->event = e; animate = animate->next; /* Remove from front of list. */ timer_insert_sorted( t ); } else { animate = animate->next; /* Remove from active list. */ t->next = inanimate; /* Connect to inactive list. */ inanimate = t; } }