SET_TARGET_PROPERTIES(bbi PROPERTIES LINK_FLAGS -mconsole )
ELSE(MINGW)
SET_TARGET_PROPERTIES(bbi PROPERTIES LINK_FLAGS /subsystem:console )
+# SET_TARGET_PROPERTIES(bbi PROPERTIES LINK_FLAGS )
ENDIF(MINGW)
ELSE(BBTK_USE_WXWIDGETS AND WIN32)
ADD_EXECUTABLE(bbi MACOSX_BUNDLE ${SOURCES})
// main frame
bool wxBBIApp::OnInit( )
{
+ printf("EED wxBBIApp::OnInit 1\n");
//Borrame
//FILE *ff; ff = fopen ("/tmp/wt.log","a+"); fprintf(ff,"EED wxBBIApp::OnInit\n"); fclose(ff);
setlocale(LC_NUMERIC, "C");
#endif
+ printf("EED wxBBIApp::OnInit 2\n");
if (cmd.quiet) bbtk::MessageManager::SetMessageLevel("max",0);
if (cmd.debug) bbtk::MessageManager::SetMessageLevel("all",9);
//printf ("EED bbi wxBBIApp::OnInit .....................\n");
//cmd.input_file.push_back("/home/davila/Borrame/testwt.bbs");
+ printf("EED wxBBIApp::OnInit 2.1\n");
bbtk::WxGUIConsole *I = new bbtk::WxGUIConsole(0,_T("bbi"),wxSize(800,600));
+ printf("EED wxBBIApp::OnInit 2.2\n");
SetTopWindow(I);
+ printf("EED wxBBIApp::OnInit 2.3\n");
if (cmd.console) I->Show(true);
+printf("EED wxBBIApp::OnInit 3\n");
I->SetInputs(cmd.param_map);
std::vector<std::string>::const_iterator i;
bool error = false;
+printf("EED wxBBIApp::OnInit 4\n");
+
for (i=cmd.input_file.begin(); i!=cmd.input_file.end(); ++i)
{
error = ! I->InterpretFile(*i);
I->GetInterpreter()->GetExecuter()->GetFactory()->PrintHelpDescriptor("workspace",package,false);
}
+printf("EED wxBBIApp::OnInit 5\n");
+
/*
std::cout << "soe="<<show_on_error <<std::endl;
std::cout << "con="<<console<<std::endl;
*/
if (!(show_on_error || cmd.console || bbtk::Wx::IsSomeWindowAlive() ))
{
+printf("EED wxBBIApp::OnInit 6\n");
I->Close();
// std::cout << "I->Close"<<std::endl;
}
}
// std::cout << "EO OnInit"<<std::endl;
+printf("EED wxBBIApp::OnInit 7\n");
return true;
// you need to use the linker option "/subsystem:console" and the following code:
int main(int argc, char* argv[])
{
-
+printf("EED main cccc\n ");
//Borrame
//FILE *ff; ff = fopen ("/tmp/wt.log","a+"); fprintf(ff,"EED main C\n"); fclose(ff);
// EED 2018-07-16
char buffer[1500];
wcstombs(buffer , ::GetCommandLine() , 1500 );
+printf("EED main cc%scc\n ",buffer);
return WinMain(::GetModuleHandle(NULL), NULL, buffer , SW_SHOWNORMAL);
// return WinMain(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), SW_SHOWNORMAL);
}
int main(int argc, char* argv[])
{
+printf("EED bbi main BBBB\n");
//Borrame
//FILE *ff; ff = fopen ("/tmp/wt.log","a+"); fprintf(ff,"EED main A\n"); fclose(ff);
int main(int argc, char* argv[])
{
+printf("EED bbi main AA\n");
//EED
// if (argc>2)
// {
Utilities::replace( mBbs_paths[iStrVec] , INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR);
}
-
// always add "." (current working directory) at the begining
mPackage_paths.push_back(".");
// add system bin path (for build tree / standalone folder install)
// In any case, deal with bbtk_config.xml!
Read(configXmlFullPathName.c_str());
+
}
//=========================================================================
: mObject(object),
mSourceFile(source_file),
mMessage(message)
- {}
+ {
+printf("EED Exception::Exception \n");
+
+ }
~Exception() throw() {}
void Print() throw()
{
+printf("EED Exception Print\n");
std::cerr << "* ERROR : " << mMessage <<std::endl;
int lev = bbtk::MessageManager::GetMessageLevel("Error");
if (lev > 0) {
// We have to "lock" the smart pointer because the factory
// only keeps a weak pointer on the executer
// -> this would auto-destroy !!
+
+printf("EED Executer::Executer Start\n");
+
mFactory->SetExecuter(MakePointer(this,true));
+printf("EED Executer::Executer 1\n");
+
Reset();
bbtkDebugMessage("object",2,"<== Executer()" <<std::endl);
+printf("EED Executer::Executer End\n");
}
//=======================================================================
//=======================================================================
void Executer::Reset()
{
+printf("EED Executer::Reset Start\n");
bbtkDebugMessage("kernel",9,"==> Executer::Reset()" <<std::endl);
// GetFactory()->Check();
// Wx::DestroyTopWindow();
+printf("EED Executer::Reset 01\n");
GetFactory()->Reset();
+printf("EED Executer::Reset 02\n");
#if(USE_WXWIDGETS)
+printf("EED Executer::Reset 03\n");
Wx::ProcessPendingEvents();
#endif
+printf("EED Executer::Reset 04\n");
// Create user package
Package::Pointer p =
Package::New("user","internal","User defined black boxes","");
// Insert the user package in the factory
+printf("EED Executer::Reset 1\n");
GetFactory()->InsertPackage(p);
// And in the list of open packages
mOpenPackage.push_back(p);
ComplexBlackBoxDescriptor::Pointer r =
ComplexBlackBoxDescriptor::New("workspace");
// mRootCBB->Reference();
+printf("EED Executer::Reset 2\n");
r->SetFactory(GetFactory());
r->AddToAuthor("bbtk");
r->AddToDescription("User's workspace");
// Object::PrintObjectListInfo();
// GetFactory()->CheckPackages();
bbtkDebugMessage("kernel",9,"<== Executer::Reset()" <<std::endl);
+printf("EED Executer::Reset End\n");
}
//=======================================================================
//=======================================================================
void Interpreter::Init(VirtualExec::Pointer e, const std::string& cpp_file)
{
+printf("EED Interpreter::Init Start\n");
if (e)
{
mVirtualExecuter = e;
}
else
{
+printf("EED Interpreter::Init 1\n");
bbtk::Executer::Pointer exe = bbtk::Executer::New();
mRealExecuter = exe;
mVirtualExecuter = boost::static_pointer_cast<VirtualExec>(exe);
}
+printf("EED Interpreter::Init 2\n");
// Lock this pointer or will auto-destruct !!
bbtk::InterpreterVirtual::Init();
+printf("EED Interpreter::Init End\n");
}
//=======================================================================
s.str()); \
throw e; \
} \
- while (0)
+ while (0);
#define BBTK_INTERNAL_ERROR_MESSAGE \
"\n\n***********************************************\n**** THIS IS AN INTERNAL ERROR TO BBTK ****\n**** Please send a full bug report to : ****\n**** bbtk-developers@creatis.insa-lyon.fr ****\n***********************************************\n\n"
mDescription(description),
mVersion(version)
{
-
+printf("EED Package::Package Start\n");
bbtkDebugMessage("object",2,"==> Package('"<<name<<"',...)"
<<bbtkendl);
std::string default_doc_dir = ConfigurationFile::GetInstance().Get_default_temp_dir();
+printf("EED Package::Package 1\n");
char c = default_doc_dir.c_str()[strlen(default_doc_dir.c_str())-1];
std::string url = default_doc_dir;
if (c != '/' && c !='\\') url = url + "/";
url = url + "temp_dir/" + name + "/index.html";
+printf("EED Package::Package 2\n");
SetDocURL(url);
+printf("EED Package::Package 3\n");
SetDocRelativeURL("Relative url not set");
+printf("EED Package::Package 4\n");
/*
std::string relurl(BBTK_STRINGIFY_SYMBOL(BBTK_DOC_REL_PATH));
// std::cout << "relurl=["<<relurl<<"]"<<std::endl;
bbtkDebugMessage("object",2,"<== Package::Package('"<<name<<"',...) OK"
<<bbtkendl);
+printf("EED Package::Package End\n");
}
//==========================================================================
const std::string& pkgname,
const std::string& path)
{
+printf("EED Package::CreateFromDynamicLibrary Start \n");
bbtkDebugMessage("package",1,"==> Package::CreateFromDynamicLibrary("
<<libname<<")"<<std::endl);
bbtkDebugMessage("package",2,"<== Package::CreateFromDynamicLibrary("
<<libname<<") .. OK"<<std::endl);
+printf("EED Package::CreateFromDynamicLibrary End \n");
return p;
}
//==========================================================================
//
int get_app_path (char *pname, size_t pathsize)
{
+
#ifdef LINUX
/* Oddly, the readlink(2) man page says no NULL is appended. */
/* So you have to do it yourself, based on the return value: */
#endif /* LINUX */
#ifdef WIN32
+
//2018-07-06 mingw64
wchar_t pname2[512];
- mbstowcs(pname2,pname,strlen(pname)+1);
long result = GetModuleFileName(NULL, pname2, pathsize);
+// int ret = wcstombs ( pname, pname2, sizeof(pname) );
// long result = GetModuleFileName(NULL, pname, pathsize);
if (result > 0)
{
free (given_path);
return status;
#endif /* MACOSX */
+
+printf("EED Utilities get_app_path END\n");
return -1; /* Path Lookup Failed */
}
//=========================================================================
std::string Utilities::GetExecutablePath()
{
+printf("EED Utilities::GetExecutablePath Start\n");
char name[PATH_MAX];
+printf("EED Utilities::GetExecutablePath 1 \n");
int err = get_app_path(name, PATH_MAX);
+printf("EED Utilities::GetExecutablePath 2 \n");
if (err)
{
- bbtkGlobalError("Could not determine current executable path ?");
+printf("EED Utilities::GetExecutablePath 2.1 \n");
+// bbtkGlobalError("Could not determine current executable path ?");
+
+/*
+
+printf("EED Utilities bbtkGlobalError XX Start\n");
+ do
+ {
+printf("EED Utilities bbtkGlobalError XX A.1\n");
+ std::ostringstream s;
+printf("EED Utilities bbtkGlobalError XX A.2\n");
+ s << "Could not determine current executable path ?";
+printf("EED Utilities bbtkGlobalError XX A.3\n");
+ std::ostringstream f;
+printf("EED Utilities bbtkGlobalError XX A.4\n");
+ f << __FILE__ << " (l."<<__LINE__<<")";
+printf("EED Utilities bbtkGlobalError XX A.5\n");
+std::string aa=f.str();
+printf("EED Utilities bbtkGlobalError XX A.6\n");
+std::string bb=f.str();
+printf("EED Utilities bbtkGlobalError XX A.7\n");
+ bbtk::Exception e( "global scope",
+ f.str(),
+ s.str());
+ throw e;
+printf("EED Utilities bbtkGlobalError XX B\n");
+ }
+ while (0);
+printf("EED Utilities bbtkGlobalError XX End\n");
+
+*/
+
+
+printf("EED Utilities::GetExecutablePath 2.2 \n");
}
// remove the exe name
char *slash;
+printf("EED Utilities::GetExecutablePath 3 >%s<\n",name);
slash = strrchr(name, VALID_FILE_SEPARATOR_CHAR);
+printf("EED Utilities::GetExecutablePath 4 \n");
if (slash)
{
*slash = 0;
}
+printf("EED Utilities::GetExecutablePath END \n");
return name;
}
//=========================================================================
WxGUIConsole::WxGUIConsole( wxWindow *parent, wxString title, wxSize size)
: wxFrame((wxFrame *)parent, -1, title, wxDefaultPosition, size)
{
+printf( "EED WxGUIConsole Start \n" );
// m_mgr = new wxAuiManager(this);
m_mgr.SetManagedWindow(this);
+printf( "EED WxGUIConsole 0.1 \n" );
mInterpreter = bbtk::Interpreter::New();
+printf( "EED WxGUIConsole 0.2 \n" );
mInterpreter->SetUser(this);
+printf( "EED WxGUIConsole 0.3 \n" );
mInterpreter->SetCommandLine(true);
+printf( "EED WxGUIConsole 0.4 \n" );
mInterpreter->SetThrow(false);
+printf( "EED WxGUIConsole 1\n" );
+
//==============
// Menu
wxInitAllImageHandlers();
CreateStatusBar();
SetStatusText( _T("Welcome to bbi !") );
+printf( "EED WxGUIConsole 2\n" );
//==============
// Notebook
mwxPageHelp->SetSizer(helpsizer);
helpsizer->Fit(mwxPageHelp);
helpsizer->SetSizeHints(mwxPageHelp);
-
+ printf( "EED WxGUIConsole 3\n" );
+
mWxGUIHtmlBrowser = new WxGUIHtmlBrowser(mwxPageHelp,
//EED wxSize(1200,0));
wxSize(200,0));
cmdsizer->Add (mWxGUIOutputMessages, 1, wxALL | wxGROW, 5);
cmdsizer->Add (mWxGUICommand, 0, wxALL | wxGROW, 5);
+printf( "EED WxGUIConsole 4\n" );
// Set the parent window of all bbtk windows as a child of this
// bbtk::Wx::SetTopWindowParent(this);
Layout();
// Refresh();
// m_mgr.Update();
+printf( "EED WxGUIConsole End\n" );
+
}
//================================================================