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  ProcessCmdLine
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 243 of file bbi.cxx.

References cmdLineDesc, ProcessCmdLine::help, ProcessCmdLine::input_file, ProcessCmdLine::no_console, ProcessCmdLine::param_map, ProcessCmdLine::proceed, ProcessCmdLine::Process(), and ProcessCmdLine::text_dialog.

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

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 Wed Nov 12 11:37:09 2008 for BBTK by  doxygen 1.5.6