]> Creatis software - bbtk.git/commitdiff
*** empty log message ***
authorjean-pierre roux <jean-pierre.roux@creatis.insa-lyon.fr>
Mon, 6 Oct 2008 09:06:51 +0000 (09:06 +0000)
committerjean-pierre roux <jean-pierre.roux@creatis.insa-lyon.fr>
Mon, 6 Oct 2008 09:06:51 +0000 (09:06 +0000)
packages/std/src/bbstdExecBbiCommand.cxx
packages/std/src/bbstdExecSystemCommand.cxx
packages/std/src/bbstdExecSystemCommand.h

index 903ea5db7e34e6a59c46f102b01f7703ed0afc86..aab102e8288ac759327a192a7a38ecfa6634fe5b 100755 (executable)
@@ -13,17 +13,16 @@ namespace bbstd
   { 
     bbSetInputIn("help");
   }
-  
 
   void ExecBbiCommand::DoProcess()
     {
-     
+
       // Look for the interpreter
       bbtk::Interpreter::Pointer I;
-         bool delete_inter = false; 
-         if (bbGetParent() != 0) 
-       {
-         bbtk::Factory::Pointer f 
+         bool delete_inter = false;
+         if (bbGetParent() != 0)
+         {
+         bbtk::Factory::Pointer f
                = ((bbtk::ComplexBlackBoxDescriptor*)bbGetParent()
                  ->bbGetDescriptor().get())->GetFactory();
          if ((f != 0)&&
@@ -31,46 +30,46 @@ namespace bbstd
            {
              I = f->GetExecuter()->GetInterpreter();
            }
-       }
-      if (I==0) 
-       {
+         }
+      if (I==0)
+         {
          //      bbtkError("ExecBbiCommand::DoProcess() : could not find interpreter");
          I = bbtk::Interpreter::New();
-         delete_inter = true; 
-       }
+         delete_inter = true;
+         }
 
       unsigned int i;
-      
+
       bool ok=true;
       int pos1=0,pos2;
       pos2 = bbGetInputIn().find(";",pos1);
       std::string ccommand;
       while (ok==true)
-       {
-         if (pos2==-1) 
            {
-             ok=false;
-             ccommand=bbGetInputIn().substr(pos1,bbGetInputIn().length()-pos1 );
-           } else {
+         if (pos2==-1) 
+          {
+           ok=false;
+           ccommand=bbGetInputIn().substr(pos1,bbGetInputIn().length()-pos1 );
+          } else {
            ccommand=bbGetInputIn().substr(pos1,pos2-pos1);
          }
          for ( i=0 ; i < ccommand.length() ; i++)
+         {
+           if (ccommand[i]==39)
            {
-             if (ccommand[i]==39)
-               {
                  ccommand[i]=34;
-               }
-           }           
-       
+        }
+     }
+
          I->InterpretLine( ccommand );
          pos1=pos2+1;
          pos2 = bbGetInputIn().find(";",pos2+1);
-         
+
        }
       
 //      if (delete_inter) delete I;
-      
-      /*  Grrr  not works in windows
+
+   /*  Grrr  not works in windows
        char * pch;
        pch = strtok (bbGetInputIn(),";");
        while (pch != NULL)
@@ -83,16 +82,14 @@ namespace bbstd
                        {
                                ccommand[i]=34;
                        }
-               }               
+               }
 
                printf("EED  ExecBbiCommand::DoProcess 2  %s\n",ccommand.c_str());
                bbtk::Interpreter::mGlobalInterpreter->InterpretLine( ccommand );
        pch = strtok (NULL, ";");
        }
-*/
-}
-
-
+  */
+  }
 } // EO namespace bbstd
 
 
index 1e8ee9e8c2d8bef4736b8ff4c554e08d5b943751..a2daacbfed87dca4d3324e88697b2f3004599e3c 100755 (executable)
@@ -7,13 +7,12 @@ namespace bbstd
 
   BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,ExecSystemCommand);
   BBTK_BLACK_BOX_IMPLEMENTATION(ExecSystemCommand,bbtk::AtomicBlackBox);
