GCC Code Coverage Report
Directory: emc/rs274ngc/ Exec Total Coverage
File: emc/rs274ngc/pyblock.cc Lines: 72 80 90.0 %
Date: 2016-10-27 Branches: 11 22 50.0 %

Line Exec Source
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
 */
18
// Interpreter internals - Python bindings
19
// Michael Haberler 7/2011
20
//
21
22
#include <boost/python/class.hpp>
23
#include <boost/python/suite/indexing/map_indexing_suite.hpp>
24
#include <map>
25
26
namespace bp = boost::python;
27
28
#include "rs274ngc.hh"
29
#include "interp_internal.hh"
30
#include "rs274ngc_interp.hh"
31
#include "array1.hh"
32
33
namespace pp = pyplusplus::containers::static_sized;
34
#include "interp_array_types.hh"
35
36
static const char *get_comment(block &b) { return b.comment; };
37
static const char *get_o_name(block &b) { return b.o_name; };
38
39
static  g_modes_array g_modes_wrapper ( block & b) {
40
    return g_modes_array(b.g_modes);
41
}
42
43
static  m_modes_array m_modes_wrapper ( block & b) {
44
    return m_modes_array(b.m_modes);
45
}
46
47
static params_array params_wrapper ( block & b) {
48
    return params_array(b.params);
49
}
50
51
68
void export_Block()
52
{
53
    using namespace boost::python;
54
    using namespace boost;
55
    class_ <block, noncopyable>("Block",no_init)
56
136
	.def_readwrite("f_flag",&block::f_flag)
57
68
	.def_readwrite("p_flag",&block::p_flag)
58
68
	.def_readwrite("p_number",&block::p_number)
59
68
	.def_readwrite("a_flag",&block::a_flag)
60
68
	.def_readwrite("a_number",&block::a_number)
61
68
	.def_readwrite("b_flag",&block::b_flag)
62
68
	.def_readwrite("b_number",&block::b_number)
63
68
	.def_readwrite("c_flag",&block::c_flag)
64
68
	.def_readwrite("c_number",&block::c_number)
65
68
	.def_readwrite("d_number_float",&block::d_number_float)
66
68
	.def_readwrite("d_flag",&block::d_flag)
67
68
	.def_readwrite("e_flag",&block::e_flag)
68
68
	.def_readwrite("e_number",&block::e_number)
69
68
	.def_readwrite("f_flag",&block::f_flag)
70
68
	.def_readwrite("f_number",&block::f_number)
71
68
	.def_readwrite("h_flag",&block::h_flag)
72
68
	.def_readwrite("h_number",&block::h_number)
73
68
	.def_readwrite("i_flag",&block::i_flag)
74
68
	.def_readwrite("i_number",&block::i_number)
75
68
	.def_readwrite("j_flag",&block::j_flag)
76
68
	.def_readwrite("j_number",&block::j_number)
77
68
	.def_readwrite("k_flag",&block::k_flag)
78
68
	.def_readwrite("k_number",&block::k_number)
79
68
	.def_readwrite("l_number",&block::l_number)
80
68
	.def_readwrite("l_flag",&block::l_flag)
81
68
	.def_readwrite("line_number",&block::line_number)
82
68
	.def_readwrite("saved_line_number",&block::line_number)
83
68
	.def_readwrite("n_number",&block::n_number)
84
68
	.def_readwrite("motion_to_be",&block::motion_to_be)
85
68
	.def_readwrite("m_count",&block::m_count)
86
68
	.def_readwrite("user_m",&block::user_m)
87
68
	.def_readwrite("p_number",&block::p_number)
88
68
	.def_readwrite("p_flag",&block::p_flag)
89
68
	.def_readwrite("q_number",&block::q_number)
90
68
	.def_readwrite("q_flag",&block::q_flag)
91
68
	.def_readwrite("r_flag",&block::r_flag)
92
68
	.def_readwrite("r_number",&block::r_number)
93
68
	.def_readwrite("s_flag",&block::s_flag)
94
68
	.def_readwrite("s_number",&block::s_number)
95
68
	.def_readwrite("t_flag",&block::t_flag)
96
68
	.def_readwrite("t_number",&block::t_number)
97
68
	.def_readwrite("u_flag",&block::u_flag)
98
68
	.def_readwrite("u_number",&block::u_number)
99
68
	.def_readwrite("v_flag",&block::v_flag)
100
68
	.def_readwrite("v_number",&block::v_number)
101
68
	.def_readwrite("w_flag",&block::w_flag)
102
68
	.def_readwrite("w_number",&block::w_number)
103
68
	.def_readwrite("x_flag",&block::x_flag)
104
68
	.def_readwrite("x_number",&block::x_number)
105
68
	.def_readwrite("y_flag",&block::y_flag)
106
68
	.def_readwrite("y_number",&block::y_number)
107
68
	.def_readwrite("z_flag",&block::z_flag)
108
68
	.def_readwrite("z_number",&block::z_number)
109
68
	.def_readwrite("radius_flag",&block::radius_flag)
110
68
	.def_readwrite("radius",&block::radius)
111
68
	.def_readwrite("theta_flag",&block::theta_flag)
112
68
	.def_readwrite("theta",&block::theta)
113
114
68
	.def_readwrite("offset",&block::offset)
115
136
	.def_readwrite("o_type",&block::o_type)
116
117
	// I hope someday I really understand this
118
	.add_property("executing_remap",
119
		      make_getter(&block::executing_remap,
120
				  return_value_policy<reference_existing_object>()),
121
		      make_setter(&block::executing_remap,
122
340
				  return_value_policy<reference_existing_object>()))
123
124
68
	.def_readwrite("call_type",&block::call_type)
125
68
	.def_readwrite("breadcrumbs",&block::breadcrumbs)
126
68
	.def_readwrite("phase",&block::phase)
127
136
	.def_readwrite("builtin_used",&block::builtin_used)
128
129
	//  read-only
130
68
	.add_property("comment",  &get_comment)
131
68
	.add_property("o_name",   &get_o_name)
132
133
	.add_property( "params",
134
		       bp::make_function( params_w(&params_wrapper),
135
204
					  bp::with_custodian_and_ward_postcall< 0, 1 >()))
136
	// arrays
137
	.add_property( "m_modes",
138
		       bp::make_function( m_modes_w(&m_modes_wrapper),
139
204
					  bp::with_custodian_and_ward_postcall< 0, 1 >()))
140
	.add_property( "g_modes",
141
		       bp::make_function( g_modes_w(&g_modes_wrapper),
142
136
					  bp::with_custodian_and_ward_postcall< 0, 1 >()))
143
144
68
	;
145
146
413
}