/ src / emc / rs274ngc / pyarrays.cc
pyarrays.cc
 1  /*    This is a component of LinuxCNC
 2   *    Copyright 2013 Michael Haberler <git@mah.priv.at>
 3   *
 4   *    This program is free software; you can redistribute it and/or modify
 5   *    it under the terms of the GNU General Public License as published by
 6   *    the Free Software Foundation; either version 2 of the License, or
 7   *    (at your option) any later version.
 8   *
 9   *    This program is distributed in the hope that it will be useful,
10   *    but WITHOUT ANY WARRANTY; without even the implied warranty of
11   *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   *    GNU General Public License for more details.
13   *
14   *    You should have received a copy of the GNU General Public License
15   *    along with this program; if not, write to the Free Software
16   *    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17   */
18  // Interpreter internals - Python bindings
19  // Michael Haberler 7/2011
20  
21  // (at least in boost 1.55, return_internal_reference needs a definition
22  // of boost::python::detail::get which comes from detail/caller.hpp.
23  // At first sniff it's a boost bug but what can you do...)
24  #define BOOST_PYTHON_MAX_ARITY 4
25  #include <boost/python/detail/caller.hpp>
26  #include <boost/python/return_internal_reference.hpp>
27  namespace bp = boost::python;
28  
29  #include "rs274ngc.hh"
30  #include "interp_internal.hh"
31  #include "array1.hh"
32  
33  namespace pp = pyplusplus::containers::static_sized;
34  #include "interp_array_types.hh"
35  
36  
37  void export_Arrays()
38  {
39      using namespace boost::python;
40      using namespace boost;
41  
42      pp::register_array_1< int, ACTIVE_G_CODES> ("ActiveGcodesArray" );
43      pp::register_array_1< int, ACTIVE_M_CODES> ("ActiveMcodesArray" );
44      pp::register_array_1< double, ACTIVE_SETTINGS> ("ActiveSettingsArray");
45      pp::register_array_1< block, MAX_NESTED_REMAPS,
46  	bp::return_internal_reference< 1, bp::default_call_policies > > ("BlocksArray");
47      pp::register_array_1< double, interp_param_global::RS274NGC_MAX_PARAMETERS > ("ParametersArray");
48      pp::register_array_1< CANON_TOOL_TABLE, CANON_POCKETS_MAX,
49  	bp::return_internal_reference< 1, bp::default_call_policies > > ("ToolTableArray");
50      pp::register_array_1< context, INTERP_SUB_ROUTINE_LEVELS,
51  	bp::return_internal_reference< 1, bp::default_call_policies > > ("SubcontextArray");
52      pp::register_array_1< int, 16> ("GmodesArray");
53      pp::register_array_1< int, 11> ("MmodesArray");
54      pp::register_array_1< double, INTERP_SUB_PARAMS> ("SubroutineParamsArray");
55  }