bbi.cxx File Reference

#include "bbtkObject.h"
#include "bbtkInterpreter.h"
#include "bbtkWxBlackBox.h"
#include "bbtkWxGUIConsole.h"
#include <wx/cmdline.h>
#include <vector>
#include <map>

Include dependency graph for bbi.cxx:

Go to the source code of this file.

Classes

struct  WxProcessCmdLine
class  wxBBIApp

Functions

 IMPLEMENT_APP_NO_MAIN (wxBBIApp)
int main (int argc, char *argv[])

Variables

static const wxCmdLineEntryDesc cmdLineDesc []


Function Documentation

IMPLEMENT_APP_NO_MAIN ( wxBBIApp   ) 

int main ( int  argc,
char *  argv[] 
)

Definition at line 244 of file bbi.cxx.

References cmdLineDesc, WxProcessCmdLine::help, WxProcessCmdLine::input_file, bbtk::InterpreterVirtual::New(), WxProcessCmdLine::no_console, WxProcessCmdLine::param_map, WxProcessCmdLine::proceed, WxProcessCmdLine::Process(), WxProcessCmdLine::text_dialog, and bbtk::VirtualExec::TextDialog.

00245 {       
00246   wxMessageOutput::Set( new wxMessageOutputBest );
00247 
00248   wxCmdLineParser parser(cmdLineDesc,argc,argv);
00249   int val = parser.Parse(false);
00250   if (val>0) 
00251     {  
00252       parser.Usage();
00253       return 0;
00254     }
00255   WxProcessCmdLine cmdline;
00256   cmdline.Process(parser);
00257 
00258   if (!cmdline.proceed) return 0;
00259 
00260   if (cmdline.no_console) 
00261     {
00262       //      std::cout << "main NC"<<std::endl;
00263       // Interpreter 
00264       bbtk::Interpreter::Pointer I = bbtk::Interpreter::New();
00265       I->SetInputs(cmdline.param_map);
00266       bool help_on_script = cmdline.help && (cmdline.input_file.size() > 0);
00267       if (help_on_script) I->SetNoExecMode(true);
00268       if (cmdline.text_dialog) I->SetDialogMode(bbtk::VirtualExec::TextDialog);
00269       std::vector<std::string>::const_iterator i;
00270       bool error = false;
00271       for (i=cmdline.input_file.begin(); 
00272            i!=cmdline.input_file.end(); ++i) 
00273         {
00274           error = ! I->InterpretFile(*i);
00275           if (error) break;
00276         }
00277       if (help_on_script) 
00278         {
00279           I->SetNoExecMode(false);
00280           std::string package; 
00281           I->GetExecuter()->GetFactory()->PrintHelpDescriptor("workspace",
00282                                                               package,
00283                                                               false);
00284         }
00285       if (cmdline.input_file.size()==0)
00286         I->CommandLineInterpreter();
00287 
00288       //
00289     }
00290   else 
00291     {
00292       wxEntry(argc, argv);
00293     }
00294 
00295 }

Here is the call graph for this function:


Variable Documentation

const wxCmdLineEntryDesc cmdLineDesc[] [static]

Initial value:

{
  { wxCMD_LINE_SWITCH, _T("h"), _T("help"),   _T("print this help or help on the application defined in input bbs file if any") },
  { wxCMD_LINE_SWITCH, _T("g"), _T("graphical-dialog"),   _T("prompt the input parameter values using graphical dialog") },
  { wxCMD_LINE_SWITCH, _T("t"), _T("text-dialog"),   _T("prompt the input parameter values in text mode") },
  { wxCMD_LINE_SWITCH, _T("c"), _T("console"), _T("open bbi console") },
  { wxCMD_LINE_SWITCH, _T("N"), _T("no-console"),   _T("never open bbi console even on error") },
  { wxCMD_LINE_SWITCH, _T("q"), _T("quiet"),   _T("be quiet (='message max 0')") },
  { wxCMD_LINE_SWITCH, _T("d"), _T("debug"), _T("turn all messages on (='message all 9')") },
  { wxCMD_LINE_SWITCH, _T("D"), _T("Debug"), _T("memory debug on exit (='debug -D')") },
  { wxCMD_LINE_PARAM,  NULL, NULL, _T("file [file [...]]"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL | wxCMD_LINE_PARAM_MULTIPLE },
  { wxCMD_LINE_NONE }
}

Definition at line 17 of file bbi.cxx.

Referenced by main(), and wxBBIApp::OnInitCmdLine().


Generated on Thu May 31 14:12:04 2012 for BBTK by  doxygen 1.5.7.1