#if wxMAJOR_VERSION <= 2
graphical_dialog = ( parser.Found(_T("wxcommandlineg")) );
#else
- printf("EED Warnning. WxProcessCmdLine::Process g wxcommandlineg ");
+ printf("EED Warnning. WxProcessCmdLine::Process g wxcommandlineg \n");
graphical_dialog = ( parser.Found(_T("g")) );
#endif
// 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)
{
I->GetInterpreter()->GetExecuter()->GetFactory()->PrintHelpDescriptor("workspace",package,false);
}
-printf("EED wxBBIApp::OnInit 5\n");
/*
std::cout << "soe="<<show_on_error <<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);
+ // 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)
// {
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) {
// 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 Factory::LoadPackage( const std::string& name )
{
+
// Note : in the following :
// name : the user supplied name
// - abreviated name e.g. pkg pkg.so libbpkg libbbpkg.so
// The following is *NOT* a debug time message :
// It's a user intended message.
// Please don't remove it.
- bbtkMessage("output",3," [" <<libname
- <<"] : doesn't exist" <<std::endl);
- }
- else
- {
+ bbtkMessage("output",3," [" << libname <<"] : doesn't exist" <<std::endl);
+ } else {
ok = DoLoadPackage( libname, pkgname, path);
- }
- }
- else
- {
+ }
+ } else {
bbtkError("Path ["<<upath<<"] doesn't exist");
return;
}
- }
- else // ----------------------------------------------------- iterate on the paths
+ } else // ----------------------------------------------------- iterate on the paths
{
std::string path = ".";
//=======================================================================
void Interpreter::Init(VirtualExec::Pointer e, const std::string& cpp_file)
{
-printf("EED Interpreter::Init Start\n");
- if (e)
- {
- mVirtualExecuter = e;
- }
- else if (cpp_file.size()!=0)
- {
- mVirtualExecuter = boost::static_pointer_cast<VirtualExec>(bbtk::Transcriptor::New(cpp_file));
- }
- else
- {
-printf("EED Interpreter::Init 1\n");
- bbtk::Executer::Pointer exe = bbtk::Executer::New();
- mRealExecuter = exe;
- mVirtualExecuter = boost::static_pointer_cast<VirtualExec>(exe);
+ if (e) {
+ mVirtualExecuter = e;
+ } else if (cpp_file.size()!=0){
+ mVirtualExecuter = boost::static_pointer_cast<VirtualExec>(bbtk::Transcriptor::New(cpp_file));
+ } else {
+ 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 !!
if (!e) mVirtualExecuter->SetInterpreter(MakePointer(this,true));
bbtk::InterpreterVirtual::Init();
-printf("EED Interpreter::Init End\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;
}
//==========================================================================
libname += pkgname;
#if defined(MACOSX)
libname += ".dylib";
-#else
- libname += ".so";
+#elif defined(WIN32) // mingw
+ libname += ".dll";
+#else // Linux
+ libname += ".so";
#endif
#elif defined(_WIN32)
//2018-07-06 mingw64
wchar_t pname2[512];
long result = GetModuleFileName(NULL, pname2, pathsize);
-// int ret = wcstombs ( pname, pname2, sizeof(pname) );
+ int ret = wcstombs ( pname, pname2, sizeof(pname) );
// long result = GetModuleFileName(NULL, pname, pathsize);
if (result > 0)
{
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)
- {
-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");
- }
-
+ {
+ try
+ {
+ bbtkGlobalError("Could not determine current executable path ?");
+ }
+ catch (bbtk::Exception e)
+ {
+ std::cerr << e.GetErrorMessage() << std::endl;
+ }
+ }
+
// 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");
+ {
+ *slash = 0;
+ }
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
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));
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" );
-
}
//================================================================