gboolean timings_stop (Timings* t) { TimingsPrivate* priv; gboolean removed_successfully; // sanity checks if (!t) return FALSE; priv = GET_PRIVATE (t); if (!priv) return FALSE; // if we have not been started, return early if (!priv->is_started) { if (g_getenv ("DEBUG")) g_print ("\n*** WARNING: Can't stop something, which " "is not started yet!\n"); return FALSE; } // get rid of timeouts if (!priv->is_paused) { // remove timeout for normal scheduled duration removed_successfully = g_source_remove (priv->timeout_id); g_assert (removed_successfully); } // remove timeout enforcing max. time-limit removed_successfully = g_source_remove (priv->max_timeout_id); g_assert (removed_successfully); // halt all timers if (priv->is_paused) g_timer_stop (priv->paused_timer); else { g_timer_stop (priv->on_screen_timer); g_timer_stop (priv->duration_timer); } // indicate that we stopped (means also not paused) priv->is_started = FALSE; priv->is_paused = FALSE; // spit out some debugging information _debug_output (priv); return TRUE; }
void diag_issue_diagnostic ( int d_message_number, src_source_record_type *az_src_rec, int l_start_column, ...) { va_list ap; /* ptr to variable length parameter */ int severity; /* severity of message */ int message_number; /* message number */ char msg_buffer[132]; /* buffer to construct message */ char ptr_buffer[buf_size]; /* buffer to construct pointer */ char loc_buffer[132]; /* buffer to construct location */ char src_buffer[buf_size]; /* buffer to hold source line */ /* ** check if we are in a loop issuing errors */ if (issuing_diagnostic) { _debug_output( "nested diagnostics issued" ); Uil_message_count[ uil_k_severe_status ]++; uil_exit( uil_k_severe_status ); } issuing_diagnostic = TRUE; /* ** determine the severity of the error. For d_submit_spr we issue ** the fix previous error diagnostic, if we encountered prior errors; ** otherwise we let it thru. */ message_number = d_message_number; if (message_number == d_submit_spr) if (Uil_message_count[ uil_k_error_status ] > 0) message_number = d_prev_error; severity = diag_rz_msg_table[ message_number ].l_severity; /* ** check if messages of this severity are to be reported. */ switch (severity) { case uil_k_info_status: if (Uil_cmd_z_command.v_report_info_msg) break; issuing_diagnostic = FALSE; return; case uil_k_warning_status: if (Uil_cmd_z_command.v_report_warn_msg) break; issuing_diagnostic = FALSE; return; default: ; } Uil_message_count[ severity ]++; if (severity > uil_l_compile_status) uil_l_compile_status = severity; /* ** Diagnostic format varies considerably ** 1) no source ** message ** 2) source but no column ** source line ** message ** location in source message ** 3) source and column ** source line ** column pointer ** message ** location in source message ** 4) source and column but no access key ** message ** location in source message */ /* ** substitute any parameters into the error message placing the ** resultant string in msg_buffer */ va_start(ap, l_start_column); #ifndef NO_MESSAGE_CATALOG vsnprintf( msg_buffer, sizeof(msg_buffer), catgets(uil_catd, UIL_SET1, msg_cat_table[ message_number ], diag_rz_msg_table[ message_number ].ac_text), ap ); #else vsnprintf( msg_buffer, sizeof(msg_buffer), diag_rz_msg_table[ message_number ].ac_text, ap ); #endif va_end(ap); src_buffer[ 0 ] = 0; loc_buffer[ 0 ] = 0; ptr_buffer[ 0 ] = 0; if (az_src_rec != diag_k_no_source) { if ( !_src_null_access_key(az_src_rec->z_access_key) ) { /* ** create the location line line */ #ifndef NO_MESSAGE_CATALOG sprintf( loc_buffer, catgets(uil_catd, UIL_SET_MISC, UIL_MISC_0, "\t\t line: %d file: %s"), az_src_rec->w_line_number, src_get_file_name( az_src_rec ) ); #else sprintf( loc_buffer, "\t\t line: %d file: %s", az_src_rec->w_line_number, src_get_file_name( az_src_rec ) ); #endif /* ** retrieve the source line */ src_buffer[ 0 ] = '\t'; src_retrieve_source( az_src_rec, &src_buffer[ 1 ] ); /* ** filter the standard unprintable characters. */ lex_filter_unprintable_chars ( (unsigned char *)src_buffer, strlen( src_buffer ), 0 ); /* ** create the column pointer if a source position was given */ if (l_start_column != diag_k_no_column) { int i; for (i=0; i < l_start_column+1; i++) { if (src_buffer[ i ] == '\t') ptr_buffer[ i ] = '\t'; else ptr_buffer[ i ] = ' '; } ptr_buffer[ i++ ] = '*'; ptr_buffer[ i ] = 0; } } else /* no access key */ { /* ** create the location line line */ if (l_start_column != diag_k_no_column) #ifndef NO_MESSAGE_CATALOG sprintf(loc_buffer, catgets(uil_catd, UIL_SET_MISC, UIL_MISC_1, "\t\t line: %d position: %d file: %s"), az_src_rec->w_line_number, l_start_column + 1, src_get_file_name( az_src_rec ) ); #else sprintf(loc_buffer, "\t\t line: %d position: %d file: %s", az_src_rec->w_line_number, l_start_column + 1, src_get_file_name( az_src_rec ) ); #endif else #ifndef NO_MESSAGE_CATALOG sprintf( loc_buffer, catgets(uil_catd, UIL_SET_MISC, UIL_MISC_0, "\t\t line: %d file: %s"), az_src_rec->w_line_number, src_get_file_name( az_src_rec ) ); #else sprintf( loc_buffer, "\t\t line: %d file: %s", az_src_rec->w_line_number, src_get_file_name( az_src_rec ) ); #endif } }