]> Creatis software - cpPlugins.git/blobdiff - appli/bash/CreateInstances.cxx
debug finished
[cpPlugins.git] / appli / bash / CreateInstances.cxx
index 95d41fa2476329f365a67b526d4dc40a07e4e32e..cf73c63eabb5d2fbe1dd21dd96ece49cf5e9874c 100644 (file)
@@ -22,7 +22,7 @@ int main( int argc, char* argv[] )
   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;
@@ -71,48 +71,6 @@ int main( int argc, char* argv[] )
 
   } // 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 )(
@@ -150,9 +108,16 @@ int main( int argc, char* argv[] )
     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 )
@@ -160,8 +125,12 @@ int main( int argc, char* argv[] )
         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;