Mercurial > pytave
annotate oct-py-eval.cc @ 420:7864849e84c2
Eliminate some compiler warnings
* Makefile.am (AM_CXXFLAGS): Build with -W -Wall by default.
* __py_struct_from_dict__.cc (F__py_int64_scalar_value__,
F__py_uint64_scalar_value__, F__py_is_none__, F__py_isinstance__,
F__py_objstore_del__, F__py_objstore_get__, F__py_objstore_put__,
F__py_string_value__, F__py_struct_from_dict__): Remove unused parameter to
eliminate -Wunused-parameter warning.
* pyexec.cc (Fpyexec): Likewise.
* oct-py-init.cc (pytave::py_init): Declare argv array correctly to eliminate
-Wwrite-strings warning.
* oct-py-types.cc (pytave::make_py_bool): Explicitly increment and return value
to eliminate -Wstrict-aliasing warning.
(pytave::make_py_complex, pytave::extract_py_complex): Copy complex values
between C++ and Python types to eliminate -Wstrict-aliasing warning.
(pytave::extract_py_int64): Add braces to nested if block to eliminate
-Wparentheses warning.
author | Mike Miller <mtmiller@octave.org> |
---|---|
date | Thu, 04 May 2017 12:31:07 -0700 |
parents | 9bf8ba050122 |
children | 24555fba9964 |
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> |
351
040aff46e4db
Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents:
335
diff
changeset
|
28 #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
|
29 #include <octave/ovl.h> |
335
9b862844e6b7
Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
30 |
415
9bf8ba050122
Replace all remaining Boost.Python references
Mike Miller <mtmiller@octave.org>
parents:
411
diff
changeset
|
31 #include "exceptions.h" |
335
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" |
404
aef165ff92b0
Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents:
403
diff
changeset
|
33 #include "oct-py-object.h" |
351
040aff46e4db
Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents:
335
diff
changeset
|
34 #include "oct-py-util.h" |
411
3613ffbd52b2
Overhaul implicit conversion of arguments and return values
Mike Miller <mtmiller@octave.org>
parents:
404
diff
changeset
|
35 #include "oct-py-types.h" |
335
9b862844e6b7
Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
36 |
9b862844e6b7
Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
37 namespace pytave |
9b862844e6b7
Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
38 { |
9b862844e6b7
Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
39 |
402
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
40 PyObject * |
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
41 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
|
42 { |
404
aef165ff92b0
Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents:
403
diff
changeset
|
43 python_object func_obj = py_find_function (func); |
aef165ff92b0
Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents:
403
diff
changeset
|
44 python_object retval = py_call_function (func_obj, args); |
aef165ff92b0
Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents:
403
diff
changeset
|
45 return retval.release (); |
402
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 { |
404
aef165ff92b0
Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents:
403
diff
changeset
|
51 python_object func_obj = py_find_function (func); |
aef165ff92b0
Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents:
403
diff
changeset
|
52 python_object retval = py_call_function (func_obj, args, kwargs); |
aef165ff92b0
Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents:
403
diff
changeset
|
53 return retval.release (); |
402
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
54 } |
351
040aff46e4db
Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents:
335
diff
changeset
|
55 |
402
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
56 PyObject * |
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
57 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
|
58 { |
404
aef165ff92b0
Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents:
403
diff
changeset
|
59 python_object kwargs; |
aef165ff92b0
Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents:
403
diff
changeset
|
60 python_object args_list = PyList_New (0); |
402
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
61 if (! args_list) |
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
62 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
|
63 |
402
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
64 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
|
65 { |
411
3613ffbd52b2
Overhaul implicit conversion of arguments and return values
Mike Miller <mtmiller@octave.org>
parents:
404
diff
changeset
|
66 python_object obj = py_implicitly_convert_argument (args(i)); |
351
040aff46e4db
Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents:
335
diff
changeset
|
67 |
402
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
68 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
|
69 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
|
70 else |
411
3613ffbd52b2
Overhaul implicit conversion of arguments and return values
Mike Miller <mtmiller@octave.org>
parents:
404
diff
changeset
|
71 PyList_Append (args_list, obj.release ()); |
402
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
72 } |
351
040aff46e4db
Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents:
335
diff
changeset
|
73 |
404
aef165ff92b0
Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents:
403
diff
changeset
|
74 python_object args_tuple = PyList_AsTuple (args_list); |
351
040aff46e4db
Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents:
335
diff
changeset
|
75 |
404
aef165ff92b0
Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents:
403
diff
changeset
|
76 python_object retval = py_call_function (callable, args_tuple, kwargs); |
351
040aff46e4db
Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents:
335
diff
changeset
|
77 |
404
aef165ff92b0
Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents:
403
diff
changeset
|
78 return retval.release (); |
402
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
79 } |
351
040aff46e4db
Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents:
335
diff
changeset
|
80 |
402
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
81 PyObject * |
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
82 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
|
83 { |
404
aef165ff92b0
Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents:
403
diff
changeset
|
84 python_object retval = PyEval_CallObjectWithKeywords (callable, args, kwargs); |
402
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
85 if (! retval) |
415
9bf8ba050122
Replace all remaining Boost.Python references
Mike Miller <mtmiller@octave.org>
parents:
411
diff
changeset
|
86 throw pytave::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
|
87 |
404
aef165ff92b0
Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents:
403
diff
changeset
|
88 return retval.release (); |
402
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
89 } |
351
040aff46e4db
Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents:
335
diff
changeset
|
90 |
402
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
91 PyObject * |
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
92 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
|
93 PyObject *locals) |
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
94 { |
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
95 bool alloc = false; |
335
9b862844e6b7
Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
96 |
402
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
97 if (! globals || (globals == Py_None)) |
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
98 { |
404
aef165ff92b0
Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents:
403
diff
changeset
|
99 python_object main = py_import_module ("__main__"); |
402
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
100 globals = PyModule_GetDict (main); |
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
101 if (! globals) |
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
102 { |
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
103 globals = PyDict_New (); |
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
104 alloc = true; |
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
105 } |
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
106 } |
335
9b862844e6b7
Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
107 |
402
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
108 if (! locals || (locals == Py_None)) |
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
109 locals = globals; |
335
9b862844e6b7
Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
110 |
402
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
111 // 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
|
112 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
|
113 |
404
aef165ff92b0
Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents:
403
diff
changeset
|
114 python_object retval = PyRun_StringFlags (expr.c_str (), start, globals, locals, |
aef165ff92b0
Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents:
403
diff
changeset
|
115 &flags); |
335
9b862844e6b7
Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
116 |
402
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
117 if (alloc) |
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
118 Py_DECREF (globals); |
335
9b862844e6b7
Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
119 |
402
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
120 if (! retval) |
415
9bf8ba050122
Replace all remaining Boost.Python references
Mike Miller <mtmiller@octave.org>
parents:
411
diff
changeset
|
121 throw pytave::error_already_set (); |
335
9b862844e6b7
Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
122 |
404
aef165ff92b0
Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents:
403
diff
changeset
|
123 return retval.release (); |
402
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
124 } |
335
9b862844e6b7
Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
125 |
402
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
126 PyObject * |
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
127 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
|
128 { |
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
129 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
|
130 } |
335
9b862844e6b7
Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
131 |
402
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
132 PyObject * |
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
133 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
|
134 { |
c4b78e449c62
maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents:
363
diff
changeset
|
135 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
|
136 } |
335
9b862844e6b7
Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
137 |
9b862844e6b7
Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
138 } |