exec.hpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Copyright Stefan Seefeld 2005.
  2. // Distributed under the Boost Software License, Version 1.0. (See
  3. // accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. #ifndef EXEC_SS20050616_HPP
  6. # define EXEC_SS20050616_HPP
  7. # include <boost/python/object.hpp>
  8. # include <boost/python/str.hpp>
  9. namespace boost
  10. {
  11. namespace python
  12. {
  13. // Evaluate python expression from str.
  14. // global and local are the global and local scopes respectively,
  15. // used during evaluation.
  16. object
  17. BOOST_PYTHON_DECL
  18. eval(str string, object global = object(), object local = object());
  19. // Execute an individual python statement from str.
  20. // global and local are the global and local scopes respectively,
  21. // used during execution.
  22. object
  23. BOOST_PYTHON_DECL
  24. exec_statement(str string, object global = object(), object local = object());
  25. // Execute python source code from str.
  26. // global and local are the global and local scopes respectively,
  27. // used during execution.
  28. object
  29. BOOST_PYTHON_DECL
  30. exec(str string, object global = object(), object local = object());
  31. // Execute python source code from file filename.
  32. // global and local are the global and local scopes respectively,
  33. // used during execution.
  34. object
  35. BOOST_PYTHON_DECL
  36. exec_file(str filename, object global = object(), object local = object());
  37. }
  38. }
  39. #endif