void sc_report_handler::report(sc_severity severity_, const char * msg_type_, const char * msg_, const char * file_, int line_) { sc_msg_def * md = mdlookup(msg_type_); // If the severity of the report is SC_INFO and the maximum verbosity // level is less than SC_MEDIUM return without any action. if ( (severity_ == SC_INFO) && (SC_MEDIUM > verbosity_level) ) return; // Process the report: if ( !md ) md = add_msg_type(msg_type_); sc_actions actions = execute(md, severity_); sc_report rep(severity_, md, msg_, file_, line_); if ( actions & SC_CACHE_REPORT ) cache_report(rep); handler(rep, actions); }
int sc_report_handler::get_count(const char* msg_type_, sc_severity severity_) { sc_msg_def * md = mdlookup(msg_type_); if ( !md ) md = add_msg_type(msg_type_); return md->sev_call_count[severity_]; }
int sc_report_handler::get_count(const char* msg_type_) { sc_msg_def * md = mdlookup(msg_type_); if ( !md ) md = add_msg_type(msg_type_); return md->call_count; }
sc_actions sc_report_handler::set_actions(const char * msg_type_, sc_actions actions_) { sc_msg_def * md = mdlookup(msg_type_); if ( !md ) md = add_msg_type(msg_type_); sc_actions old = md->actions; md->actions = actions_; return old; }
sc_actions sc_report_handler::set_actions(const char * msg_type_, sc_severity severity_, sc_actions actions_) { sc_msg_def * md = mdlookup(msg_type_); if ( !md ) md = add_msg_type(msg_type_); sc_actions old = md->sev_actions[severity_]; md->sev_actions[severity_] = actions_; return old; }
int sc_report_handler::stop_after(const char * msg_type_, int limit) { sc_msg_def * md = mdlookup(msg_type_); if ( !md ) md = add_msg_type(msg_type_); int old = md->limit_mask & 1 ? md->limit: UINT_MAX; if ( limit < 0 ) md->limit_mask &= ~1; else { md->limit_mask |= 1; md->limit = limit; } return old; }
void sc_report_handler::report(sc_severity severity_, const char * msg_type_, const char * msg_, const char * file_, int line_) { sc_msg_def * md = mdlookup(msg_type_); if ( !md ) md = add_msg_type(msg_type_); sc_actions actions = execute(md, severity_); sc_report rep(severity_, md, msg_, file_, line_); if ( actions & SC_CACHE_REPORT ) cache_report(rep); handler(rep, actions); }
sc_msg_def * sc_report_handler::add_msg_type(const char * msg_type_) { sc_msg_def * md = mdlookup(msg_type_); int msg_type_len; if ( md ) return md; msg_def_items * items = new msg_def_items; if ( !items ) return 0; items->count = 1; items->md = new sc_msg_def[items->count]; if ( !items->md ) { delete items; return 0; } memset(items->md, 0, sizeof(sc_msg_def) * items->count); msg_type_len = strlen(msg_type_); if ( msg_type_len > 0 ) { items->md->msg_type_data = (char*) malloc(msg_type_len+1); strcpy( items->md->msg_type_data, msg_type_ ); items->md->id = -1; // backward compatibility with 2.0+ } else { delete items->md; delete items; return 0; } items->md->msg_type = items->md->msg_type_data; add_static_msg_types(items); items->allocated = true; return items->md; }
int sc_report_handler::stop_after(const char * msg_type_, sc_severity severity_, int limit) { sc_msg_def * md = mdlookup(msg_type_); if ( !md ) md = add_msg_type(msg_type_); int mask = 1 << (severity_ + 1); int old = md->limit_mask & mask ? md->sev_limit[severity_]: UINT_MAX; if ( limit < 0 ) md->limit_mask &= ~mask; else { md->limit_mask |= mask; md->sev_limit[severity_] = limit; } return old; }