std::string definitions_buffer;
if( !( cpPlugins_bash::Read( definitions_buffer, definitions_filename ) ) )
{
- std::cout
+ std::cerr
<< argv[ 0 ]
<< ": Error reading definitions file \"" << definitions_filename
<< "\"" << std::endl;
} // rof
- // Prepare header file
- std::stringstream header;
- header
- << "// Automaticaly generated file. Please do not modify." << std::endl
- << "#ifndef __" << library_name << "__h__" << std::endl
- << "#define __" << library_name << "__h__" << std::endl << std::endl;
-
- auto hIt = commands.find( "header" );
- if( hIt != commands.end( ) )
- {
- for( auto vIt = hIt->second.begin( ); vIt != hIt->second.end( ); ++vIt )
- header << *vIt << std::endl;
- header << std::endl;
-
- } // fi
-
- if( tfiles.size( ) > 0 )
- {
- for( auto tIt = tfiles.begin( ); tIt != tfiles.end( ); ++tIt )
- {
- TStrings toks;
- cpPlugins_bash::Tokenize( toks, *tIt, ":|" );
- if( toks.size( ) == 3 )
- header
- << "#include <" << toks[ 0 ] << "." << toks[ 1 ] << ">" << std::endl;
-
- } // rof
- header << std::endl;
-
- } // fi
- header << "#endif // __" << library_name << "__h__" << std::endl;
-
- // Write header
- std::stringstream header_filename;
- header_filename << output_prefix << ".h";
- if( !( cpPlugins_bash::Write( header.str( ), header_filename.str( ) ) ) )
- {
- std::cerr << "Error writing header file." << std::endl;
- return( 1 );
-
- } // fi
-
// Write source code
unsigned int instances_per_file =
( unsigned int )(
source
<< "#include <" << library_name << "_Export.h>"
<< std::endl;
- source
- << "#include <" << output_prefix << ".h>"
- << std::endl << std::endl;
+ auto hIt = commands.find( "header" );
+ if( hIt != commands.end( ) )
+ {
+ source << std::endl;
+ for( auto vIt = hIt->second.begin( ); vIt != hIt->second.end( ); ++vIt )
+ source << *vIt << std::endl;
+ source << std::endl;
+
+ } // fi
+
if( tfiles.size( ) > 0 )
{
for( auto tIt = tfiles.begin( ); tIt != tfiles.end( ); ++tIt )
TStrings toks;
cpPlugins_bash::Tokenize( toks, *tIt, ":|" );
if( toks.size( ) == 3 )
+ {
+ source << "#include <" << toks[ 0 ] << "." << toks[ 1 ] << ">" << std::endl;
source << "#include <" << toks[ 0 ] << "." << toks[ 2 ] << ">" << std::endl;
+ } // fi
+
} // rof
source << std::endl;