1 #include "bbstdExecBbiCommand.h"
2 #include "bbstdPackage.h"
3 #include "bbtkInterpreter.h"
4 #include "bbtkExecuter.h"
9 BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,ExecBbiCommand);
10 BBTK_USER_BLACK_BOX_IMPLEMENTATION(ExecBbiCommand,bbtk::AtomicBlackBox);
12 void ExecBbiCommand::bbUserConstructor()
18 void ExecBbiCommand::DoProcess()
20 // Look for the interpreter
21 bbtk::Interpreter* I = 0;
22 bool delete_inter = false;
23 if (bbGetParent() != 0)
25 bbtk::Factory* f = ((bbtk::ComplexBlackBoxDescriptor*)bbGetParent()
26 ->bbGetDescriptor())->GetFactory();
30 I = f->GetExecuter()->GetInterpreter();
35 // bbtkError("ExecBbiCommand::DoProcess() : could not find interpreter");
36 I = new bbtk::Interpreter();
44 pos2 = bbGetInputIn().find(";",pos1);
51 ccommand=bbGetInputIn().substr(pos1,bbGetInputIn().length()-pos1 );
53 ccommand=bbGetInputIn().substr(pos1,pos2-pos1);
55 for ( i=0 ; i < ccommand.length() ; i++)
63 I->InterpretLine( ccommand );
65 pos2 = bbGetInputIn().find(";",pos2+1);
69 if (delete_inter) delete I;
71 /* Grrr not works in windows
73 pch = strtok (bbGetInputIn(),";");
76 std::string ccommand(pch);
77 printf("EED ExecBbiCommand::DoProcess 1.1 %s\n",ccommand.c_str());
78 for ( i=0 ; i < ccommand.length() ; i++)
86 printf("EED ExecBbiCommand::DoProcess 2 %s\n",ccommand.c_str());
87 bbtk::Interpreter::mGlobalInterpreter->InterpretLine( ccommand );
88 pch = strtok (NULL, ";");
94 } // EO namespace bbstd