GCC Code Coverage Report
Directory: emc/rs274ngc/ Exec Total Coverage
File: emc/rs274ngc/canonmodule.cc Lines: 177 181 97.8 %
Date: 2016-10-27 Branches: 32 68 47.1 %

Line Exec Source
1
/*    This is a component of LinuxCNC
2
 *    Copyright 2011, 2012 Jeff Epler <jepler@dsndata.com>, Michael Haberler
3
 *    <git@mah.priv.at>, Sebastian Kuzminsky <seb@highlab.com>
4
 *
5
 *    This program is free software; you can redistribute it and/or modify
6
 *    it under the terms of the GNU General Public License as published by
7
 *    the Free Software Foundation; either version 2 of the License, or
8
 *    (at your option) any later version.
9
 *
10
 *    This program is distributed in the hope that it will be useful,
11
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 *    GNU General Public License for more details.
14
 *
15
 *    You should have received a copy of the GNU General Public License
16
 *    along with this program; if not, write to the Free Software
17
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
 */
19
#include <boost/python/def.hpp>
20
#include <boost/python/module.hpp>
21
#include <boost/python/scope.hpp>
22
23
namespace bp = boost::python;
24
25
#include "rs274ngc_interp.hh"
26
#include "interp_queue.hh"
27
28
static void wrap_canon_error(const char *s)
29
{
30
    if ((s == NULL) || (strlen(s) == 0))
31
	return;
32
    CANON_ERROR("%s", s);
33
}
34
35
36
2
BOOST_PYTHON_MODULE(emccanon) {
37
    using namespace boost::python;
38
2
    scope().attr("__doc__") =
39
        "Canon access & introspection\n"
40
1
        ;
41
42
3
    scope().attr("CANON_PLANE_XY") = CANON_PLANE_XY;
43
3
    scope().attr("CANON_PLANE_YZ") = CANON_PLANE_YZ;
44
3
    scope().attr("CANON_PLANE_XZ") = CANON_PLANE_XZ;
45
3
    scope().attr("CANON_PLANE_UV") = CANON_PLANE_UV;
46
3
    scope().attr("CANON_PLANE_VW") = CANON_PLANE_VW;
47
3
    scope().attr("CANON_PLANE_UW") = CANON_PLANE_UW;
48
49
3
    scope().attr("CANON_UNITS_INCHES") = CANON_UNITS_INCHES;
50
3
    scope().attr("CANON_UNITS_MM") = CANON_UNITS_MM;
51
3
    scope().attr("CANON_UNITS_CM") = CANON_UNITS_CM;
52
53
3
    scope().attr("CANON_EXACT_STOP") = CANON_EXACT_STOP;
54
3
    scope().attr("CANON_EXACT_PATH") = CANON_EXACT_PATH;
55
3
    scope().attr("CANON_CONTINUOUS") = CANON_CONTINUOUS;
56
57
3
    scope().attr("CANON_SYNCHED") = CANON_SYNCHED;
58
2
    scope().attr("CANON_INDEPENDENT") = CANON_INDEPENDENT;
59
60
3
    scope().attr("CANON_STOPPED") = CANON_STOPPED;
61
3
    scope().attr("CANON_CLOCKWISE") = CANON_CLOCKWISE;
62
3
    scope().attr("CANON_COUNTERCLOCKWISE") = CANON_COUNTERCLOCKWISE;
63
64
3
    scope().attr("CANON_WORKPIECE") = CANON_WORKPIECE;
65
3
    scope().attr("CANON_XYZ") = CANON_XYZ;
66
67
3
    scope().attr("CANON_SIDE_RIGHT") = CANON_SIDE_RIGHT;
68
3
    scope().attr("CANON_SIDE_LEFT") = CANON_SIDE_LEFT;
69
3
    scope().attr("CANON_SIDE_OFF") = CANON_SIDE_OFF;
70
71
3
    scope().attr("CANON_AXIS_X") = CANON_AXIS_X;
72
3
    scope().attr("CANON_AXIS_Y") = CANON_AXIS_Y;
73
3
    scope().attr("CANON_AXIS_Z") = CANON_AXIS_Z;
74
3
    scope().attr("CANON_AXIS_A") = CANON_AXIS_A;
75
3
    scope().attr("CANON_AXIS_B") = CANON_AXIS_B;
76
3
    scope().attr("CANON_AXIS_C") = CANON_AXIS_C;
77
78
    //  scope().attr("") =  ;
79
80
1
    def("ARC_FEED",&ARC_FEED);
81
1
    def("CANON_ERROR",&wrap_canon_error);
82
1
    def("CHANGE_TOOL",&CHANGE_TOOL);
83
1
    def("CHANGE_TOOL_NUMBER",&CHANGE_TOOL_NUMBER);
84
1
    def("CLAMP_AXIS",&CLAMP_AXIS);
85
1
    def("CLEAR_AUX_OUTPUT_BIT",&CLEAR_AUX_OUTPUT_BIT);
86
1
    def("CLEAR_MOTION_OUTPUT_BIT",&CLEAR_MOTION_OUTPUT_BIT);
87
1
    def("COMMENT",&COMMENT);
88
1
    def("DISABLE_ADAPTIVE_FEED",&DISABLE_ADAPTIVE_FEED);
89
1
    def("DISABLE_FEED_HOLD",&DISABLE_FEED_HOLD);
90
1
    def("DISABLE_FEED_OVERRIDE",&DISABLE_FEED_OVERRIDE);
91
1
    def("DISABLE_SPEED_OVERRIDE",&DISABLE_SPEED_OVERRIDE);
92
1
    def("DWELL",&DWELL);
93
1
    def("ENABLE_ADAPTIVE_FEED",&ENABLE_ADAPTIVE_FEED);
94
1
    def("ENABLE_FEED_HOLD",&ENABLE_FEED_HOLD);
95
1
    def("ENABLE_FEED_OVERRIDE",&ENABLE_FEED_OVERRIDE);
96
1
    def("ENABLE_SPEED_OVERRIDE",&ENABLE_SPEED_OVERRIDE);
97
1
    def("PLUGIN_CALL",&PLUGIN_CALL);
98
1
    def("IO_PLUGIN_CALL",&IO_PLUGIN_CALL);
99
1
    def("FINISH",&FINISH);
100
1
    def("FLOOD_OFF",&FLOOD_OFF);
101
1
    def("FLOOD_ON",&FLOOD_ON);
102
1
    def("GET_BLOCK_DELETE",&GET_BLOCK_DELETE);
103
1
    def("GET_EXTERNAL_ADAPTIVE_FEED_ENABLE",&GET_EXTERNAL_ADAPTIVE_FEED_ENABLE);
104
1
    def("GET_EXTERNAL_ANALOG_INPUT",&GET_EXTERNAL_ANALOG_INPUT);
105
1
    def("GET_EXTERNAL_ANGLE_UNITS",&GET_EXTERNAL_ANGLE_UNITS);
106
1
    def("GET_EXTERNAL_AXIS_MASK",&GET_EXTERNAL_AXIS_MASK);
107
1
    def("GET_EXTERNAL_DIGITAL_INPUT",&GET_EXTERNAL_DIGITAL_INPUT);
108
1
    def("GET_EXTERNAL_FEED_HOLD_ENABLE",&GET_EXTERNAL_FEED_HOLD_ENABLE);
109
1
    def("GET_EXTERNAL_FEED_OVERRIDE_ENABLE",&GET_EXTERNAL_FEED_OVERRIDE_ENABLE);
110
1
    def("GET_EXTERNAL_FEED_RATE",&GET_EXTERNAL_FEED_RATE);
111
1
    def("GET_EXTERNAL_FLOOD",&GET_EXTERNAL_FLOOD);
112
1
    def("GET_EXTERNAL_LENGTH_UNITS",&GET_EXTERNAL_LENGTH_UNITS);
113
1
    def("GET_EXTERNAL_MIST",&GET_EXTERNAL_MIST);
114
1
    def("GET_EXTERNAL_MOTION_CONTROL_MODE",&GET_EXTERNAL_MOTION_CONTROL_MODE);
115
1
    def("GET_EXTERNAL_MOTION_CONTROL_TOLERANCE",&GET_EXTERNAL_MOTION_CONTROL_TOLERANCE);
116
1
    def("GET_EXTERNAL_PARAMETER_FILE_NAME",&GET_EXTERNAL_PARAMETER_FILE_NAME);
117
1
    def("GET_EXTERNAL_PLANE",&GET_EXTERNAL_PLANE);
118
1
    def("GET_EXTERNAL_POCKETS_MAX",&GET_EXTERNAL_POCKETS_MAX);
119
1
    def("GET_EXTERNAL_POSITION_A",&GET_EXTERNAL_POSITION_A);
120
1
    def("GET_EXTERNAL_POSITION_B",&GET_EXTERNAL_POSITION_B);
121
1
    def("GET_EXTERNAL_POSITION_C",&GET_EXTERNAL_POSITION_C);
122
1
    def("GET_EXTERNAL_POSITION_U",&GET_EXTERNAL_POSITION_U);
123
1
    def("GET_EXTERNAL_POSITION_V",&GET_EXTERNAL_POSITION_V);
124
1
    def("GET_EXTERNAL_POSITION_W",&GET_EXTERNAL_POSITION_W);
125
1
    def("GET_EXTERNAL_POSITION_X",&GET_EXTERNAL_POSITION_X);
126
1
    def("GET_EXTERNAL_POSITION_Y",&GET_EXTERNAL_POSITION_Y);
127
1
    def("GET_EXTERNAL_POSITION_Z",&GET_EXTERNAL_POSITION_Z);
128
1
    def("GET_EXTERNAL_PROBE_POSITION_A",&GET_EXTERNAL_PROBE_POSITION_A);
129
1
    def("GET_EXTERNAL_PROBE_POSITION_B",&GET_EXTERNAL_PROBE_POSITION_B);
130
1
    def("GET_EXTERNAL_PROBE_POSITION_C",&GET_EXTERNAL_PROBE_POSITION_C);
131
1
    def("GET_EXTERNAL_PROBE_POSITION_U",&GET_EXTERNAL_PROBE_POSITION_U);
132
1
    def("GET_EXTERNAL_PROBE_POSITION_V",&GET_EXTERNAL_PROBE_POSITION_V);
133
1
    def("GET_EXTERNAL_PROBE_POSITION_W",&GET_EXTERNAL_PROBE_POSITION_W);
134
1
    def("GET_EXTERNAL_PROBE_POSITION_X",&GET_EXTERNAL_PROBE_POSITION_X);
135
1
    def("GET_EXTERNAL_PROBE_POSITION_Y",&GET_EXTERNAL_PROBE_POSITION_Y);
136
1
    def("GET_EXTERNAL_PROBE_POSITION_Z",&GET_EXTERNAL_PROBE_POSITION_Z);
137
1
    def("GET_EXTERNAL_PROBE_TRIPPED_VALUE",&GET_EXTERNAL_PROBE_TRIPPED_VALUE);
138
1
    def("GET_EXTERNAL_PROBE_VALUE",&GET_EXTERNAL_PROBE_VALUE);
139
1
    def("GET_EXTERNAL_QUEUE_EMPTY",&GET_EXTERNAL_QUEUE_EMPTY);
140
1
    def("GET_EXTERNAL_SELECTED_TOOL_SLOT",&GET_EXTERNAL_SELECTED_TOOL_SLOT);
141
1
    def("GET_EXTERNAL_SPEED",&GET_EXTERNAL_SPEED);
142
1
    def("GET_EXTERNAL_SPINDLE",&GET_EXTERNAL_SPINDLE);
143
1
    def("GET_EXTERNAL_SPINDLE_OVERRIDE_ENABLE",&GET_EXTERNAL_SPINDLE_OVERRIDE_ENABLE);
144
1
    def("GET_EXTERNAL_TC_FAULT",&GET_EXTERNAL_TC_FAULT);
145
1
    def("GET_EXTERNAL_TOOL_LENGTH_AOFFSET",&GET_EXTERNAL_TOOL_LENGTH_AOFFSET);
146
1
    def("GET_EXTERNAL_TOOL_LENGTH_BOFFSET",&GET_EXTERNAL_TOOL_LENGTH_BOFFSET);
147
1
    def("GET_EXTERNAL_TOOL_LENGTH_COFFSET",&GET_EXTERNAL_TOOL_LENGTH_COFFSET);
148
1
    def("GET_EXTERNAL_TOOL_LENGTH_UOFFSET",&GET_EXTERNAL_TOOL_LENGTH_UOFFSET);
149
1
    def("GET_EXTERNAL_TOOL_LENGTH_VOFFSET",&GET_EXTERNAL_TOOL_LENGTH_VOFFSET);
150
1
    def("GET_EXTERNAL_TOOL_LENGTH_WOFFSET",&GET_EXTERNAL_TOOL_LENGTH_WOFFSET);
151
1
    def("GET_EXTERNAL_TOOL_LENGTH_XOFFSET",&GET_EXTERNAL_TOOL_LENGTH_XOFFSET);
152
1
    def("GET_EXTERNAL_TOOL_LENGTH_YOFFSET",&GET_EXTERNAL_TOOL_LENGTH_YOFFSET);
153
1
    def("GET_EXTERNAL_TOOL_LENGTH_ZOFFSET",&GET_EXTERNAL_TOOL_LENGTH_ZOFFSET);
154
1
    def("GET_EXTERNAL_TOOL_SLOT",&GET_EXTERNAL_TOOL_SLOT);
155
1
    def("GET_EXTERNAL_TOOL_TABLE",&GET_EXTERNAL_TOOL_TABLE);
156
1
    def("GET_EXTERNAL_TRAVERSE_RATE",&GET_EXTERNAL_TRAVERSE_RATE);
157
1
    def("GET_OPTIONAL_PROGRAM_STOP",&GET_OPTIONAL_PROGRAM_STOP);
158
1
    def("INIT_CANON",&INIT_CANON);
159
1
    def("LOCK_ROTARY",&LOCK_ROTARY);
160
    //    def("LOCK_SPINDLE_Z",&LOCK_SPINDLE_Z);
161
1
    def("LOGAPPEND",&LOGAPPEND);
162
1
    def("LOGCLOSE",&LOGCLOSE);
163
1
    def("LOG",&LOG);
164
1
    def("LOGOPEN",&LOGOPEN);
165
1
    def("MESSAGE",&MESSAGE);
166
1
    def("MIST_OFF",&MIST_OFF);
167
1
    def("MIST_ON",&MIST_ON);
168
    // def("NURB_CONTROL_POINT",&NURB_CONTROL_POINT);
169
    //  def("NURB_FEED",&NURB_FEED);
170
    // def("NURB_KNOT_VECTOR",&NURB_KNOT_VECTOR);
171
1
    def("NURBS_FEED",&NURBS_FEED);
172
1
    def("OPTIONAL_PROGRAM_STOP",&OPTIONAL_PROGRAM_STOP);
173
    // def("ORIENT_SPINDLE",&ORIENT_SPINDLE);
174
1
    def("PALLET_SHUTTLE",&PALLET_SHUTTLE);
175
1
    def("PROGRAM_END",&PROGRAM_END);
176
1
    def("PROGRAM_STOP",&PROGRAM_STOP);
177
1
    def("RIGID_TAP",&RIGID_TAP);
178
1
    def("SELECT_PLANE",&SELECT_PLANE);
179
1
    def("SELECT_POCKET",&SELECT_POCKET);
180
1
    def("SET_AUX_OUTPUT_BIT",&SET_AUX_OUTPUT_BIT);
181
1
    def("SET_AUX_OUTPUT_VALUE",&SET_AUX_OUTPUT_VALUE);
182
1
    def("SET_BLOCK_DELETE",&SET_BLOCK_DELETE);
183
1
    def("SET_CUTTER_RADIUS_COMPENSATION",&SET_CUTTER_RADIUS_COMPENSATION);
184
1
    def("SET_FEED_MODE",&SET_FEED_MODE);
185
1
    def("SET_FEED_RATE",&SET_FEED_RATE);
186
    //    def("SET_FEED_REFERENCE",&SET_FEED_REFERENCE);
187
1
    def("SET_G5X_OFFSET",&SET_G5X_OFFSET);
188
1
    def("SET_G92_OFFSET",&SET_G92_OFFSET);
189
    //   def("SET_MOTION_CONTROL_MODE",&SET_MOTION_CONTROL_MODE);
190
1
    def("SET_MOTION_OUTPUT_BIT",&SET_MOTION_OUTPUT_BIT);
191
1
    def("SET_MOTION_OUTPUT_VALUE",&SET_MOTION_OUTPUT_VALUE);
192
1
    def("SET_NAIVECAM_TOLERANCE",&SET_NAIVECAM_TOLERANCE);
193
1
    def("SET_OPTIONAL_PROGRAM_STOP",&SET_OPTIONAL_PROGRAM_STOP);
194
1
    def("SET_SPINDLE_MODE",&SET_SPINDLE_MODE);
195
1
    def("SET_SPINDLE_SPEED",&SET_SPINDLE_SPEED);
196
1
    def("SET_TOOL_TABLE_ENTRY",&SET_TOOL_TABLE_ENTRY);
197
1
    def("SET_TRAVERSE_RATE",&SET_TRAVERSE_RATE);
198
1
    def("SET_XY_ROTATION",&SET_XY_ROTATION);
199
1
    def("SPINDLE_RETRACT",&SPINDLE_RETRACT);
200
1
    def("SPINDLE_RETRACT_TRAVERSE",&SPINDLE_RETRACT_TRAVERSE);
201
1
    def("START_CHANGE",&START_CHANGE);
202
1
    def("START_CUTTER_RADIUS_COMPENSATION",&START_CUTTER_RADIUS_COMPENSATION);
203
1
    def("START_SPEED_FEED_SYNCH",&START_SPEED_FEED_SYNCH);
204
1
    def("START_SPINDLE_CLOCKWISE",&START_SPINDLE_CLOCKWISE);
205
1
    def("START_SPINDLE_COUNTERCLOCKWISE",&START_SPINDLE_COUNTERCLOCKWISE);
206
1
    def("STOP_CUTTER_RADIUS_COMPENSATION",&STOP_CUTTER_RADIUS_COMPENSATION);
207
1
    def("STOP_SPEED_FEED_SYNCH",&STOP_SPEED_FEED_SYNCH);
208
1
    def("STOP_SPINDLE_TURNING",&STOP_SPINDLE_TURNING);
209
    // def("STOP",&STOP);
210
1
    def("STRAIGHT_FEED",&STRAIGHT_FEED);
211
1
    def("STRAIGHT_PROBE",&STRAIGHT_PROBE);
212
1
    def("STRAIGHT_TRAVERSE",&STRAIGHT_TRAVERSE);
213
1
    def("TURN_PROBE_OFF",&TURN_PROBE_OFF);
214
1
    def("TURN_PROBE_ON",&TURN_PROBE_ON);
215
    // def("UNCLAMP_AXIS",&UNCLAMP_AXIS);
216
1
    def("UNLOCK_ROTARY",&UNLOCK_ROTARY);
217
1
    def("USE_LENGTH_UNITS",&USE_LENGTH_UNITS);
218
1
    def("USE_NO_SPINDLE_FORCE",&USE_NO_SPINDLE_FORCE);
219
    // def("USER_DEFINED_FUNCTION_ADD",&USER_DEFINED_FUNCTION_ADD);
220
    // def("USE_SPINDLE_FORCE",&USE_SPINDLE_FORCE);
221
1
    def("USE_TOOL_LENGTH_OFFSET",&USE_TOOL_LENGTH_OFFSET);
222
1
    def("WAIT",&WAIT);
223
224
    // from interp_queue.cc
225
1
    def("enqueue_SET_FEED_RATE", &enqueue_SET_FEED_RATE);
226
1
    def("enqueue_SET_FEED_MODE", &enqueue_SET_FEED_MODE);
227
1
    def("enqueue_DWELL", &enqueue_DWELL);
228
1
    def("enqueue_MIST_ON", &enqueue_MIST_ON);
229
1
    def("enqueue_MIST_OFF", &enqueue_MIST_OFF);
230
1
    def("enqueue_FLOOD_ON", &enqueue_FLOOD_ON);
231
1
    def("enqueue_FLOOD_OFF", &enqueue_FLOOD_OFF);
232
1
    def("enqueue_START_SPINDLE_CLOCKWISE", &enqueue_START_SPINDLE_CLOCKWISE);
233
1
    def("enqueue_START_SPINDLE_COUNTERCLOCKWISE", &enqueue_START_SPINDLE_COUNTERCLOCKWISE);
234
1
    def("enqueue_STOP_SPINDLE_TURNING", &enqueue_STOP_SPINDLE_TURNING);
235
1
    def("enqueue_SET_SPINDLE_MODE", &enqueue_SET_SPINDLE_MODE);
236
1
    def("enqueue_SET_SPINDLE_SPEED", &enqueue_SET_SPINDLE_SPEED);
237
1
    def("enqueue_COMMENT", &enqueue_COMMENT);
238
239
    // these need a wrapping so _setup can be passed in - probably better as Interp methods
240
    // def("enqueue_STRAIGHT_FEED", &enqueue_STRAIGHT_FEED);
241
    // def("enqueue_STRAIGHT_TRAVERSE", &enqueue_STRAIGHT_TRAVERSE);
242
    // def("enqueue_ARC_FEED", &enqueue_ARC_FEED);
243
    // def("enqueue_M_USER_COMMAND ", &enqueue_M_USER_COMMAND);
244
    // def("enqueue_START_CHANGE", & enqueue_START_CHANGE);
245
346
}