112027Sjungma@eit.uni-kl.de/***************************************************************************** 212027Sjungma@eit.uni-kl.de 312027Sjungma@eit.uni-kl.de Licensed to Accellera Systems Initiative Inc. (Accellera) under one or 412027Sjungma@eit.uni-kl.de more contributor license agreements. See the NOTICE file distributed 512027Sjungma@eit.uni-kl.de with this work for additional information regarding copyright ownership. 612027Sjungma@eit.uni-kl.de Accellera licenses this file to you under the Apache License, Version 2.0 712027Sjungma@eit.uni-kl.de (the "License"); you may not use this file except in compliance with the 812027Sjungma@eit.uni-kl.de License. You may obtain a copy of the License at 912027Sjungma@eit.uni-kl.de 1012027Sjungma@eit.uni-kl.de http://www.apache.org/licenses/LICENSE-2.0 1112027Sjungma@eit.uni-kl.de 1212027Sjungma@eit.uni-kl.de Unless required by applicable law or agreed to in writing, software 1312027Sjungma@eit.uni-kl.de distributed under the License is distributed on an "AS IS" BASIS, 1412027Sjungma@eit.uni-kl.de WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 1512027Sjungma@eit.uni-kl.de implied. See the License for the specific language governing 1612027Sjungma@eit.uni-kl.de permissions and limitations under the License. 1712027Sjungma@eit.uni-kl.de 1812027Sjungma@eit.uni-kl.de *****************************************************************************/ 1912027Sjungma@eit.uni-kl.de 2012027Sjungma@eit.uni-kl.de/***************************************************************************** 2112027Sjungma@eit.uni-kl.de 2212027Sjungma@eit.uni-kl.de sc_report_handler.h - 2312027Sjungma@eit.uni-kl.de 2412027Sjungma@eit.uni-kl.de Original Author: Alex Riesen, Synopsys, Inc. 2512027Sjungma@eit.uni-kl.de see also sc_report.h 2612027Sjungma@eit.uni-kl.de 2712027Sjungma@eit.uni-kl.de CHANGE LOG AT END OF FILE 2812027Sjungma@eit.uni-kl.de *****************************************************************************/ 2912027Sjungma@eit.uni-kl.de 3012027Sjungma@eit.uni-kl.de#ifndef SC_REPORT_HANDLER_H 3112027Sjungma@eit.uni-kl.de#define SC_REPORT_HANDLER_H 3212027Sjungma@eit.uni-kl.de 3312027Sjungma@eit.uni-kl.denamespace sc_core { 3412027Sjungma@eit.uni-kl.de 3512027Sjungma@eit.uni-kl.de// ---------------------------------------------------------------------------- 3612027Sjungma@eit.uni-kl.de// STRUCT : sc_msg_def 3712027Sjungma@eit.uni-kl.de// 3812027Sjungma@eit.uni-kl.de// Exception message definition structure 3912027Sjungma@eit.uni-kl.de// ---------------------------------------------------------------------------- 4012027Sjungma@eit.uni-kl.de 4112027Sjungma@eit.uni-kl.destruct sc_msg_def 4212027Sjungma@eit.uni-kl.de{ 4312027Sjungma@eit.uni-kl.de const char* msg_type; 4412027Sjungma@eit.uni-kl.de sc_actions actions; 4512027Sjungma@eit.uni-kl.de sc_actions sev_actions[SC_MAX_SEVERITY]; 4612027Sjungma@eit.uni-kl.de unsigned limit; 4712027Sjungma@eit.uni-kl.de unsigned sev_limit[SC_MAX_SEVERITY]; 4812027Sjungma@eit.uni-kl.de unsigned limit_mask; // 0 - limit, 1..4 - sev_limit 4912027Sjungma@eit.uni-kl.de unsigned call_count; 5012027Sjungma@eit.uni-kl.de unsigned sev_call_count[SC_MAX_SEVERITY]; 5112027Sjungma@eit.uni-kl.de char* msg_type_data; 5212027Sjungma@eit.uni-kl.de 5312027Sjungma@eit.uni-kl.de int id; // backward compatibility with 2.0+ 5412027Sjungma@eit.uni-kl.de}; 5512027Sjungma@eit.uni-kl.de 5612027Sjungma@eit.uni-kl.detypedef void (* sc_report_handler_proc)(const sc_report&, const sc_actions &); 5712027Sjungma@eit.uni-kl.declass sc_report; 5812027Sjungma@eit.uni-kl.deextern bool sc_report_close_default_log(); 5912027Sjungma@eit.uni-kl.declass sc_report_handler 6012027Sjungma@eit.uni-kl.de{ 6112027Sjungma@eit.uni-kl.depublic: 6212027Sjungma@eit.uni-kl.de static void report(sc_severity, 6312027Sjungma@eit.uni-kl.de const char* msg_type, 6412027Sjungma@eit.uni-kl.de const char* msg, 6512027Sjungma@eit.uni-kl.de const char* file, 6612027Sjungma@eit.uni-kl.de int line); 6712027Sjungma@eit.uni-kl.de 6812027Sjungma@eit.uni-kl.de static void report( sc_severity, 6912027Sjungma@eit.uni-kl.de const char* msg_type, 7012027Sjungma@eit.uni-kl.de const char* msg, 7112027Sjungma@eit.uni-kl.de int verbosity, 7212027Sjungma@eit.uni-kl.de const char* file, 7312027Sjungma@eit.uni-kl.de int line ); 7412027Sjungma@eit.uni-kl.de 7512027Sjungma@eit.uni-kl.de static sc_actions set_actions(sc_severity, 7612027Sjungma@eit.uni-kl.de sc_actions = SC_UNSPECIFIED); 7712027Sjungma@eit.uni-kl.de 7812027Sjungma@eit.uni-kl.de static sc_actions set_actions(const char * msg_type, 7912027Sjungma@eit.uni-kl.de sc_actions = SC_UNSPECIFIED); 8012027Sjungma@eit.uni-kl.de 8112027Sjungma@eit.uni-kl.de static sc_actions set_actions(const char * msg_type, 8212027Sjungma@eit.uni-kl.de sc_severity, 8312027Sjungma@eit.uni-kl.de sc_actions = SC_UNSPECIFIED); 8412027Sjungma@eit.uni-kl.de 8512027Sjungma@eit.uni-kl.de static int stop_after(sc_severity, int limit = -1); 8612027Sjungma@eit.uni-kl.de static int stop_after(const char* msg_type, int limit = -1); 8712027Sjungma@eit.uni-kl.de static int stop_after(const char* msg_type, sc_severity, int limit = -1); 8812027Sjungma@eit.uni-kl.de 8912027Sjungma@eit.uni-kl.de static sc_actions suppress(sc_actions); 9012027Sjungma@eit.uni-kl.de static sc_actions suppress(); 9112027Sjungma@eit.uni-kl.de static sc_actions force(sc_actions); 9212027Sjungma@eit.uni-kl.de static sc_actions force(); 9312027Sjungma@eit.uni-kl.de 9412027Sjungma@eit.uni-kl.de static int get_count(sc_severity severity_); 9512027Sjungma@eit.uni-kl.de static int get_count(const char* msg_type_); 9612027Sjungma@eit.uni-kl.de static int get_count(const char* msg_type_, sc_severity severity_); 9712027Sjungma@eit.uni-kl.de 9812027Sjungma@eit.uni-kl.de static int get_verbosity_level(); 9912027Sjungma@eit.uni-kl.de static int set_verbosity_level( int level ); 10012027Sjungma@eit.uni-kl.de 10112027Sjungma@eit.uni-kl.de 10212027Sjungma@eit.uni-kl.de static void initialize(); // just reset counters 10312027Sjungma@eit.uni-kl.de static void release(); // initialize() needed for reports after it 10412027Sjungma@eit.uni-kl.de 10512027Sjungma@eit.uni-kl.de static sc_report_handler_proc set_handler(sc_report_handler_proc); 10612027Sjungma@eit.uni-kl.de static sc_report_handler_proc get_handler(); 10712027Sjungma@eit.uni-kl.de // use set_handler(NULL); to restore default handler 10812027Sjungma@eit.uni-kl.de static void default_handler(const sc_report&, const sc_actions&); 10912027Sjungma@eit.uni-kl.de 11012027Sjungma@eit.uni-kl.de static sc_actions get_new_action_id(); 11112027Sjungma@eit.uni-kl.de 11212027Sjungma@eit.uni-kl.de static sc_report* get_cached_report(); 11312027Sjungma@eit.uni-kl.de static void clear_cached_report(); 11412027Sjungma@eit.uni-kl.de 11512027Sjungma@eit.uni-kl.de // if filename is NULL, the previous log file name will be removed. 11612027Sjungma@eit.uni-kl.de // The provider of a report_handler supposed to handle this. 11712027Sjungma@eit.uni-kl.de // Return false if filename is not NULL and filename is already set. 11812027Sjungma@eit.uni-kl.de static bool set_log_file_name(const char* filename); 11912027Sjungma@eit.uni-kl.de static const char* get_log_file_name(); 12012027Sjungma@eit.uni-kl.de 12112027Sjungma@eit.uni-kl.depublic: // private, actually 12212027Sjungma@eit.uni-kl.de 12312027Sjungma@eit.uni-kl.de struct msg_def_items 12412027Sjungma@eit.uni-kl.de { 12512027Sjungma@eit.uni-kl.de sc_msg_def* md; // have to point to sc_msg_def-s 12612027Sjungma@eit.uni-kl.de int count; // set to number of items in md[] 12712027Sjungma@eit.uni-kl.de bool allocated; // used internally, previous value ignored 12812027Sjungma@eit.uni-kl.de msg_def_items* next; // used internally, previous value ignored 12912027Sjungma@eit.uni-kl.de }; 13012027Sjungma@eit.uni-kl.de 13112027Sjungma@eit.uni-kl.de static void add_static_msg_types(msg_def_items *); 13212027Sjungma@eit.uni-kl.de static sc_msg_def* add_msg_type(const char * msg_type); 13312027Sjungma@eit.uni-kl.de 13412027Sjungma@eit.uni-kl.deprotected: 13512027Sjungma@eit.uni-kl.de 13612027Sjungma@eit.uni-kl.de static void cache_report(const sc_report&); 13712027Sjungma@eit.uni-kl.de static sc_actions execute(sc_msg_def*, sc_severity); 13812027Sjungma@eit.uni-kl.de 13912027Sjungma@eit.uni-kl.de static sc_actions suppress_mask; 14012027Sjungma@eit.uni-kl.de static sc_actions force_mask; 14112027Sjungma@eit.uni-kl.de static sc_actions sev_actions[SC_MAX_SEVERITY]; 14212027Sjungma@eit.uni-kl.de static unsigned sev_limit[SC_MAX_SEVERITY]; 14312027Sjungma@eit.uni-kl.de static unsigned sev_call_count[SC_MAX_SEVERITY]; 14412027Sjungma@eit.uni-kl.de static sc_report* last_global_report; 14512027Sjungma@eit.uni-kl.de static sc_actions available_actions; 14612027Sjungma@eit.uni-kl.de static char* log_file_name; 14712027Sjungma@eit.uni-kl.de static int verbosity_level; 14812027Sjungma@eit.uni-kl.de 14912027Sjungma@eit.uni-kl.de static msg_def_items* messages; 15012027Sjungma@eit.uni-kl.de static msg_def_items msg_terminator; 15112027Sjungma@eit.uni-kl.de 15212027Sjungma@eit.uni-kl.de static sc_report_handler_proc handler; 15312027Sjungma@eit.uni-kl.de 15412027Sjungma@eit.uni-kl.de static sc_msg_def* mdlookup(const char* msg_type); 15512027Sjungma@eit.uni-kl.de 15612027Sjungma@eit.uni-kl.deprivate: // backward compatibility with 2.0+ 15712027Sjungma@eit.uni-kl.de 15812027Sjungma@eit.uni-kl.de friend class sc_report; 15912027Sjungma@eit.uni-kl.de static sc_msg_def* mdlookup(int id); 16012027Sjungma@eit.uni-kl.de 16112027Sjungma@eit.uni-kl.depublic: 16212027Sjungma@eit.uni-kl.de 16312027Sjungma@eit.uni-kl.de static void report(sc_severity, 16412027Sjungma@eit.uni-kl.de int id, 16512027Sjungma@eit.uni-kl.de const char* add_msg, 16612027Sjungma@eit.uni-kl.de const char* file, 16712027Sjungma@eit.uni-kl.de int line); 16812027Sjungma@eit.uni-kl.de 16912027Sjungma@eit.uni-kl.de}; 17012027Sjungma@eit.uni-kl.de 17112027Sjungma@eit.uni-kl.de} // namespace sc_core 17212027Sjungma@eit.uni-kl.de 17312027Sjungma@eit.uni-kl.de// $Log: sc_report_handler.h,v $ 17412027Sjungma@eit.uni-kl.de// Revision 1.5 2011/08/26 20:46:19 acg 17512027Sjungma@eit.uni-kl.de// Andy Goodrich: moved the modification log to the end of the file to 17612027Sjungma@eit.uni-kl.de// eliminate source line number skew when check-ins are done. 17712027Sjungma@eit.uni-kl.de// 17812027Sjungma@eit.uni-kl.de// Revision 1.4 2011/03/23 16:16:49 acg 17912027Sjungma@eit.uni-kl.de// Andy Goodrich: finish message verbosity support. 18012027Sjungma@eit.uni-kl.de// 18112027Sjungma@eit.uni-kl.de// Revision 1.3 2011/02/18 20:38:44 acg 18212027Sjungma@eit.uni-kl.de// Andy Goodrich: Updated Copyright notice. 18312027Sjungma@eit.uni-kl.de// 18412027Sjungma@eit.uni-kl.de// Revision 1.2 2011/02/01 23:02:05 acg 18512027Sjungma@eit.uni-kl.de// Andy Goodrich: IEEE 1666 2011 changes. 18612027Sjungma@eit.uni-kl.de// 18712027Sjungma@eit.uni-kl.de// Revision 1.1.1.1 2006/12/15 20:20:06 acg 18812027Sjungma@eit.uni-kl.de// SystemC 2.3 18912027Sjungma@eit.uni-kl.de// 19012027Sjungma@eit.uni-kl.de// Revision 1.3 2006/01/13 18:53:11 acg 19112027Sjungma@eit.uni-kl.de// Andy Goodrich: Added $Log command so that CVS comments are reproduced in 19212027Sjungma@eit.uni-kl.de// the source. 19312027Sjungma@eit.uni-kl.de// 19412027Sjungma@eit.uni-kl.de 19512027Sjungma@eit.uni-kl.de#endif 19612027Sjungma@eit.uni-kl.de 19712027Sjungma@eit.uni-kl.de// Taf! 198