]> Creatis software - bbtk.git/blob - packages/std/src/bbstdExecBbiCommand.cxx
*** empty log message ***
[bbtk.git] / packages / std / src / bbstdExecBbiCommand.cxx
1 #include "bbstdExecBbiCommand.h"
2 #include "bbstdPackage.h"
3 #include "bbtkInterpreter.h"
4
5 namespace bbstd
6 {
7
8   BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,ExecBbiCommand);
9   BBTK_USER_BLACK_BOX_IMPLEMENTATION(ExecBbiCommand,bbtk::AtomicBlackBox);
10
11   void ExecBbiCommand::bbUserConstructor() 
12   { 
13     bbSetInputIn("help");
14   }
15   
16
17   void ExecBbiCommand::DoProcess()
18     {
19         int i;
20         
21         bool ok=true;
22         int pos1=0,pos2;
23         pos2 = bbGetInputIn().find(";",pos1);
24         std::string ccommand;
25         while (ok==true)
26         {
27                 if (pos2==-1) 
28                 {
29                         ok=false;
30                         ccommand=bbGetInputIn().substr(pos1,bbGetInputIn().length()-pos1 );
31                 } else {
32                         ccommand=bbGetInputIn().substr(pos1,pos2-pos1);
33                 }
34                 for ( i=0 ; i < ccommand.length() ; i++)
35                 {
36                         if (ccommand[i]==39)
37                         {
38                                 ccommand[i]=34;
39                         }
40                 }               
41       bool insideComment = false; // for multiline comment
42                 bbtk::Interpreter::mGlobalInterpreter->InterpretLine( ccommand, insideComment);
43                 pos1=pos2+1;
44                 pos2 = bbGetInputIn().find(";",pos2+1);
45
46         }
47         
48
49
50 /*  Grrr  not works in windows
51         char * pch;
52         pch = strtok (bbGetInputIn(),";");
53         while (pch != NULL)
54         {
55                 std::string ccommand(pch);
56                 printf("EED  ExecBbiCommand::DoProcess 1.1  %s\n",ccommand.c_str());
57                 for ( i=0 ; i < ccommand.length() ; i++)
58                 {
59                         if (ccommand[i]==39)
60                         {
61                                 ccommand[i]=34;
62                         }
63                 }               
64
65                 printf("EED  ExecBbiCommand::DoProcess 2  %s\n",ccommand.c_str());
66                 bbtk::Interpreter::mGlobalInterpreter->InterpretLine( ccommand );
67         pch = strtok (NULL, ";");
68         }
69 */
70 }
71
72
73 } // EO namespace bbstd
74
75