X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=appli%2Fbash%2FCreateDemanglers.cxx;h=0b90d59777f75e175332f3bc7c59ae2c5cc8acf8;hb=683fd9cb190ab6835d4c8b58eb2823dd8fbe0b8e;hp=1b34b25e97df8332f66bd045d390d40a74c5541d;hpb=6bd5a267c827df95f0c1c8f8c0af0f918bf2b31c;p=cpPlugins.git diff --git a/appli/bash/CreateDemanglers.cxx b/appli/bash/CreateDemanglers.cxx index 1b34b25..0b90d59 100644 --- a/appli/bash/CreateDemanglers.cxx +++ b/appli/bash/CreateDemanglers.cxx @@ -1,5 +1,7 @@ #include +#define MAX_NUMBER_OF_INPUTS 9 + // ------------------------------------------------------------------------- int main( int argc, char* argv[] ) { @@ -47,8 +49,8 @@ int main( int argc, char* argv[] ) // Expand data std::stringstream data; data - << "#ifndef __cpPlugins__Demangler__" << object_name << "__h__" << std::endl - << "#define __cpPlugins__Demangler__" << object_name << "__h__" << std::endl + << "#ifndef __cpPlugins__Demanglers__" << object_name << "__h__" << std::endl + << "#define __cpPlugins__Demanglers__" << object_name << "__h__" << std::endl << std::endl; for( auto cIt = commands.begin( ); cIt != commands.end( ); ++cIt ) @@ -60,38 +62,51 @@ int main( int argc, char* argv[] ) cpPlugins_bash::Expand( instances, definitions, commands, cIt->first ); TStrings toks; cpPlugins_bash::Tokenize( toks, cIt->first, "|" ); - if( toks.size( ) > 1 ) - { - data - << "#define cpPlugins_Demangle_" << object_name << "_" - << toks[ 0 ] << "( o, f, "; - for( unsigned int i = 1; i < toks.size( ); ++i ) - data << toks[ i ] << ", "; - data << "a ) \\"; - } - else - data - << "#define cpPlugins_Demangle_" << object_name << "_" - << toks[ 0 ] << "( o, f, a ) \\"; - data << std::endl; - std::string prefix = ""; - for( auto iIt = instances.begin( ); iIt != instances.end( ); ++iIt ) + for( unsigned int nIns = 1; nIns <= MAX_NUMBER_OF_INPUTS; ++nIns ) { - data - << " " << prefix - << "if( dynamic_cast< " << *iIt << "* >( o ) != NULL ) \\" - << std::endl - << " this->f( a dynamic_cast< " << *iIt << "* >( o ) ); \\" - << std::endl; - prefix = "else "; + if( toks.size( ) > 1 ) + { + data + << "#define cpPlugins_Demangle_" << object_name << "_" + << toks[ 0 ] << "_" << nIns << "( o, f"; + for( unsigned int i = 1; i < toks.size( ); ++i ) + data << ", " << toks[ i ]; + } + else + data + << "#define cpPlugins_Demangle_" << object_name << "_" + << toks[ 0 ] << "_" << nIns << "( o, f"; + + for( unsigned int i = 1; i < nIns; ++i ) + data << ", X" << i; + data << " ) \\"; + + data << std::endl; + std::string prefix = ""; + for( auto iIt = instances.begin( ); iIt != instances.end( ); ++iIt ) + { + data + << " " << prefix + << "if( dynamic_cast< " << *iIt << "* >( o ) != NULL ) \\" + << std::endl + << " this->f( dynamic_cast< " << *iIt << "* >( o )"; + + for( unsigned int i = 1; i < nIns; ++i ) + data << ", X" << i; + data + << " ); \\" + << std::endl; + prefix = "else "; + + } // rof + data << " " << prefix << std::endl << std::endl; } // rof - data << " " << prefix << std::endl << std::endl; } // rof data - << "#endif // __cpPlugins__Demangler__" << object_name << "__h__" + << "#endif // __cpPlugins__Demanglers__" << object_name << "__h__" << std::endl; if( !( cpPlugins_bash::Write( data.str( ), output_filename ) ) ) { @@ -100,20 +115,6 @@ int main( int argc, char* argv[] ) } // fi - - - /* TODO - TStrings instances; - cpPlugins_bash::Expand( instances, definitions, commands, "instances" ); - - // Build all instances - for( auto iIt = instances.begin( ); iIt != instances.end( ); ++iIt ) - { - std::cout << *iIt << std::endl; - - } // rof - */ - return( 0 ); }