9
3

exec.hpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. object
  20. BOOST_PYTHON_DECL
  21. eval(char const *string, object global = object(), object local = object());
  22. // Execute an individual python statement from str.
  23. // global and local are the global and local scopes respectively,
  24. // used during execution.
  25. object
  26. BOOST_PYTHON_DECL
  27. exec_statement(str string, object global = object(), object local = object());
  28. object
  29. BOOST_PYTHON_DECL
  30. exec_statement(char const *string, object global = object(), object local = object());
  31. // Execute python source code from str.
  32. // global and local are the global and local scopes respectively,
  33. // used during execution.
  34. object
  35. BOOST_PYTHON_DECL
  36. exec(str string, object global = object(), object local = object());
  37. object
  38. BOOST_PYTHON_DECL
  39. exec(char const *string, object global = object(), object local = object());
  40. // Execute python source code from file filename.
  41. // global and local are the global and local scopes respectively,
  42. // used during execution.
  43. object
  44. BOOST_PYTHON_DECL
  45. exec_file(str filename, object global = object(), object local = object());
  46. object
  47. BOOST_PYTHON_DECL
  48. exec_file(char const *filename, object global = object(), object local = object());
  49. }
  50. }
  51. #endif