annotate oct-py-init.h @ 405:478d83448b0b

Refactor Python initialization into a common function * oct-py-init.cc, oct-py-init.h: New files defining a pytave::py_init function. * __py_struct_from_dict__.cc, pycall.cc, pyeval.cc, pyexec.cc: Use it instead of initializing Python differently in each entry point. * Makefile.am (COMMON_SOURCE_FILES): Include oct-py-init.cc in the list. (PYTAVE_HEADER_FILES): Include oct-py-init.h in the list.
author Mike Miller <mtmiller@octave.org>
date Sat, 29 Apr 2017 15:43:42 -0700
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
405
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
1 /*
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
2
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
3 Copyright (C) 2017 Mike Miller
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
4
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
5 This file is part of Pytave.
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
6
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
7 Pytave is free software; you can redistribute it and/or modify it
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
10 option) any later version.
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
11
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
12 Pytave is distributed in the hope that it will be useful, but WITHOUT
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
15 for more details.
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
16
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
18 along with Pytave; see the file COPYING. If not, see
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
19 <http://www.gnu.org/licenses/>.
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
20
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
21 */
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
22
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
23 #if ! defined (pytave_oct_py_init_h)
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
24 #define pytave_oct_py_init_h 1
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
25
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
26 namespace pytave
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
27 {
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
28
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
29 //! Initialize the Python interpreter and execution environment.
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
30 void
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
31 py_init ();
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
32
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
33 }
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
34
478d83448b0b Refactor Python initialization into a common function
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
35 #endif