|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
クラス テンプレート toppers::itron::jsp::file_generator< Policy >JSPカーネル向けカーネルオブジェクト生成クラス [詳細]
toppers::itron::jsp::file_generator< Policy >に対する継承グラフ ![]()
説明template<class Policy>
JSPカーネル向けカーネルオブジェクト生成クラス
|
|
kernel_cfg.c の生成
toppers::itron::jsp::initialization_policy・toppers::itron::jsp::termination_policyで再定義されています。 file_generator.hpp の 78 行で定義されています。 00079 { 00080 using boost::format; 00081 00082 ostr << format( "\t/* Object initializer [%1%] */\n\n" ) % static_cast<const char*>( Policy::name_ ); 00083 00084 kernel_cfg::inib_array inibs( *cfg.get_inib_array( Policy::name_ ) ); 00085 std::string SYM( toupper( Policy::symbol_ ) ); 00086 std::string TNUM; 00087 boost::shared_ptr<cmdline::option_array> options( cfg_factory::global()->options() ); 00088 00089 if ( Policy::use_id_ ) 00090 { 00091 // ID番号の数と最大値 00092 TNUM = "TNUM_" + SYM + "ID"; 00093 ostr << format( "#define %1% %2%\n\n" ) % TNUM % inibs.size(); 00094 // ostr << format( "const ID _kernel_tmax_%1%id = (TMIN_%2%ID + %3% - 1);\n\n" ) % static_cast<const char*>( Policy::symbol_ ) % SYM % TNUM; 00095 /* @chg 2004-04-03 TMIN_xxID の廃止による変更 */ 00096 ostr << format( "const ID _kernel_tmax_%1%id = (TMIN_ID + %2% - 1);\n\n" ) % static_cast<const char*>( Policy::symbol_ ) % TNUM; 00097 } 00098 else 00099 { 00100 // オブジェクト番号の数と最大値 00101 TNUM = "TNUM_" + SYM + "NO"; 00102 ostr << format( "#define %1% %2%\n\n" ) % TNUM % inibs.size(); 00103 ostr << format( "const UINT _kernel_tnum_%1%no = %2%;\n\n" ) % static_cast<const char*>( Policy::symbol_ ) % TNUM; 00104 } 00105 00106 std::string prefix( Policy::prefix_ == 0 ? Policy::symbol_ : Policy::prefix_ ); 00107 std::string PREFIX( toupper( prefix ) ); 00108 if ( inibs.empty() ) 00109 { 00110 if ( !options->find( "-z" ) ) 00111 { 00112 // オブジェクトが一つもない場合のダミーラベルの出力 00113 ostr << format( "__EMPTY_LABEL(const %1%INIB, _kernel_%2%inib_table);\n" ) % PREFIX % prefix; 00114 if ( Policy::use_id_ ) 00115 { 00116 ostr << format( "__EMPTY_LABEL(%1%CB, _kernel_%2%cb_table);\n" ) % PREFIX % prefix; 00117 } 00118 Policy::generate_extra_empty_labels( ostr ); 00119 ostr << '\n'; 00120 } 00121 } 00122 else 00123 { 00124 std::sort( inibs.begin(), inibs.end(), &kernel_cfg::initial_block::less_than ); 00125 00126 // 領域定義の生成 00127 std::transform( inibs.begin(), inibs.end(), std::ostream_iterator<std::string>( ostr ), typename Policy::generator( Policy::region_format_ ) ); 00128 ostr << '\n'; 00129 00130 // 初期化ブロック定義の生成 00131 ostr << format( "const %1%INIB _kernel_%2%inib_table[%3%] = {\n" ) % PREFIX % prefix % TNUM; 00132 output_list( inibs.begin(), inibs.end(), ostr, typename Policy::generator( Policy::init_format_ ), ",\n" ); 00133 ostr << "\n};\n\n"; 00134 00135 // その他の変数定義(RAM領域)の出力 00136 Policy::generate_variables( cfg, ostr ); 00137 00138 // 制御ブロック定義の出力 00139 if ( Policy::use_id_ ) 00140 { 00141 ostr << format( "%1%CB _kernel_%2%cb_table[%3%];\n\n" ) % PREFIX % prefix % TNUM; 00142 } 00143 00144 // その他の定数定義(ROM領域)の出力 00145 Policy::generate_constants( cfg, ostr ); 00146 00147 // ID番号を格納した広域変数の出力 00148 if ( Policy::use_id_ ) 00149 { 00150 if ( options->find( "-var" ) ) 00151 { 00152 ostr << "\t/* Identifier storage variables */\n"; 00153 std::transform( inibs.begin(), inibs.end(), std::ostream_iterator<std::string>( ostr ), typename Policy::generator( "const int @name\\_id = @id;\n" ) ); 00154 ostr << '\n'; 00155 } 00156 } 00157 00158 // アサーションコードの出力 00159 if ( options->find( "-c" ) ) 00160 { 00161 Policy::generate_assertions( cfg, ostr ); 00162 } 00163 } 00164 }
|
|
kernel_id.h の生成
file_generator.hpp の 171 行で定義されています。 00172 { 00173 const kernel_id::id_array* pids = id_cfg.get_id_array( Policy::name_ ); 00174 if ( pids != 0 ) 00175 { 00176 typedef kernel_id::id_array::const_iterator idb_iterator; 00177 for ( idb_iterator iter( pids->begin() ), last( pids->end() ); iter != last; ++iter ) 00178 { 00179 std::string name( ( *iter )->name() ); 00180 if ( !name.empty() ) 00181 { 00182 ostr << "#define " << name << '\t' << ( *iter )->value() << '\n'; 00183 } 00184 } 00185 } 00186 }
|