X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=bash%2FCreateDemanglers.cxx;fp=bash%2FCreateDemanglers.cxx;h=0000000000000000000000000000000000000000;hb=2e142df11d6f312a2a2b5097b8da73571ed523e8;hp=a68117f3a34ebe32d59efb6c5509a712fe831669;hpb=61b3659afe961ed248f30e26f9ca8f28fcfafddc;p=cpPlugins.git diff --git a/bash/CreateDemanglers.cxx b/bash/CreateDemanglers.cxx deleted file mode 100644 index a68117f..0000000 --- a/bash/CreateDemanglers.cxx +++ /dev/null @@ -1,121 +0,0 @@ -#include - -#define MAX_NUMBER_OF_INPUTS 9 - -// ------------------------------------------------------------------------- -int main( int argc, char* argv[] ) -{ - // Get inputs - if( argc < 4 ) - { - std::cerr - << "Usage: " << argv[ 0 ] - << " definitons_file object_name output_file" - << std::endl; - return( 1 ); - - } // fi - std::string definitions_filename = argv[ 1 ]; - std::string object_name = argv[ 2 ]; - std::string output_filename = argv[ 3 ]; - - // Read inputs - std::string definitions_buffer; - if( !( cpPlugins_bash::Read( definitions_buffer, definitions_filename ) ) ) - { - std::cerr - << argv[ 0 ] - << ": Error reading definitions file \"" << definitions_filename - << "\"" << std::endl; - return( 1 ); - - } // fi - - // Put it in a line-by-line structure - TStrings definitions_lines; - cpPlugins_bash::Tokenize( definitions_lines, definitions_buffer, "\n" ); - - // Parse input file - TCommands commands; - cpPlugins_bash::Parse( commands, definitions_lines ); - - // Load pre-compiled definitions - cpPlugins_bash::LoadDefinitions( commands ); - - // Expand definitions - TCommands definitions; - cpPlugins_bash::ExpandDefinitions( definitions, commands ); - - // Expand data - std::stringstream data; - data - << "#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 ) - { - if( cIt->first == "define" ) - continue; - - TStrings instances; - cpPlugins_bash::Expand( instances, definitions, commands, cIt->first ); - TStrings toks; - cpPlugins_bash::Tokenize( toks, cIt->first, "|" ); - for( unsigned int nIns = 1; nIns <= MAX_NUMBER_OF_INPUTS; ++nIns ) - { - 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 - - } // rof - - data - << "#endif // __cpPlugins__Demanglers__" << object_name << "__h__" - << std::endl; - if( !( cpPlugins_bash::Write( data.str( ), output_filename ) ) ) - { - std::cerr << "Error writing file." << std::endl; - return( 1 ); - - } // fi - - return( 0 ); -} - -// eof - $RCSfile$