comparison oct-py-types.h @ 411:3613ffbd52b2

Overhaul implicit conversion of arguments and return values * oct-py-types.cc, oct-py-types.h (pytave::py_implicitly_convert_argument, pytave::py_implicitly_convert_return_value): New functions. * __py_struct_from_dict__.cc, oct-py-eval.cc, pycall.cc, pyeval.cc, pyexec.cc: Use them instead of legacy conversion functions. Add necessary #includes, remove #includes of legacy header files. * @pyobject/subsasgn.m, @pyobject/subsref.m: Change %!tests that depend on NumPy implicit conversion into %!xtests. * octave_to_python.cc, octave_to_python.h, python_to_octave.cc, python_to_octave.h: Delete, no longer used. * Makefile.am (COMMON_SOURCE_FILES, PYTAVE_HEADER_FILES): Remove the files.
author Mike Miller <mtmiller@octave.org>
date Wed, 03 May 2017 16:30:45 -0700
parents c4b78e449c62
children
comparison
equal deleted inserted replaced
410:95c6ad0be828 411:3613ffbd52b2
215 //! @param str string value 215 //! @param str string value
216 //! @return Python str object 216 //! @return Python str object
217 PyObject * 217 PyObject *
218 make_py_str (const std::string& str); 218 make_py_str (const std::string& str);
219 219
220 //! Perform an implicit conversion of the given Octave @c value to a Python
221 //! argument.
222 //!
223 //! The following implicit type conversions are implemented by this function:
224 //!
225 //! @arg @c bool from Octave logical scalar,
226 //! @arg @c complex from Octave double or single precision complex scalar,
227 //! @arg @c float from Octave double or single precision scalar,
228 //! @arg @c int from any Octave integer-valued scalar,
229 //! @arg @c long from Octave @c uint32, @c int64, or @c uint64, and only if
230 //! running against Python 2,
231 //! @arg @c str from Octave string (@c char row vector),
232 //! @arg @c array.array from Octave numeric column or row vector,
233 //! @arg @c dict from Octave scalar map (consisting entirely of implicitly
234 //! convertible elements),
235 //! @arg @c tuple from Octave cell array (consisting entirely of implicitly
236 //! convertible elements).
237 //!
238 //! If @c value refers to a previously created Python object, then a reference
239 //! to the existing object is returned.
240 //!
241 //! Otherwise, a conversion error is raised.
242 //!
243 //! @param value Octave value
244 //! @return Python object
245 PyObject *
246 py_implicitly_convert_argument (const octave_value& value);
247
248 //! Perform an implicit conversion of the given Python object to an Octave
249 //! return value.
250 //!
251 //! The following implicit type conversions are implemented by this function:
252 //!
253 //! @arg @c logical scalar from Python @c bool,
254 //! @arg @c complex @c double from Python @c complex,
255 //! @arg @c double from Python @c float,
256 //! @arg @c int64 from Python @c int, only if running against Python 2.
257 //!
258 //! Otherwise, @c obj is left unconverted, a reference is maintained to it,
259 //! and an Octave value containing that reference is returned.
260 //!
261 //! @param obj Python object
262 //! @return Octave value
263 octave_value
264 py_implicitly_convert_return_value (PyObject *obj);
265
220 } 266 }
221 267
222 #endif 268 #endif