-  
+
   void ExecSystemCommand::bbUserConstructor() 
   { 
     bbSetInputIn("help");
   }
-  
-  
+
   void ExecSystemCommand::DoProcess()
   {
     bool ok=true;
@@ -21,29 +20,28 @@ namespace bbstd
     pos2 = bbGetInputIn().find(";",pos1);
     std::string ccommand;
     while (ok)
-      {                        
+      {
        if (pos2==-1) 
          {
            ok=false;
            ccommand=bbGetInputIn().substr(pos1,bbGetInputIn().length()-pos1 );
-         } 
-       else 
-         {
+          } else {
            ccommand=bbGetInputIn().substr(pos1,pos2-pos1);
          }
-       for (unsigned int i=0 ; i < ccommand.length() ; i++)
+         for (unsigned int i=0 ; i < ccommand.length() ; i++)
          {
            if (ccommand[i]==39)
-             {
-               ccommand[i]=34;
-             }
-         }     
+           {
+                 ccommand[i]=34;
+        }
+     }
        std::cout << "*** Executing system command : '"<<ccommand<<"'"<<std::endl;
        system ( ccommand.c_str() );
        pos1=pos2+1;
        pos2 = bbGetInputIn().find(";",pos2+1);
       }
-    /*
+
+    /* Grrr  not works in windows
       int i;
       char *str = (char*)bbGetInputIn().c_str();
       char * pch;
@@ -57,17 +55,15 @@ namespace bbstd
       {
       ccommand[i]=34;
       }
-      }                
+      }
       
       // bbtk::Interpreter::mGlobalInterpreter->InterpretLine( ccommand );
       system ( ccommand.c_str() );
       pch = strtok (NULL, ";");
       }
-      //      bbSetOutputOut( bbGetInputIn() );          
-      */
+      //      bbSetOutputOut( bbGetInputIn() );
+  */
   }
-  
-  
 } // EO namespace bbstd
 
 
index 9f070b80904fbdcc2af947effab0f2c2f75f45f4..281807c613f5a92dc2a0dbaaf6857358b47b604a 100755 (executable)
@@ -8,27 +8,25 @@ namespace bbstd
 
   class ExecSystemCommand
     : 
-    public bbtk::AtomicBlackBox
+  public bbtk::AtomicBlackBox
   {
+  public:
     BBTK_BLACK_BOX_INTERFACE(ExecSystemCommand,bbtk::AtomicBlackBox);
-    BBTK_DECLARE_INPUT(In,std::string);
-    //    BBTK_DECLARE_OUTPUT(Out,std::string);
+    BBTK_DECLARE_INPUT(In,std::string)
     BBTK_PROCESS(DoProcess);
     void DoProcess();
 
   protected:
     virtual void bbUserConstructor();
-
   };
 
   BBTK_BEGIN_DESCRIBE_BLACK_BOX(ExecSystemCommand,bbtk::AtomicBlackBox);
   BBTK_NAME("ExecSystemCommand");
   BBTK_AUTHOR("eduardo.davila@creatis.insa-lyon.fr");
-  BBTK_DESCRIPTION("Execute bbi commands");
-  BBTK_INPUT(ExecSystemCommand,In,"bbi commands separated by ';' , use '' to indicate strings ex. help 'graph' ",std::string,"");  
-  //  BBTK_OUTPUT(ExecSystemCommand,Out,"Concatenated string",std::string);
+  BBTK_DESCRIPTION("Executes system (O.S.) commands");
+  BBTK_INPUT(ExecSystemCommand,In,"system (O.S.) commands separated by ';' , use '' to indicate strings ex. help 'graph' ",std::string,"");  
   BBTK_END_DESCRIBE_BLACK_BOX(ExecSystemCommand);
-  
+
 } // EO namespace bbstd
 
 #endif //  __bbstdExecSystemCommand_h_INCLUDED__