Mercurial > pytave
annotate oct-py-eval.h @ 335:9b862844e6b7
Enable Python print function in evaluated expressions (fixes issue #48)
* oct-py-eval.cc, oct-py-eval.h: New files.
* Makefile.am (COMMON_SOURCE_FILES, PYTAVE_HEADER_FILES): Add oct-py-eval.cc
and oct-py-eval.h to the build system.
* pyeval.cc (Fpyeval): Use pytave::py_eval_string.
* pyexec.cc (Fpyexec): Use pytave::py_exec_string.
author | Mike Miller <mtmiller@octave.org> |
---|---|
date | Mon, 15 Aug 2016 15:16:24 -0700 |
parents | |
children | 040aff46e4db |
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 (pytave_oct_py_eval_h) |
9b862844e6b7
Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
24 #define pytave_oct_py_eval_h 1 |
9b862844e6b7
Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
25 |
9b862844e6b7
Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
26 #include <Python.h> |
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 |
9b862844e6b7
Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
29 namespace pytave |
9b862844e6b7
Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
30 { |
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 PyObject * |
9b862844e6b7
Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
33 py_eval_string (const std::string& expr, PyObject *globals = 0, PyObject *locals = 0); |
9b862844e6b7
Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
34 |
9b862844e6b7
Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
35 PyObject * |
9b862844e6b7
Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
36 py_exec_string (const std::string& expr, PyObject *globals = 0, PyObject *locals = 0); |
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 } |
9b862844e6b7
Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
39 |
9b862844e6b7
Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
40 #endif |