14 #include "TInterpreter.h"
18 static int load_libs(
const std::vector<char*>& libs) {
19 for(
size_t i=0; i<libs.size(); ++i) {
20 int ret = gSystem->Load(libs[i]);
22 ::printf(
"+++ Failed to load library: %s [ignored]\n",libs[i]);
26 ::printf(
"+++ Successfully loaded library: %s\n",libs[i]);
32 int main(
int argc,
char** argv) {
33 bool have_prompt =
false;
34 bool do_execute =
false;
35 std::vector<char*> args;
36 std::vector<char*> libs;
40 if ( argc>first_arg && strncmp(argv[first_arg],
"-p",2)==0 ) {
42 args.push_back(argv[0]);
45 else if ( argc>first_arg && strncmp(argv[first_arg],
"-e",2)==0 ) {
49 for(
int i=first_arg; i<argc; ++i) {
50 if ( 0 == ::strcmp(argv[i],
"-L") )
51 libs.push_back(argv[++i]);
53 args.push_back(argv[i]);
55 if ( !have_prompt && args.size()>0 ) {
56 libs.push_back((
char*)
"libDDG4Python");
57 if ( 0 == (ret=load_libs(libs)) ) {
62 return gInterpreter->ProcessLine(
"PyDDG4::execute()");
68 if ( 0 == (ret=load_libs(libs)) ) {
69 ::printf(
"+++ Calling now Py_Main...\n");