00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 #include "sysc/kernel/sc_cmnhdr.h"
00050 #include "sysc/kernel/sc_externs.h"
00051 #include "sysc/utils/sc_iostream.h"
00052 #include "sysc/utils/sc_report.h"
00053 #include "sysc/utils/sc_report_handler.h"
00054
00055 namespace sc_core {
00056
00057 extern void pln();
00058
00059 static int argc_copy;
00060 static char** argv_copy;
00061
00062 static
00063 inline
00064 void
00065 message_function( const char* s )
00066 {
00067 ::std::cout << "\n" << s << ::std::endl;
00068 }
00069
00070 bool sc_in_action = false;
00071
00072 int sc_argc()
00073 {
00074 return argc_copy;
00075 }
00076
00077 const char* const* sc_argv()
00078 {
00079 return argv_copy;
00080 }
00081
00082
00083 int
00084 sc_elab_and_sim( int argc, char* argv[] )
00085 {
00086 int status = 0;
00087 argc_copy = argc;
00088 argv_copy = new char*[argc];
00089 for ( int i = 0; i < argc; i++ )
00090 argv_copy[i] = argv[i];
00091
00092 try
00093 {
00094 pln();
00095
00096
00097 sc_in_action = true;
00098
00099 status = sc_main( argc, argv );
00100
00101
00102 sc_in_action = false;
00103 }
00104 catch( const sc_report& x )
00105 {
00106 message_function( x.what() );
00107 }
00108 catch( const char* s )
00109 {
00110 message_function( s );
00111 }
00112 catch( ... )
00113 {
00114 message_function( "UNKNOWN EXCEPTION OCCURED" );
00115 }
00116
00117
00118
00119 if ( sc_report_handler::get_count("/IEEE_Std_1666/deprecated") > 0 )
00120 {
00121 SC_REPORT_INFO("/IEEE_Std_1666/deprecated",
00122 "You can turn off warnings about\n" \
00123 " IEEE 1666 deprecated features by placing this method " \
00124 "call as the\n" \
00125 " first statement in your sc_main() function:\n" \
00126 "\n sc_report_handler::set_actions(\"/IEEE_Std_1666/deprecated\", " \
00127 "SC_DO_NOTHING);\n\n" );
00128 }
00129
00130 delete [] argv_copy;
00131 return status;
00132 }
00133
00134 }