#include <sc_report_handler.h>
Static Public メソッド | |
static void | report (sc_severity, const char *msg_type, const char *msg, const char *file, int line) |
static sc_actions | set_actions (sc_severity, sc_actions=SC_UNSPECIFIED) |
static sc_actions | set_actions (const char *msg_type, sc_actions=SC_UNSPECIFIED) |
static sc_actions | set_actions (const char *msg_type, sc_severity, sc_actions=SC_UNSPECIFIED) |
static int | stop_after (sc_severity, int limit=-1) |
static int | stop_after (const char *msg_type, int limit=-1) |
static int | stop_after (const char *msg_type, sc_severity, int limit=-1) |
static sc_actions | suppress (sc_actions) |
static sc_actions | suppress () |
static sc_actions | force (sc_actions) |
static sc_actions | force () |
static int | get_count (sc_severity severity_) |
static int | get_count (const char *msg_type_) |
static int | get_count (const char *msg_type_, sc_severity severity_) |
static void | initialize () |
static void | release () |
static void | set_handler (sc_report_handler_proc) |
static void | default_handler (const sc_report &, const sc_actions &) |
static sc_actions | get_new_action_id () |
static sc_report * | get_cached_report () |
static void | clear_cached_report () |
static bool | set_log_file_name (const char *filename) |
static const char * | get_log_file_name () |
static void | add_static_msg_types (msg_def_items *) |
static sc_msg_def * | add_msg_type (const char *msg_type) |
static void | report (sc_severity, int id, const char *add_msg, const char *file, int line) |
Static Protected メソッド | |
static void | cache_report (const sc_report &) |
static sc_actions | execute (sc_msg_def *, sc_severity) |
static sc_msg_def * | mdlookup (const char *msg_type) |
Static Protected 変数 | |
static sc_actions | suppress_mask = 0 |
static sc_actions | force_mask = 0 |
static sc_actions | sev_actions [SC_MAX_SEVERITY] |
static unsigned | sev_limit [SC_MAX_SEVERITY] |
static unsigned | sev_call_count [SC_MAX_SEVERITY] = { 0, 0, 0, 0 } |
static sc_report * | last_global_report = NULL |
static sc_actions | available_actions |
static char * | log_file_name = 0 |
static msg_def_items * | messages |
static msg_def_items | msg_terminator |
static sc_report_handler_proc | handler |
Static Private メソッド | |
static sc_msg_def * | mdlookup (int id) |
フレンド | |
class | sc_report |
構成 | |
struct | msg_def_items |
sc_report_handler.h の 75 行で定義されています。
void sc_core::sc_report_handler::report | ( | sc_severity | severity_, | |
const char * | msg_type, | |||
const char * | msg, | |||
const char * | file, | |||
int | line | |||
) | [static] |
sc_report_handler.cpp の 279 行で定義されています。
00284 { 00285 sc_msg_def * md = mdlookup(msg_type_); 00286 00287 if ( !md ) 00288 md = add_msg_type(msg_type_); 00289 00290 sc_actions actions = execute(md, severity_); 00291 sc_report rep(severity_, md, msg_, file_, line_); 00292 00293 if ( actions & SC_CACHE_REPORT ) 00294 cache_report(rep); 00295 00296 handler(rep, actions); 00297 }
sc_actions sc_core::sc_report_handler::set_actions | ( | sc_severity | severity_, | |
sc_actions | actions_ = SC_UNSPECIFIED | |||
) | [static] |
sc_report_handler.cpp の 421 行で定義されています。
00423 { 00424 sc_actions old = sev_actions[severity_]; 00425 sev_actions[severity_] = actions_; 00426 return old; 00427 }
sc_actions sc_core::sc_report_handler::set_actions | ( | const char * | msg_type, | |
sc_actions | actions_ = SC_UNSPECIFIED | |||
) | [static] |
sc_report_handler.cpp の 429 行で定義されています。
00431 { 00432 sc_msg_def * md = mdlookup(msg_type_); 00433 00434 if ( !md ) 00435 md = add_msg_type(msg_type_); 00436 00437 sc_actions old = md->actions; 00438 md->actions = actions_; 00439 00440 return old; 00441 }
sc_actions sc_core::sc_report_handler::set_actions | ( | const char * | msg_type, | |
sc_severity | severity_, | |||
sc_actions | actions_ = SC_UNSPECIFIED | |||
) | [static] |
sc_report_handler.cpp の 443 行で定義されています。
00446 { 00447 sc_msg_def * md = mdlookup(msg_type_); 00448 00449 if ( !md ) 00450 md = add_msg_type(msg_type_); 00451 00452 sc_actions old = md->sev_actions[severity_]; 00453 md->sev_actions[severity_] = actions_; 00454 00455 return old; 00456 }
int sc_core::sc_report_handler::stop_after | ( | sc_severity | severity_, | |
int | limit = -1 | |||
) | [static] |
sc_report_handler.cpp の 458 行で定義されています。
00459 { 00460 int old = sev_limit[severity_]; 00461 00462 sev_limit[severity_] = limit < 0 ? UINT_MAX: limit; 00463 00464 return old; 00465 }
int sc_core::sc_report_handler::stop_after | ( | const char * | msg_type, | |
int | limit = -1 | |||
) | [static] |
sc_report_handler.cpp の 467 行で定義されています。
00468 { 00469 sc_msg_def * md = mdlookup(msg_type_); 00470 00471 if ( !md ) 00472 md = add_msg_type(msg_type_); 00473 00474 int old = md->limit_mask & 1 ? md->limit: UINT_MAX; 00475 00476 if ( limit < 0 ) 00477 md->limit_mask &= ~1; 00478 else 00479 { 00480 md->limit_mask |= 1; 00481 md->limit = limit; 00482 } 00483 return old; 00484 }
int sc_core::sc_report_handler::stop_after | ( | const char * | msg_type, | |
sc_severity | severity_, | |||
int | limit = -1 | |||
) | [static] |
sc_report_handler.cpp の 486 行で定義されています。
00489 { 00490 sc_msg_def * md = mdlookup(msg_type_); 00491 00492 if ( !md ) 00493 md = add_msg_type(msg_type_); 00494 00495 int mask = 1 << (severity_ + 1); 00496 int old = md->limit_mask & mask ? md->sev_limit[severity_]: UINT_MAX; 00497 00498 if ( limit < 0 ) 00499 md->limit_mask &= ~mask; 00500 else 00501 { 00502 md->limit_mask |= mask; 00503 md->sev_limit[severity_] = limit; 00504 } 00505 return old; 00506 }
sc_actions sc_core::sc_report_handler::suppress | ( | sc_actions | mask | ) | [static] |
sc_report_handler.cpp の 508 行で定義されています。
00509 { 00510 sc_actions old = suppress_mask; 00511 suppress_mask = mask; 00512 return old; 00513 }
sc_actions sc_core::sc_report_handler::suppress | ( | ) | [static] |
sc_actions sc_core::sc_report_handler::force | ( | sc_actions | mask | ) | [static] |
sc_report_handler.cpp の 520 行で定義されています。
00521 { 00522 sc_actions old = force_mask; 00523 force_mask = mask; 00524 return old; 00525 }
sc_actions sc_core::sc_report_handler::force | ( | ) | [static] |
int sc_core::sc_report_handler::get_count | ( | sc_severity | severity_ | ) | [static] |
int sc_core::sc_report_handler::get_count | ( | const char * | msg_type_ | ) | [static] |
sc_report_handler.cpp の 190 行で定義されています。
00191 { 00192 sc_msg_def * md = mdlookup(msg_type_); 00193 00194 if ( !md ) 00195 md = add_msg_type(msg_type_); 00196 00197 return md->call_count; 00198 }
int sc_core::sc_report_handler::get_count | ( | const char * | msg_type_, | |
sc_severity | severity_ | |||
) | [static] |
sc_report_handler.cpp の 200 行で定義されています。
00201 { 00202 sc_msg_def * md = mdlookup(msg_type_); 00203 00204 if ( !md ) 00205 md = add_msg_type(msg_type_); 00206 00207 return md->sev_call_count[severity_]; 00208 }
void sc_core::sc_report_handler::initialize | ( | ) | [static] |
sc_report_handler.cpp の 301 行で定義されています。
00302 { 00303 #if 0 // actually, i do not know whether we have to reset these. 00304 suppress(); 00305 force(); 00306 set_actions(SC_INFO, SC_DEFAULT_INFO_ACTIONS); 00307 set_actions(SC_WARNING, SC_DEFAULT_WARNING_ACTIONS); 00308 set_actions(SC_ERROR, SC_DEFAULT_ERROR_ACTIONS); 00309 set_actions(SC_FATAL, SC_DEFAULT_FATAL_ACTIONS); 00310 #endif 00311 00312 sev_call_count[SC_INFO] = 0; 00313 sev_call_count[SC_WARNING] = 0; 00314 sev_call_count[SC_ERROR] = 0; 00315 sev_call_count[SC_FATAL] = 0; 00316 00317 msg_def_items * items = messages; 00318 00319 while ( items != &msg_terminator ) 00320 { 00321 for ( int i = 0; i < items->count; ++i ) 00322 { 00323 items->md[i].call_count = 0; 00324 items->md[i].sev_call_count[SC_INFO] = 0; 00325 items->md[i].sev_call_count[SC_WARNING] = 0; 00326 items->md[i].sev_call_count[SC_ERROR] = 0; 00327 items->md[i].sev_call_count[SC_FATAL] = 0; 00328 } 00329 items = items->next; 00330 } 00331 00332 // PROCESS ANY ENVIRONMENTAL OVERRIDES: 00333 00334 const char* deprecation_warn = std::getenv("SC_DEPRECATION_WARNINGS"); 00335 if ( (deprecation_warn!=0) && !strcmp(deprecation_warn,"DISABLE") ) 00336 { 00337 set_actions("/IEEE_Std_1666/deprecated", SC_DO_NOTHING); 00338 } 00339 }
void sc_core::sc_report_handler::release | ( | ) | [static] |
sc_report_handler.cpp の 344 行で定義されています。
00345 { 00346 if ( last_global_report ) 00347 delete last_global_report; 00348 last_global_report = 0; 00349 sc_report_close_default_log(); 00350 00351 msg_def_items * items = messages, * newitems = &msg_terminator; 00352 messages = &msg_terminator; 00353 00354 while ( items != &msg_terminator ) 00355 { 00356 for ( int i = 0; i < items->count; ++i ) 00357 if ( items->md[i].msg_type == items->md[i].msg_type_data ) 00358 free(items->md[i].msg_type_data); 00359 00360 msg_def_items * prev = items; 00361 items = items->next; 00362 00363 if ( prev->allocated ) 00364 { 00365 delete [] prev->md; 00366 delete prev; 00367 } 00368 else 00369 { 00370 prev->next = newitems; 00371 newitems = prev; 00372 } 00373 } 00374 messages = newitems; 00375 }
void sc_core::sc_report_handler::set_handler | ( | sc_report_handler_proc | handler_ | ) | [static] |
sc_report_handler.cpp の 532 行で定義されています。
00533 { 00534 handler = handler_ ? handler_: &sc_report_handler::default_handler; 00535 }
void sc_core::sc_report_handler::default_handler | ( | const sc_report & | rep, | |
const sc_actions & | actions | |||
) | [static] |
sc_report_handler.cpp の 142 行で定義されています。
00144 { 00145 if ( actions & SC_DISPLAY ) 00146 ::std::cout << ::std::endl << sc_report_compose_message(rep) << 00147 ::std::endl; 00148 00149 if ( (actions & SC_LOG) && get_log_file_name() ) 00150 { 00151 if ( !log_stream ) 00152 log_stream = new ::std::ofstream(get_log_file_name()); // ios::trunc 00153 00154 *log_stream << rep.get_time() << ": " 00155 << sc_report_compose_message(rep) << ::std::endl; 00156 } 00157 if ( actions & SC_STOP ) 00158 { 00159 sc_stop_here(rep.get_msg_type(), rep.get_severity()); 00160 sc_stop(); 00161 } 00162 if ( actions & SC_INTERRUPT ) 00163 sc_interrupt_here(rep.get_msg_type(), rep.get_severity()); 00164 00165 if ( actions & SC_ABORT ) 00166 abort(); 00167 00168 if ( actions & SC_THROW ) 00169 throw rep; 00170 }
sc_actions sc_core::sc_report_handler::get_new_action_id | ( | ) | [static] |
sc_report_handler.cpp の 561 行で定義されています。
00562 { 00563 for ( sc_actions p = 1; p; p <<= 1 ) 00564 { 00565 if ( !(p & available_actions) ) // free 00566 { 00567 available_actions |= p; 00568 return p; 00569 } 00570 } 00571 return SC_UNSPECIFIED; 00572 }
sc_report * sc_core::sc_report_handler::get_cached_report | ( | ) | [static] |
sc_report_handler.cpp の 537 行で定義されています。
00538 { 00539 sc_process_b * proc = sc_get_current_process_b(); 00540 00541 if ( proc ) 00542 return proc->get_last_report(); 00543 00544 return last_global_report; 00545 }
void sc_core::sc_report_handler::clear_cached_report | ( | ) | [static] |
sc_report_handler.cpp の 547 行で定義されています。
00548 { 00549 sc_process_b * proc = sc_get_current_process_b(); 00550 00551 if ( proc ) 00552 proc->set_last_report(0); 00553 else 00554 { 00555 if ( last_global_report ) 00556 delete last_global_report; 00557 last_global_report = 0; 00558 } 00559 }
bool sc_core::sc_report_handler::set_log_file_name | ( | const char * | filename | ) | [static] |
sc_report_handler.cpp の 574 行で定義されています。
00575 { 00576 if ( !name_ ) 00577 { 00578 free(log_file_name); 00579 log_file_name = 0; 00580 return false; 00581 } 00582 if ( log_file_name ) 00583 return false; 00584 00585 log_file_name = strdup(name_); 00586 return true; 00587 }
const char * sc_core::sc_report_handler::get_log_file_name | ( | ) | [static] |
void sc_core::sc_report_handler::add_static_msg_types | ( | msg_def_items * | items | ) | [static] |
sc_msg_def * sc_core::sc_report_handler::add_msg_type | ( | const char * | msg_type | ) | [static] |
sc_report_handler.cpp の 377 行で定義されています。
00378 { 00379 sc_msg_def * md = mdlookup(msg_type_); 00380 00381 if ( md ) 00382 return md; 00383 00384 msg_def_items * items = new msg_def_items; 00385 00386 if ( !items ) 00387 return 0; 00388 00389 items->count = 1; 00390 items->md = new sc_msg_def[items->count]; 00391 00392 if ( !items->md ) 00393 { 00394 delete items; 00395 return 0; 00396 } 00397 memset(items->md, 0, sizeof(sc_msg_def) * items->count); 00398 items->md->msg_type_data = strdup(msg_type_); 00399 items->md->id = -1; // backward compatibility with 2.0+ 00400 00401 if ( !items->md->msg_type_data ) 00402 { 00403 delete items->md; 00404 delete items; 00405 return 0; 00406 } 00407 items->md->msg_type = items->md->msg_type_data; 00408 add_static_msg_types(items); 00409 items->allocated = true; 00410 00411 return items->md; 00412 }
void sc_core::sc_report_handler::cache_report | ( | const sc_report & | rep | ) | [static, protected] |
sc_report_handler.cpp の 594 行で定義されています。
00595 { 00596 sc_process_b * proc = sc_get_current_process_b(); 00597 if ( proc ) 00598 proc->set_last_report(new sc_report(rep)); 00599 else 00600 { 00601 if ( last_global_report ) 00602 delete last_global_report; 00603 last_global_report = new sc_report(rep); 00604 } 00605 }
sc_actions sc_core::sc_report_handler::execute | ( | sc_msg_def * | md, | |
sc_severity | severity_ | |||
) | [static, protected] |
sc_report_handler.cpp の 228 行で定義されています。
00229 { 00230 sc_actions actions = md->sev_actions[severity_]; // high prio 00231 00232 if ( SC_UNSPECIFIED == actions ) // middle prio 00233 actions = md->actions; 00234 00235 if ( SC_UNSPECIFIED == actions ) // the lowest prio 00236 actions = sev_actions[severity_]; 00237 00238 actions &= ~suppress_mask; // higher than the high prio 00239 actions |= force_mask; // higher than above, and the limit is the highest 00240 00241 unsigned * limit = 0; 00242 unsigned * call_count = 0; 00243 00244 // just increment counters and check for overflow 00245 if ( md->sev_call_count[severity_] < UINT_MAX ) 00246 md->sev_call_count[severity_]++; 00247 if ( md->call_count < UINT_MAX ) 00248 md->call_count++; 00249 if ( sev_call_count[severity_] < UINT_MAX ) 00250 sev_call_count[severity_]++; 00251 00252 if ( md->limit_mask & (1 << (severity_ + 1)) ) 00253 { 00254 limit = md->sev_limit + severity_; 00255 call_count = md->sev_call_count + severity_; 00256 } 00257 if ( !limit && (md->limit_mask & 1) ) 00258 { 00259 limit = &md->limit; 00260 call_count = &md->call_count; 00261 } 00262 if ( !limit ) 00263 { 00264 limit = sev_limit + severity_; 00265 call_count = sev_call_count + severity_; 00266 } 00267 if ( *limit == 0 ) 00268 { 00269 // stop limit disabled 00270 } 00271 else if ( *limit != UINT_MAX ) 00272 { 00273 if ( *call_count >= *limit ) 00274 actions |= SC_STOP; // force sc_stop() 00275 } 00276 return actions; 00277 }
sc_msg_def * sc_core::sc_report_handler::mdlookup | ( | const char * | msg_type | ) | [static, protected] |
sc_report_handler.cpp の 216 行で定義されています。
00217 { 00218 for ( msg_def_items * item = messages; item; item = item->next ) 00219 { 00220 for ( int i = 0; i < item->count; ++i ) 00221 if ( !strcmp(msg_type_, item->md[i].msg_type) ) 00222 return item->md + i; 00223 } 00224 return 0; 00225 }
sc_msg_def * sc_core::sc_report_handler::mdlookup | ( | int | id | ) | [static, private] |
sc_report_handler.cpp の 611 行で定義されています。
00612 { 00613 for ( msg_def_items * item = messages; item; item = item->next ) 00614 { 00615 for ( int i = 0; i < item->count; ++i ) 00616 if ( id == item->md[i].id ) 00617 return item->md + i; 00618 } 00619 return 0; 00620 }
void sc_core::sc_report_handler::report | ( | sc_severity | severity_, | |
int | id, | |||
const char * | add_msg, | |||
const char * | file, | |||
int | line | |||
) | [static] |
sc_report.cpp の 179 行で定義されています。
00184 { 00185 sc_msg_def * md = sc_report_handler::mdlookup(id_); 00186 00187 if ( !md ) 00188 { 00189 md = sc_report_handler::add_msg_type(unknown_id); 00190 md->id = id_; 00191 } 00192 00193 if ( severity_ == SC_WARNING && warnings_are_errors ) 00194 severity_ = SC_ERROR; 00195 00196 sc_actions actions = execute(md, severity_); 00197 sc_report rep(severity_, md, msg_, file_, line_); 00198 00199 if ( actions & SC_CACHE_REPORT ) 00200 cache_report(rep); 00201 00202 if ( severity_ == SC_ERROR ) 00203 actions |= SC_THROW; 00204 else if ( severity_ == SC_FATAL ) 00205 actions |= SC_ABORT; 00206 00207 handler(rep, actions); 00208 }
friend class sc_report [friend] |
sc_report_handler.h の 162 行で定義されています。
sc_actions sc_core::sc_report_handler::suppress_mask = 0 [static, protected] |
sc_report_handler.h の 144 行で定義されています。
sc_actions sc_core::sc_report_handler::force_mask = 0 [static, protected] |
sc_report_handler.h の 145 行で定義されています。
sc_actions sc_core::sc_report_handler::sev_actions [static, protected] |
初期値:
{ SC_DEFAULT_INFO_ACTIONS, SC_DEFAULT_WARNING_ACTIONS, SC_DEFAULT_ERROR_ACTIONS, SC_DEFAULT_FATAL_ACTIONS }
sc_report_handler.h の 146 行で定義されています。
sc_actions sc_core::sc_report_handler::sev_limit [static, protected] |
sc_actions sc_core::sc_report_handler::sev_call_count = { 0, 0, 0, 0 } [static, protected] |
sc_report_handler.h の 148 行で定義されています。
sc_report * sc_core::sc_report_handler::last_global_report = NULL [static, protected] |
sc_report_handler.h の 149 行で定義されています。
sc_actions sc_core::sc_report_handler::available_actions [static, protected] |
初期値:
SC_DO_NOTHING | SC_THROW | SC_LOG | SC_DISPLAY | SC_CACHE_REPORT | SC_INTERRUPT | SC_STOP | SC_ABORT
sc_report_handler.h の 150 行で定義されています。
char * sc_core::sc_report_handler::log_file_name = 0 [static, protected] |
sc_report_handler.h の 151 行で定義されています。
sc_report_handler::msg_def_items * sc_core::sc_report_handler::messages [static, protected] |
sc_report_handler::msg_def_items sc_core::sc_report_handler::msg_terminator [static, protected] |
初期値:
{ default_msgs, sizeof(default_msgs)/sizeof(*default_msgs), false, NULL }
sc_report_handler.h の 154 行で定義されています。
sc_report_handler_proc sc_core::sc_report_handler::handler [static, protected] |