annotate oct-py-eval.cc @ 402:c4b78e449c62

maint: indent functions declared in the pytave namespace * oct-py-eval.cc, oct-py-eval.h, oct-py-types.cc, oct-py-types.h, oct-py-util.cc, oct-py-util.h: Indent functions declared in the pytave namespace, adjust line wrap where necessary.
author Mike Miller <mtmiller@octave.org>
date Fri, 28 Apr 2017 14:07:57 -0700
parents 445df7f96fbc
children 3644df6564bc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
1 /*
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
2
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
3 Copyright (C) 2016 Mike Miller
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
4
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
5 This file is part of Pytave.
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
6
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
7 Pytave is free software; you can redistribute it and/or modify it
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
10 option) any later version.
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
11
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
12 Pytave is distributed in the hope that it will be useful, but WITHOUT
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
15 for more details.
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
16
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
18 along with Pytave; see the file COPYING. If not, see
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
19 <http://www.gnu.org/licenses/>.
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
20
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
21 */
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
22
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
23 #if defined (HAVE_CONFIG_H)
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
24 # include <config.h>
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
25 #endif
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
26
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
27 #include <string>
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
28 #include <boost/python.hpp>
351
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
29 #include <octave/ov.h>
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
30 #include <octave/ovl.h>
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
31
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
32 #include "oct-py-eval.h"
351
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
33 #include "oct-py-util.h"
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
34 #include "octave_to_python.h"
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
35
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
36 namespace pytave
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
37 {
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
38
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
39 PyObject *
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
40 py_call_function (const std::string& func, const octave_value_list& args)
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
41 {
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
42 PyObject *func_obj = py_find_function (func);
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
43 PyObject *retval = py_call_function (func_obj, args);
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
44 Py_DECREF (func_obj);
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
45 return retval;
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
46 }
351
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
47
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
48 PyObject *
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
49 py_call_function (const std::string& func, PyObject *args, PyObject *kwargs)
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
50 {
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
51 PyObject *func_obj = py_find_function (func);
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
52 PyObject *retval = py_call_function (func_obj, args, kwargs);
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
53 Py_DECREF (func_obj);
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
54 return retval;
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
55 }
351
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
56
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
57 PyObject *
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
58 py_call_function (PyObject *callable, const octave_value_list& args)
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
59 {
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
60 PyObject *kwargs = 0;
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
61 PyObject *args_list = PyList_New (0);
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
62 if (! args_list)
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
63 octave_throw_bad_alloc ();
351
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
64
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
65 for (int i = 0; i < args.length (); ++i)
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
66 {
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
67 boost::python::object arg;
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
68 pytave::octvalue_to_pyobj (arg, args(i));
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
69 PyObject *obj = arg.ptr ();
351
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
70
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
71 if (pytave::is_py_kwargs_argument (obj))
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
72 kwargs = pytave::update_py_dict (kwargs, obj);
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
73 else
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
74 {
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
75 Py_INCREF (obj);
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
76 PyList_Append (args_list, obj);
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
77 }
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
78 }
351
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
79
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
80 PyObject *args_tuple = PyList_AsTuple (args_list);
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
81 Py_DECREF (args_list);
351
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
82
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
83 PyObject *retval = py_call_function (callable, args_tuple, kwargs);
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
84 Py_DECREF (args_tuple);
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
85 Py_XDECREF (kwargs);
351
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
86
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
87 return retval;
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
88 }
351
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
89
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
90 PyObject *
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
91 py_call_function (PyObject *callable, PyObject *args, PyObject *kwargs)
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
92 {
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
93 PyObject *retval = PyEval_CallObjectWithKeywords (callable, args, kwargs);
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
94 if (! retval)
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
95 throw boost::python::error_already_set ();
351
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
96
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
97 return retval;
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
98 }
351
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
99
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
100 PyObject *
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
101 py_run_string_safe (const std::string& expr, int start, PyObject *globals,
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
102 PyObject *locals)
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
103 {
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
104 bool alloc = false;
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
105
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
106 if (! globals || (globals == Py_None))
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
107 {
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
108 PyObject *main = py_import_module ("__main__");
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
109 globals = PyModule_GetDict (main);
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
110 Py_DECREF (main);
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
111 if (! globals)
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
112 {
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
113 globals = PyDict_New ();
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
114 alloc = true;
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
115 }
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
116 }
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
117
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
118 if (! locals || (locals == Py_None))
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
119 locals = globals;
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
120
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
121 // Evaluate all expressions under "from __future__ import print_function"
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
122 PyCompilerFlags flags { CO_FUTURE_PRINT_FUNCTION };
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
123
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
124 PyObject *retval = PyRun_StringFlags (expr.c_str (), start, globals, locals,
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
125 &flags);
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
126
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
127 if (alloc)
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
128 Py_DECREF (globals);
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
129
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
130 if (! retval)
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
131 throw boost::python::error_already_set ();
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
132
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
133 return retval;
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
134 }
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
135
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
136 PyObject *
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
137 py_eval_string (const std::string& expr, PyObject *globals, PyObject *locals)
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
138 {
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
139 return py_run_string_safe (expr, Py_eval_input, globals, locals);
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
140 }
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
141
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
142 PyObject *
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
143 py_exec_string (const std::string& expr, PyObject *globals, PyObject *locals)
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
144 {
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
145 return py_run_string_safe (expr, Py_file_input, globals, locals);
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
146 }
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
147
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
148 }