diff --git a/Makefile b/Makefile index ce7b62c3698dc30408ca778c24ef02150461ed54..d3f2965956e08eb80ecb76aa7c0c18c58d7f9554 100644 --- a/Makefile +++ b/Makefile @@ -122,13 +122,13 @@ endif ifneq ($(FVENUSLIB),) MODULES += venus endif -ifneq ($(TABLE),) -MODULES += table -endif ifneq ($(PYTHONINCDIR),) -#ifneq ($(PYTHONLIB),) +ifneq ($(PYTHONLIB),) MODULES += pyroot -#endif +endif +endif +ifneq ($(TABLE),) +MODULES += table endif ifneq ($(SRPUTILLIB),) MODULES += srputils @@ -695,7 +695,6 @@ showbuild: @echo "CINTCFLAGS = $(CINTCFLAGS)" @echo "EXTRA_CFLAGS = $(EXTRA_CFLAGS)" @echo "F77FLAGS = $(F77FLAGS)" - @echo "FPYTHONLIBDIR = $(FPYTHONLIBDIR)" @echo "LDFLAGS = $(LDFLAGS)" @echo "F77LDFLAGS = $(F77LDFLAGS)" @echo "EXTRA_LDFLAGS = $(EXTRA_LDFLAGS)" @@ -727,6 +726,9 @@ showbuild: @echo "DCAPLIB = $(DCAPLIB)" @echo "MYSQLINCDIR = $(MYSQLINCDIR)" @echo "PGSQLINCDIR = $(PGSQLINCDIR)" + @echo "PYTHONLIBDIR = $(PYTHONLIBDIR)" + @echo "PYTHONLIB = $(PYTHONLIB)" + @echo "PYTHONINCDIR = $(PYTHONINCDIR)" @echo "SAPDBINCDIR = $(SAPDBINCDIR)" @echo "SRPLIBDIR = $(SRPLIBDIR)" @echo "SRPINCDIR = $(SRPINCDIR)" diff --git a/build/win/makelib.sh b/build/win/makelib.sh index 367aa70b8f1875b39c065cd1381698d79e55bb00..fd083aa846bdd9d03d0e3f62070e97c37f1216e1 100755 --- a/build/win/makelib.sh +++ b/build/win/makelib.sh @@ -29,6 +29,7 @@ R__SONAME=$5 R__LIB=$6 R__OBJS=$7 R__EXTRA=$8 +R__LEXTRA=$9 lastsyslib=comctl32.lib extralibs=$lastsyslib @@ -48,9 +49,9 @@ if [ "$R__PLATFORM" = "win32" ]; then echo "$bindexp $name $R__OBJS > lib/${name}.def" $bindexp $name $R__OBJS > lib/${name}.def echo lib -nologo -MACHINE:IX86 -out:lib/${name}.lib $R__OBJS \ - -def:lib/${name}.def + -def:lib/${name}.def $R__LEXTRA lib -nologo -MACHINE:IX86 -out:lib/${name}.lib $R__OBJS \ - -def:lib/${name}.def + -def:lib/${name}.def $R__LEXTRA if [ "$R__LIB" = "lib/libCint.dll" ]; then echo $R__LD $R__SOFLAGS $R__LDFLAGS -o bin/${name}.dll $R__OBJS \ lib/${name}.exp $syslibs diff --git a/config/Makefile.in b/config/Makefile.in index 799f260f0e143359d2a1bf0e4aaff11bf7f1d280..748e5b9ef9c6e51c92f481b117122b5c05e4434e 100644 --- a/config/Makefile.in +++ b/config/Makefile.in @@ -105,12 +105,13 @@ FPYTHIALIB := @pythialib@ FPYTHIA6LIBDIR := @pythia6libdir@ FPYTHIA6LIB := @pythia6lib@ +FVENUSLIBDIR := @venuslibdir@ +FVENUSLIB := @venuslib@ + PYTHONLIBDIR := @pythonlibdir@ PYTHONLIB := @pythonlib@ PYTHONINCDIR := @pythonincdir@ - -FVENUSLIBDIR := @venuslibdir@ -FVENUSLIB := @venuslib@ +PYTHONLIBFLAGS := @pythonlibflags@ SRPLIBDIR := @srplibdir@ SRPLIB := @srplib@ diff --git a/configure b/configure index 96f6b936f28cd9c34bdac63d13b03e9a7ef24230..b771d919ebc6b7e0284243ff4eb9be9e28c4ab5d 100755 --- a/configure +++ b/configure @@ -557,8 +557,8 @@ enable/disable options, prefix with either --enable- or --disable- ldap LDAP support, requires (Open)LDAP libs mysql MySQL support, requires libmysqlclient opengl OpenGL support, requires libGL and libGLU - python PyROOT Python bindings, requires python >= 2.3 openiv OpenInventor support, requires libInventor and libInventorXt + python PyROOT python bindings, requires python >= 2.1 pgsql PostgreSQL support, requires libpq pythia Pythia5 EG support, requires libPythia pythia6 Pythia6 EG support, requires libPythia6 @@ -1507,6 +1507,50 @@ if test ! "x$enable_ldap" = "xno"; then fi fi +###################################################################### +# +### echo %%% Python - Optional alternative interpreter +# +# (See http://www.python.org) +# +if test ! "x$enable_python" = "xno" ; then + # Check for Python include and library + if test "x$platform" = "xwin32"; then + + check_header "Python.h" "$pythonincdir" \ + $PYTHONDIR/include C:/Python23/include C:/Python22/include + pythoninc=$found_hdr + pythonincdir=$found_dir + + check_library "python23" "$enable_shared" "$pythonlibdir" \ + $PYTHONDIR/libs C:/Python23/libs C:/Python22/libs + pythonlib=$found_lib + pythonlibdir=$found_dir + pythonlibflags="-nodefaultlib:python23" + + else + check_header "Python.h" "$pythonincdir" \ + $PYTHONDIR/include/python2.3 $PYTHONDIR/include/python2.2 \ + $PYTHONDIR/include /usr/include/python2.3 /usr/include/python2.2 \ + /usr/local/include/python2.3 /usr/local/include/python2.2 + pythoninc=$found_hdr + pythonincdir=$found_dir + + check_library "libpython2.3 libpython2.2" "$enable_shared" \ + "$pythonlibdir" $PYTHONDIR/lib/python2.3/config \ + $PYTHONDIR/lib/python2.2/config $PYTHONDIR/lib \ + /usr/lib/python2.3/config /usr/lib/python2.2/config \ + /usr/local/lib/python2.3/config /usr/local/lib/python2.2/config + pythonlib=$found_lib + pythonlibdir=$found_dir + + fi + + if test "x$pythonincdir" = "x" || test "x$pythonlib" = "x"; then + enable_python="no" + fi +fi + ###################################################################### # ### echo %%% Globus Support - Third party libraries @@ -2107,41 +2151,6 @@ fi echo $enable_shadowpw -###################################################################### -# -### echo %%% PyRoot - Python Optional alternative interpreter -# -# (See http://www.python.org) -# -if test ! "x$enable_python" = "xno" ; then - # Check for Python include and library - if test "x$platform" = "xwin32"; then - - check_header "Python.h" "$pythonincdir" \ - $PYTHONDIR/include C:/Python23/include C:/Python22/include - pythoninc=$found_hdr - pythonincdir=$found_dir - - check_library "python23" "$enable_shared" "$pythonlibdir" \ - $PYTHONDIR/libs C:/Python23/libs C:/Python22/libs - pythonlib=$found_lib - pythonlibdir=$found_dir - - else - check_header "Python.h" "$pythonincdir" \ - $PYTHONDIR/include/python2.3 $PYTHONDIR/include/python2.2 \ - $PYTHONDIR/include $PYTHONDIR/include \ - /usr/include/python2.3 /usr/include/python2.2 \ - /usr/local/include/python2.3 /usr/local/include/python2.2 - pythoninc=$found_hdr - pythonincdir=$found_dir - fi - - if test "x$pythonincdir" = "x" ; then - enable_python=no - fi -fi - ###################################################################### # ### echo %%% Table Library - Contributed library @@ -2427,14 +2436,15 @@ sed -e "s|@ldflags@||" \ -e "s|@pgsqlincdir@|$pgsqlincdir|" \ -e "s|@pgsqllib@|$pgsqllib|" \ -e "s|@pgsqllibdir@|$pgsqllibdir|" \ - -e "s|@pythonlib@|$pythonlib|" \ - -e "s|@pythonlibdir@|$pythonlibdir|" \ - -e "s|@pythonincdir@|$pythonincdir|" \ -e "s|@proofdir@|$proofdir|" \ -e "s|@pythia6lib@|$pythia6lib|" \ -e "s|@pythia6libdir@|$pythia6libdir|" \ -e "s|@pythialib@|$pythialib|" \ -e "s|@pythialibdir@|$pythialibdir|" \ + -e "s|@pythonlib@|$pythonlib|" \ + -e "s|@pythonlibdir@|$pythonlibdir|" \ + -e "s|@pythonincdir@|$pythonincdir|" \ + -e "s|@pythonlibflags@|$pythonlibflags|" \ -e "s|@qtincdir@|$qtincdir|" \ -e "s|@qtlib@|$qtlib|" \ -e "s|@qtlibdir@|$qtlibdir|" \ diff --git a/pyroot/Module.mk b/pyroot/Module.mk index abdb2cc607a1748ac7b3bc564d2529895c01e033..e69b4aabb86bfada8f57ccf2758c9ec2068b332d 100644 --- a/pyroot/Module.mk +++ b/pyroot/Module.mk @@ -1,63 +1,64 @@ -# Module.mk for pyroot module -# -# Authors: Pere Mato, Wim Lavrijsen, 22/4/2004 - -MODDIR := pyroot -MODDIRS := $(MODDIR)/src -MODDIRI := $(MODDIR)/inc - -PYROOTDIR := $(MODDIR) -PYROOTDIRS := $(PYROOTDIR)/src -PYROOTDIRI := $(PYROOTDIR)/inc - -PYROOTL := $(MODDIRI)/LinkDef.h -PYROOTDS := $(MODDIRS)/G__PyROOT.cxx -PYROOTDO := $(PYROOTDS:.cxx=.o) -PYROOTDH := $(PYROOTDS:.cxx=.h) - -PYROOTH := $(filter-out $(MODDIRI)/LinkDef%,$(wildcard $(MODDIRI)/*.h)) -PYROOTS := $(filter-out $(MODDIRS)/G__%,$(wildcard $(MODDIRS)/*.cxx)) -PYROOTO := $(PYROOTS:.cxx=.o) - -PYROOTDEP := $(PYROOTO:.o=.d) $(PYROOTDO:.o=.d) - -PYROOTLIB := $(LPATH)/PyROOT.$(SOEXT) - -# used in the main Makefile -ALLHDRS += $(patsubst $(MODDIRI)/%.h,include/%.h,$(PYROOTH)) -ALLLIBS += $(PYROOTLIB) - -# include all dependency files -INCLUDEFILES += $(PYROOTDEP) - -##### local rules ##### -include/%.h: $(PYROOTDIRI)/%.h - cp $< $@ - -$(PYROOTLIB): $(PYROOTO) $(PYROOTDO) $(MAINLIBS) - @$(MAKELIB) $(PLATFORM) $(LD) "$(LDFLAGS)" \ - "$(SOFLAGS)" PyROOT.$(SOEXT) $@ \ - "$(PYROOTO) $(PYROOTDO)" "$(PYTHONLIB)" - -$(PYROOTDS): $(PYROOTH) $(PYROOTL) $(ROOTCINTTMP) - @echo "Generating dictionary $@..." - $(ROOTCINTTMP) -f $@ -c $(PYROOTH) $(PYROOTL) - -$(PYROOTDO): $(PYROOTDS) - $(CXX) $(NOOPT) $(CXXFLAGS) -I. -o $@ -c $< - -all-pyroot: $(PYROOTLIB) - -clean-pyroot: - @rm -f $(PYROOTO) $(PYROOTDO) - -clean:: clean-pyroot - -distclean-pyroot: clean-pyroot - @rm -f $(PYROOTDEP) $(PYROOTDS) $(PYROOTDH) $(PYROOTLIB) - -distclean:: distclean-pyroot - -##### extra rules ###### -$(PYROOTO): %.o: %.cxx - $(CXX) $(OPT) $(CXXFLAGS) -I$(PYTHONINCDIR) -o $@ -c $< +# Module.mk for pyroot module +# +# Authors: Pere Mato, Wim Lavrijsen, 22/4/2004 + +MODDIR := pyroot +MODDIRS := $(MODDIR)/src +MODDIRI := $(MODDIR)/inc + +PYROOTDIR := $(MODDIR) +PYROOTDIRS := $(PYROOTDIR)/src +PYROOTDIRI := $(PYROOTDIR)/inc + +PYROOTL := $(MODDIRI)/LinkDef.h +PYROOTDS := $(MODDIRS)/G__PyROOT.cxx +PYROOTDO := $(PYROOTDS:.cxx=.o) +PYROOTDH := $(PYROOTDS:.cxx=.h) + +PYROOTH := $(filter-out $(MODDIRI)/LinkDef%,$(wildcard $(MODDIRI)/*.h)) +PYROOTS := $(filter-out $(MODDIRS)/G__%,$(wildcard $(MODDIRS)/*.cxx)) +PYROOTO := $(PYROOTS:.cxx=.o) + +PYROOTDEP := $(PYROOTO:.o=.d) $(PYROOTDO:.o=.d) + +PYROOTLIB := $(LPATH)/PyROOT.$(SOEXT) + +# used in the main Makefile +ALLHDRS += $(patsubst $(MODDIRI)/%.h,include/%.h,$(PYROOTH)) +ALLLIBS += $(PYROOTLIB) + +# include all dependency files +INCLUDEFILES += $(PYROOTDEP) + +##### local rules ##### +include/%.h: $(PYROOTDIRI)/%.h + cp $< $@ + +$(PYROOTLIB): $(PYROOTO) $(PYROOTDO) $(MAINLIBS) + @$(MAKELIB) $(PLATFORM) $(LD) "$(LDFLAGS)" \ + "$(SOFLAGS)" PyROOT.$(SOEXT) $@ \ + "$(PYROOTO) $(PYROOTDO)" "$(PYTHONLIBDIR) $(PYTHONLIB)" \ + "$(PYTHONLIBFLAGS)" + +$(PYROOTDS): $(PYROOTH) $(PYROOTL) $(ROOTCINTTMP) + @echo "Generating dictionary $@..." + $(ROOTCINTTMP) -f $@ -c $(PYROOTH) $(PYROOTL) + +$(PYROOTDO): $(PYROOTDS) + $(CXX) $(NOOPT) $(CXXFLAGS) -I. -o $@ -c $< + +all-pyroot: $(PYROOTLIB) + +clean-pyroot: + @rm -f $(PYROOTO) $(PYROOTDO) + +clean:: clean-pyroot + +distclean-pyroot: clean-pyroot + @rm -f $(PYROOTDEP) $(PYROOTDS) $(PYROOTDH) $(PYROOTLIB) + +distclean:: distclean-pyroot + +##### extra rules ###### +$(PYROOTO): %.o: %.cxx + $(CXX) $(OPT) $(CXXFLAGS) -I$(PYTHONINCDIR) -o $@ -c $< diff --git a/pyroot/inc/LinkDef.h b/pyroot/inc/LinkDef.h index 85d9eb5048c6d3ec839a2cca417204feb79c23d7..497198e95ca68482af3205d2e09683756bed0b4d 100644 --- a/pyroot/inc/LinkDef.h +++ b/pyroot/inc/LinkDef.h @@ -1,11 +1,12 @@ -#ifdef __CINT__ - -#pragma link off all globals; -#pragma link off all classes; -#pragma link off all functions; - -#pragma link C++ function Python::exec; -#pragma link C++ function Python::eval; -#pragma link C++ function Python::bind; -#pragma link C++ function Python::prompt; -#endif +#ifdef __CINT__ + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; + +#pragma link C++ function TPython::exec; +#pragma link C++ function TPython::eval; +#pragma link C++ function TPython::bind; +#pragma link C++ function TPython::prompt; + +#endif diff --git a/pyroot/inc/TPython.h b/pyroot/inc/TPython.h index 518daeacf1f22ea47a2e83fdf58cc5fc024b860c..a487230842c26f4d485b926854ce34ecdd0e18a7 100644 --- a/pyroot/inc/TPython.h +++ b/pyroot/inc/TPython.h @@ -1,29 +1,33 @@ -// @(#)root/pyroot:$Name$:$Id$ -// Author: Wim Lavrijsen April 2004 - -#ifndef ROOT_TPython -#define ROOT_TPython - -// ROOT -class TObject; - - -class Python { -public: -// execute a python statement (eg. "import ROOT" ) - static void exec( char* cmd ); - -// evaluate a python expression (eg. "1+1") - static TObject* eval( char* expr ); - -// bind a ROOT object with at the python side with name "label" - static bool bind( TObject*, char* label ); - -// enter an interactive python session (exit with ^D) - static void prompt(); - -private: - static bool initialize_(); -}; - -#endif +// @(#)root/pyroot:$Name: $:$Id: TPython.h,v 1.2 2004/04/27 09:20:34 rdm Exp $ +// Author: Wim Lavrijsen April 2004 + +#ifndef ROOT_TPython +#define ROOT_TPython + +// ROOT +#ifndef ROOT_TObject +#include "TObject.h" +#endif + +class TPython { + +private: + static bool Initialize(); + +public: + // execute a python statement (e.g. "import ROOT" ) + static void Exec(const char *cmd); + + // evaluate a python expression (e.g. "1+1") + static TObject *Eval(const char *expr); + + // bind a ROOT object with, at the python side, the name "label" + static bool Bind(TObject *obj, const char *label); + + // enter an interactive python session (exit with ^D) + static void Prompt(); + + ClassDef(TPython,0) +}; + +#endif diff --git a/pyroot/src/TPython.cxx b/pyroot/src/TPython.cxx index 88b0b93a9c1c3ea955b1fde794ff35eb7e639472..e43fcaed66536dcaa8584684b4252fd444e8c543 100644 --- a/pyroot/src/TPython.cxx +++ b/pyroot/src/TPython.cxx @@ -1,141 +1,154 @@ -// @(#)root/pyroot:$Name: $:$Id: $ -// Author: Wim Lavrijsen, Apr 2004 - -// Bindings -#include "PyROOT.h" -#include "RootWrapper.h" -#include "ObjectHolder.h" -#include "Utility.h" -#include "TPython.h" - -// ROOT -#include "TROOT.h" -#include "TObject.h" - -// Standard -#include <stdio.h> -#include <iostream> - - -//- data ________________________________________________________________________ -namespace { - - PyObject* g_maindict = 0; - -} // unnamed namespace - - -//- private helpers ------------------------------------------------------------- -bool Python::initialize_() { - if ( ! Py_IsInitialized() ) { - // this happens if CINT comes in first - PyEval_InitThreads(); - Py_Initialize(); - - // try again - if ( ! Py_IsInitialized() ) { - // give up ... - std::cout << "Error: python has not been intialized; returning." << std::endl; - return false; - } - - // set argv - char* argv[] = { const_cast< char* >( "root" ) }; - PySys_SetArgv( sizeof(argv)/sizeof(argv[0]), argv ); - - // force loading of ROOT - PyRun_SimpleString( const_cast< char* >( "import ROOT" ) ); - } - - if ( g_maindict == 0 ) { - // retrieve the main dictionary - g_maindict = PyModule_GetDict( - PyImport_AddModule( const_cast< char* >( "__main__" ) ) ); - Py_INCREF( g_maindict ); - } - -// declare success ... - return true; -} - - -//- CINT entry points ----------------------------------------------------------- -void Python::exec( char* cmd ) { -// setup - if ( ! initialize_() ) - return; - -// execute the command - PyObject* result = PyRun_String( cmd, Py_file_input, g_maindict, g_maindict ); - -// test for error - if ( result ) - Py_DECREF( result ); - else - PyErr_Print(); -} - - -TObject* Python::eval( char* expr ) { -// setup - if ( ! initialize_() ) - return 0; - -// evaluate the expression - PyObject* result = PyRun_String( expr, Py_eval_input, g_maindict, g_maindict ); - -// test for error - if ( ! result ) { - PyErr_Print(); - return 0; - } - -// test for a usuable result - if ( result == Py_None ) { - Py_DECREF( result ); - return 0; - } - -// the result is a new handle, for testing use a borrowed, since ROOT will have to take -// care of the clean up (need to figure out how) - PyROOT::ObjectHolder* holder = PyROOT::Utility::getObjectHolder( result ); - if ( holder != 0 ) - return reinterpret_cast< TObject* >( holder->getObject() ); - - Py_DECREF( result ); - return 0; -} - - -bool Python::bind( TObject* obj, char* label ) { -// check given address and setup - if ( ! ( obj && initialize_() ) ) - return false; - -// bind object in the main namespace - TClass* cls = obj->IsA(); - if ( cls != 0 ) { - PyObject* bound = - PyROOT::bindRootObject( new PyROOT::ObjectHolder( (void*)obj, cls, false ) ); - - if ( bound ) { - bool bOk = PyDict_SetItemString( g_maindict, label, bound ) == 0; - Py_DECREF( bound ); - - return bOk; - } - } - - return false; -} - - -void Python::prompt() { -// setup - if ( ! initialize_() ) { - return; - } - -// enter i/o interactive mode - PyRun_InteractiveLoop( stdin, const_cast< char* >( "\0" ) ); -} +// @(#)root/pyroot:$Name: $:$Id: TPython.cxx,v 1.1 2004/04/27 06:28:48 brun Exp $ +// Author: Wim Lavrijsen, Apr 2004 + +// Bindings +#include "PyROOT.h" +#include "RootWrapper.h" +#include "ObjectHolder.h" +#include "Utility.h" +#include "TPython.h" + +// ROOT +#include "TROOT.h" +#include "TObject.h" + +// Standard +#include <stdio.h> +#include <Riostream.h> + + +namespace { + + PyObject* g_maindict = 0; + +} // unnamed namespace + + +//______________________________________________________________________________ +bool TPython::Initialize() +{ + // Private initialization method. + + if ( ! Py_IsInitialized() ) { + // this happens if CINT comes in first + PyEval_InitThreads(); + Py_Initialize(); + + // try again + if ( ! Py_IsInitialized() ) { + // give up ... + std::cout << "Error: python has not been intialized; returning." << std::endl; + return false; + } + + // set argv + char* argv[] = { const_cast< char* >( "root" ) }; + PySys_SetArgv( sizeof(argv)/sizeof(argv[0]), argv ); + + // force loading of ROOT + PyRun_SimpleString( const_cast< char* >( "import ROOT" ) ); + } + + if ( g_maindict == 0 ) { + // retrieve the main dictionary + g_maindict = PyModule_GetDict( + PyImport_AddModule( const_cast< char* >( "__main__" ) ) ); + Py_INCREF( g_maindict ); + } + + // declare success ... + return true; +} + +//______________________________________________________________________________ +void TPython::Exec(const char *cmd) +{ + // Execute a python statement (e.g. "import ROOT"). + + // setup + if ( ! Initialize() ) + return; + + // execute the command + PyObject* result = PyRun_String( const_cast< char * >(cmd), Py_file_input, g_maindict, g_maindict ); + + // test for error + if ( result ) + Py_DECREF( result ); + else + PyErr_Print(); +} + +//______________________________________________________________________________ +TObject *TPython::Eval(const char* expr) +{ + // Evaluate a python expression (e.g. "1+1"). + + // setup + if ( ! Initialize() ) + return 0; + + // evaluate the expression + PyObject* result = PyRun_String( const_cast< char * >(expr), Py_eval_input, g_maindict, g_maindict ); + + // test for error + if ( ! result ) { + PyErr_Print(); + return 0; + } + + // test for a usuable result + if ( result == Py_None ) { + Py_DECREF( result ); + return 0; + } + + // the result is a new handle, for testing use a borrowed, since ROOT + // will have to take care of the clean up (need to figure out how) + PyROOT::ObjectHolder* holder = PyROOT::Utility::getObjectHolder( result ); + if ( holder != 0 ) + return reinterpret_cast< TObject* >( holder->getObject() ); + + Py_DECREF( result ); + return 0; +} + +//______________________________________________________________________________ +bool TPython::Bind(TObject *obj, const char *label) +{ + // Bind a ROOT object with, at the python side, the name "label". + + // check given address and setup + if ( ! ( obj && Initialize() ) ) + return false; + + // bind object in the main namespace + TClass* cls = obj->IsA(); + if ( cls != 0 ) { + PyObject* bound = + PyROOT::bindRootObject( new PyROOT::ObjectHolder( (void*)obj, cls, false ) ); + + if ( bound ) { + bool bOk = PyDict_SetItemString( g_maindict, const_cast< char * >(label), bound ) == 0; + Py_DECREF( bound ); + + return bOk; + } + } + + return false; +} + +//______________________________________________________________________________ +void TPython::Prompt() +{ + // Enter an interactive python session (exit with ^D). + + // setup + if ( ! Initialize() ) { + return; + } + + // enter i/o interactive mode + PyRun_InteractiveLoop( stdin, const_cast< char* >( "\0" ) ); +}