#include "PyROOT.h"
#include "TPyROOTApplication.h"
#include "Utility.h"
#include "TROOT.h"
#include "TInterpreter.h"
#include "TSystem.h"
#include "TBenchmark.h"
#include "TStyle.h"
#include "TError.h"
#include "Getline.h"
#include <string.h>
ClassImp(PyROOT::TPyROOTApplication)
PyROOT::TPyROOTApplication::TPyROOTApplication(
const char* acn, int* argc, char** argv, Bool_t bLoadLibs ) :
TApplication( acn, argc, argv )
{
if ( bLoadLibs )
{
ProcessLine( "#include <iostream>", kTRUE );
ProcessLine( "#include <string>", kTRUE );
ProcessLine( "#include <vector>", kTRUE );
ProcessLine( "#include <utility>", kTRUE );
}
#ifdef WIN32
if (gVirtualX)
ProcessLine("((TGWin32 *)gVirtualX)->SetUserThreadId(0);", kTRUE);
#endif
gInterpreter->SaveContext();
gInterpreter->SaveGlobalsContext();
Gl_histinit( (char*)"-" );
SetReturnFromRun( kTRUE );
}
Bool_t PyROOT::TPyROOTApplication::CreatePyROOTApplication( Bool_t bLoadLibs )
{
if ( ! gApplication ) {
PyObject* argl = PySys_GetObject( const_cast< char* >( "argv" ) );
int argc = 1;
if ( argl && 0 < PyList_Size( argl ) ) argc = (int)PyList_GET_SIZE( argl );
char** argv = new char*[ argc ];
for ( int i = 1; i < argc; ++i ) {
char* argi = PyROOT_PyUnicode_AsString( PyList_GET_ITEM( argl, i ) );
if ( strcmp( argi, "-" ) == 0 || strcmp( argi, "--" ) == 0 ) {
argc = i;
break;
}
argv[ i ] = argi;
}
#if PY_VERSION_HEX < 0x03000000
if ( Py_GetProgramName() && strlen( Py_GetProgramName() ) != 0 )
argv[ 0 ] = Py_GetProgramName();
else
argv[ 0 ] = (char*)"python";
#else
argv[ 0 ] = (char*)"python";
#endif
gApplication = new TPyROOTApplication( "PyROOT", &argc, argv, bLoadLibs );
delete[] argv;
return kTRUE;
}
return kFALSE;
}
Bool_t PyROOT::TPyROOTApplication::InitROOTGlobals()
{
if ( ! gBenchmark ) gBenchmark = new TBenchmark();
if ( ! gStyle ) gStyle = new TStyle();
if ( ! gProgName )
#if PY_VERSION_HEX < 0x03000000
gSystem->SetProgname( Py_GetProgramName() );
#else
gSystem->SetProgname( "python" );
#endif
return kTRUE;
}
Bool_t PyROOT::TPyROOTApplication::InitROOTMessageCallback()
{
SetErrorHandler( (ErrorHandlerFunc_t)&Utility::ErrMsgHandler );
return kTRUE;
}
TPyROOTApplication.cxx:10 TPyROOTApplication.cxx:11 TPyROOTApplication.cxx:12 TPyROOTApplication.cxx:13 TPyROOTApplication.cxx:14 TPyROOTApplication.cxx:15 TPyROOTApplication.cxx:16 TPyROOTApplication.cxx:17 TPyROOTApplication.cxx:18 TPyROOTApplication.cxx:19 TPyROOTApplication.cxx:20 TPyROOTApplication.cxx:21 TPyROOTApplication.cxx:22 TPyROOTApplication.cxx:23 TPyROOTApplication.cxx:24 TPyROOTApplication.cxx:25 TPyROOTApplication.cxx:26 TPyROOTApplication.cxx:27 TPyROOTApplication.cxx:28 TPyROOTApplication.cxx:29 TPyROOTApplication.cxx:30 TPyROOTApplication.cxx:31 TPyROOTApplication.cxx:32 TPyROOTApplication.cxx:33 TPyROOTApplication.cxx:34 TPyROOTApplication.cxx:35 TPyROOTApplication.cxx:36 TPyROOTApplication.cxx:37 TPyROOTApplication.cxx:38 TPyROOTApplication.cxx:39 TPyROOTApplication.cxx:40 TPyROOTApplication.cxx:41 TPyROOTApplication.cxx:42 TPyROOTApplication.cxx:43 TPyROOTApplication.cxx:44 TPyROOTApplication.cxx:45 TPyROOTApplication.cxx:46 TPyROOTApplication.cxx:47 TPyROOTApplication.cxx:48 TPyROOTApplication.cxx:49 TPyROOTApplication.cxx:50 TPyROOTApplication.cxx:51 TPyROOTApplication.cxx:52 TPyROOTApplication.cxx:53 TPyROOTApplication.cxx:54 TPyROOTApplication.cxx:55 TPyROOTApplication.cxx:56 TPyROOTApplication.cxx:57 TPyROOTApplication.cxx:58 TPyROOTApplication.cxx:59 TPyROOTApplication.cxx:60 TPyROOTApplication.cxx:61 TPyROOTApplication.cxx:62 TPyROOTApplication.cxx:63 TPyROOTApplication.cxx:64 TPyROOTApplication.cxx:65 TPyROOTApplication.cxx:66 TPyROOTApplication.cxx:67 TPyROOTApplication.cxx:68 TPyROOTApplication.cxx:69 TPyROOTApplication.cxx:70 TPyROOTApplication.cxx:71 TPyROOTApplication.cxx:72 TPyROOTApplication.cxx:73 TPyROOTApplication.cxx:74 TPyROOTApplication.cxx:75 TPyROOTApplication.cxx:76 TPyROOTApplication.cxx:77 TPyROOTApplication.cxx:78 TPyROOTApplication.cxx:79 TPyROOTApplication.cxx:80 TPyROOTApplication.cxx:81 TPyROOTApplication.cxx:82 TPyROOTApplication.cxx:83 TPyROOTApplication.cxx:84 TPyROOTApplication.cxx:85 TPyROOTApplication.cxx:86 TPyROOTApplication.cxx:87 TPyROOTApplication.cxx:88 TPyROOTApplication.cxx:89 TPyROOTApplication.cxx:90 TPyROOTApplication.cxx:91 TPyROOTApplication.cxx:92 TPyROOTApplication.cxx:93 TPyROOTApplication.cxx:94 TPyROOTApplication.cxx:95 TPyROOTApplication.cxx:96 TPyROOTApplication.cxx:97 TPyROOTApplication.cxx:98 TPyROOTApplication.cxx:99 TPyROOTApplication.cxx:100 TPyROOTApplication.cxx:101 TPyROOTApplication.cxx:102 TPyROOTApplication.cxx:103 TPyROOTApplication.cxx:104 TPyROOTApplication.cxx:105 TPyROOTApplication.cxx:106 TPyROOTApplication.cxx:107 TPyROOTApplication.cxx:108 TPyROOTApplication.cxx:109 TPyROOTApplication.cxx:110 TPyROOTApplication.cxx:111 TPyROOTApplication.cxx:112 TPyROOTApplication.cxx:113 TPyROOTApplication.cxx:114 TPyROOTApplication.cxx:115 TPyROOTApplication.cxx:116 TPyROOTApplication.cxx:117 TPyROOTApplication.cxx:118 TPyROOTApplication.cxx:119 TPyROOTApplication.cxx:120 TPyROOTApplication.cxx:121 TPyROOTApplication.cxx:122 TPyROOTApplication.cxx:123 TPyROOTApplication.cxx:124 TPyROOTApplication.cxx:125 TPyROOTApplication.cxx:126 TPyROOTApplication.cxx:127 TPyROOTApplication.cxx:128 TPyROOTApplication.cxx:129 TPyROOTApplication.cxx:130 TPyROOTApplication.cxx:131 TPyROOTApplication.cxx:132 TPyROOTApplication.cxx:133 TPyROOTApplication.cxx:134 TPyROOTApplication.cxx:135 TPyROOTApplication.cxx:136 TPyROOTApplication.cxx:137 TPyROOTApplication.cxx:138 TPyROOTApplication.cxx:139 TPyROOTApplication.cxx:140 TPyROOTApplication.cxx:141 TPyROOTApplication.cxx:142 TPyROOTApplication.cxx:143 TPyROOTApplication.cxx:144 TPyROOTApplication.cxx:145 TPyROOTApplication.cxx:146 TPyROOTApplication.cxx:147 TPyROOTApplication.cxx:148 TPyROOTApplication.cxx:149 TPyROOTApplication.cxx:150 TPyROOTApplication.cxx:151 TPyROOTApplication.cxx:152