Import LinuxCNC source tree

This commit is contained in:
Wang Dequan
2026-08-20 06:17:39 +08:00
commit 2c814634c3
9429 changed files with 10556013 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
This tests for a specific interpreter regression where in very
specific circumstances involving remapped functions,
`_setup.sequence_number` is reset, which triggers the "duplicate
O-word label" sanity check.
This test triggers the regression by calling a remap twice. In the first
call, before the problem O-word, it calls a second-level remap that
returns with a reset `_setup.sequence_number`, so the following O-word
is recorded with an incorrect position.
In the second call, the second-level remap is not invoked, so the
following O-word appears at the correct `_setup.sequence_number`; the
differing positions then triggers the "duplicate O-word label" sanity
check and the program exits with an error.

View File

@@ -0,0 +1,18 @@
N..... USE_LENGTH_UNITS(CANON_UNITS_MM)
N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
N..... SET_G92_OFFSET(0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
N..... SET_XY_ROTATION(0.0000)
N..... SET_FEED_REFERENCE(CANON_XYZ)
N..... ON_RESET()
N..... MESSAGE(" executing m207: run remapped m208 before o<problem>")
N..... MESSAGE(" rm207 executing problem if")
N..... MESSAGE(" rm207 within problem if")
N..... MESSAGE(" rm207 done executing problem if")
N..... MESSAGE(" executing m207: do NOT run remapped m208 before o<problem>")
N..... MESSAGE(" rm207 running remapped m208")
N..... MESSAGE(" rm208 starting and done")
N..... MESSAGE(" rm207 executing problem if")
N..... MESSAGE(" rm207 within problem if")
N..... MESSAGE(" rm207 done executing problem if")
N..... FINISH()
N..... ON_RESET()

View File

@@ -0,0 +1,11 @@
o<rm207> sub
o<setup> if [#<_killme> GT 0]
(debug, rm207 running remapped m208)
m208
o<setup> endif
(debug, rm207 executing problem if)
o<problem> if [6]
(debug, rm207 within problem if)
o<problem> endif
(debug, rm207 done executing problem if)
o<rm207> endsub

View File

@@ -0,0 +1,3 @@
o<rm208> sub
(debug, rm208 starting and done)
o<rm208> endsub

View File

@@ -0,0 +1,12 @@
[EMC]
DEBUG=65535
LOG_LEVEL=5000
[RS274NGC]
DEBUG=65535
LOG_LEVEL=5000
SUBROUTINE_PATH = .
REMAP=M207 modalgroup=10 ngc=rm207
REMAP=M208 modalgroup=10 ngc=rm208

View File

@@ -0,0 +1,8 @@
%
(debug, executing m207: run remapped m208 before o<problem>)
#<_killme> = 0
m207
(debug, executing m207: do NOT run remapped m208 before o<problem>)
#<_killme> = 1
m207
%

View File

@@ -0,0 +1,4 @@
#!/bin/bash
export INI_FILE_NAME=test.ini
rs274 -i "$INI_FILE_NAME" -g test.ngc | awk '{$1=""; print}'
exit "${PIPESTATUS[0]}"

View File

@@ -0,0 +1 @@
Exercise parameter passing to user-defined code

View File

@@ -0,0 +1,17 @@
N..... USE_LENGTH_UNITS(CANON_UNITS_MM)
N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
N..... SET_G92_OFFSET(0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
N..... SET_XY_ROTATION(0.0000)
N..... SET_FEED_REFERENCE(CANON_XYZ)
N..... ON_RESET()
N..... MESSAGE(" M400 call_level= 1.000000 remap_level=1.000000")
N..... MESSAGE(" P word set: 47.110000")
N..... MESSAGE(" Q word set: 8.150000")
N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
N..... SET_XY_ROTATION(0.0000)
N..... SET_FEED_MODE(0, 0)
N..... SET_FEED_RATE(0.0000)
N..... STOP_SPINDLE_TURNING(0)
N..... SET_SPINDLE_MODE(0 0.0000)
N..... PROGRAM_END()
N..... ON_RESET()

View File

@@ -0,0 +1,18 @@
o<rm400> sub
(debug, M400 call_level= #<_call_level> remap_level=#<_remap_level>)
o100 if [EXISTS[#<P>]]
(debug, P word set: #<P>)
o100 else
(debug, P word missing)
o100 endif
o120 if [EXISTS[#<Q>]]
(debug, Q word set: #<Q>)
o120 else
(debug, Q word missing)
o120 endif
o<rm400> endsub
m2
%

View File

@@ -0,0 +1,9 @@
[EMC]
DEBUG=0
LOG_LEVEL=0
[RS274NGC]
SUBROUTINE_PATH = .
# M405 requires P- Q- and does NOT permit any other words in this block
REMAP=M400 modalgroup=5 argspec=PQ ngc=rm400

View File

@@ -0,0 +1,2 @@
M400 P47.11 Q8.15
M2

View File

@@ -0,0 +1,3 @@
#!/bin/bash
rs274 -i test.ini -g test.ngc | awk '{$1=""; print}'
exit "${PIPESTATUS[0]}"

View File

@@ -0,0 +1,3 @@
Exercise failed parameter passing to user-defined code
The required Q parameter is missing

View File

@@ -0,0 +1,17 @@
executing
1 N..... USE_LENGTH_UNITS(CANON_UNITS_MM)
2 N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
3 N..... SET_G92_OFFSET(0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
4 N..... SET_XY_ROTATION(0.0000)
5 N..... SET_FEED_REFERENCE(CANON_XYZ)
6 N..... ON_RESET()
user-defined M400: missing: Q
O <rm400> call
7 N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
8 N..... SET_XY_ROTATION(0.0000)
9 N..... SET_FEED_MODE(0, 0)
10 N..... SET_FEED_RATE(0.0000)
11 N..... STOP_SPINDLE_TURNING(0)
12 N..... SET_SPINDLE_MODE(0 0.0000)
13 N..... PROGRAM_END()
14 N..... ON_RESET()

View File

@@ -0,0 +1,18 @@
o<rm400> sub
(debug, M400 call_level= #<_call_level> remap_level=#<_remap_level>)
o100 if [EXISTS[#<P>]]
(debug, P word set: #<P>)
o100 else
(debug, P word missing)
o100 endif
o120 if [EXISTS[#<Q>]]
(debug, Q word set: #<Q>)
o120 else
(debug, Q word missing)
o120 endif
o<rm400> endsub
m2
%

View File

@@ -0,0 +1,9 @@
[EMC]
DEBUG=0
LOG_LEVEL=0
[RS274NGC]
SUBROUTINE_PATH = .
# M405 requires P- Q- and does NOT permit any other words in this block
REMAP=M400 modalgroup=5 argspec=PQ ngc=rm400

View File

@@ -0,0 +1,2 @@
M400 P47.11
M2

View File

@@ -0,0 +1,3 @@
#!/bin/bash
rs274 -i test.ini -n 0 -g test.ngc 2>&1
exit "${PIPESTATUS[0]}"

View File

@@ -0,0 +1,3 @@
Exercise failed parameter passing to user-defined code
The required Q parameter is missing

View File

@@ -0,0 +1,17 @@
executing
1 N..... USE_LENGTH_UNITS(CANON_UNITS_MM)
2 N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
3 N..... SET_G92_OFFSET(0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
4 N..... SET_XY_ROTATION(0.0000)
5 N..... SET_FEED_REFERENCE(CANON_XYZ)
6 N..... ON_RESET()
user-defined M400: missing: P,Q
O <rm400> call
7 N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
8 N..... SET_XY_ROTATION(0.0000)
9 N..... SET_FEED_MODE(0, 0)
10 N..... SET_FEED_RATE(0.0000)
11 N..... STOP_SPINDLE_TURNING(0)
12 N..... SET_SPINDLE_MODE(0 0.0000)
13 N..... PROGRAM_END()
14 N..... ON_RESET()

View File

@@ -0,0 +1,18 @@
o<rm400> sub
(debug, M400 call_level= #<_call_level> remap_level=#<_remap_level>)
o100 if [EXISTS[#<P>]]
(debug, P word set: #<P>)
o100 else
(debug, P word missing)
o100 endif
o120 if [EXISTS[#<Q>]]
(debug, Q word set: #<Q>)
o120 else
(debug, Q word missing)
o120 endif
o<rm400> endsub
m2
%

View File

@@ -0,0 +1,9 @@
[EMC]
DEBUG=0
LOG_LEVEL=0
[RS274NGC]
SUBROUTINE_PATH = .
# M405 requires P- Q- and does NOT permit any other words in this block
REMAP=M400 modalgroup=5 argspec=PQ ngc=rm400

View File

@@ -0,0 +1,2 @@
M400 R122.25
M2

View File

@@ -0,0 +1,3 @@
#!/bin/bash
rs274 -i test.ini -n 0 -g test.ngc 2>&1
exit "${PIPESTATUS[0]}"

View File

@@ -0,0 +1 @@
Exercise failed remap NGC procedure - must properly return to top level

View File

@@ -0,0 +1,20 @@
executing
1 N..... USE_LENGTH_UNITS(CANON_UNITS_MM)
2 N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
3 N..... SET_G92_OFFSET(0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
4 N..... SET_XY_ROTATION(0.0000)
5 N..... SET_FEED_REFERENCE(CANON_XYZ)
6 N..... ON_RESET()
7 N..... MESSAGE(" before M400: call_level= 0.000000 remap_level=0.000000")
8 N..... MESSAGE(" in rm400: call_level= 1.000000 remap_level=1.000000")
Attempt to divide by zero
#100 = [1/0]
9 N..... MESSAGE(" after failed M400: call_level= 0.000000 remap_level=0.000000")
10 N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
11 N..... SET_XY_ROTATION(0.0000)
12 N..... SET_FEED_MODE(0, 0)
13 N..... SET_FEED_RATE(0.0000)
14 N..... STOP_SPINDLE_TURNING(0)
15 N..... SET_SPINDLE_MODE(0 0.0000)
16 N..... PROGRAM_END()
17 N..... ON_RESET()

View File

@@ -0,0 +1,6 @@
o<rm400> sub
(debug, in rm400: call_level= #<_call_level> remap_level=#<_remap_level>)
#100 = [1/0]
o<rm400> endsub
m2
%

View File

@@ -0,0 +1,9 @@
[EMC]
DEBUG=0
LOG_LEVEL=0
[RS274NGC]
SUBROUTINE_PATH = .
REMAP=M400 modalgroup=5 ngc=rm400

View File

@@ -0,0 +1,4 @@
(debug, before M400: call_level= #<_call_level> remap_level=#<_remap_level>)
M400
(debug, after failed M400: call_level= #<_call_level> remap_level=#<_remap_level>)
M2

View File

@@ -0,0 +1,3 @@
#!/bin/bash
rs274 -i test.ini -n 0 -g test.ngc 2>&1
exit "${PIPESTATUS[0]}"

View File

@@ -0,0 +1,3 @@
Exercise failed remap NGC procedure
must properly return to top level, convey error text

View File

@@ -0,0 +1,11 @@
executing
1 N..... USE_LENGTH_UNITS(CANON_UNITS_MM)
2 N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
3 N..... SET_G92_OFFSET(0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
4 N..... SET_XY_ROTATION(0.0000)
5 N..... SET_FEED_REFERENCE(CANON_XYZ)
6 N..... ON_RESET()
7 N..... MESSAGE(" before M400: call_level= 0.000000 remap_level=0.000000")
A failed Python remap handler returning INTERP_ERROR
O <interp_error> call
8 N..... ON_RESET()

View File

@@ -0,0 +1,24 @@
# This is a component of LinuxCNC
# Copyright 2011 Michael Haberler <git@mah.priv.at>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
import interpreter
def interp_error(self, **words):
self.set_errormsg("A failed Python remap handler returning INTERP_ERROR")
return interpreter.INTERP_ERROR

View File

@@ -0,0 +1,21 @@
# This is a component of LinuxCNC
# Copyright 2011 Michael Haberler <git@mah.priv.at>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
import remap

View File

@@ -0,0 +1,13 @@
[EMC]
DEBUG=0
LOG_LEVEL=0
[PYTHON]
PATH_PREPEND=.
TOPLEVEL=subs.py
LOG_LEVEL=0
[RS274NGC]
REMAP=M400 modalgroup=5 py=interp_error
LOG_LEVEL=0

View File

@@ -0,0 +1,4 @@
(debug, before M400: call_level= #<_call_level> remap_level=#<_remap_level>)
M400
(debug, after failed M400: call_level= #<_call_level> remap_level=#<_remap_level>)
M2

View File

@@ -0,0 +1,3 @@
#!/bin/bash
export PYTHONUNBUFFERED=1
! rs274 -i test.ini -n 2 -g test.ngc 2>&1

View File

@@ -0,0 +1,3 @@
Exercise CANON_ERROR
.. including embedding printf format-specifiers in the error string

View File

@@ -0,0 +1,20 @@
executing
1 N..... USE_LENGTH_UNITS(CANON_UNITS_MM)
2 N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
3 N..... SET_G92_OFFSET(0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
4 N..... SET_XY_ROTATION(0.0000)
5 N..... SET_FEED_REFERENCE(CANON_XYZ)
6 N..... ON_RESET()
7 N..... MESSAGE(" before M400: call_level= 0.000000 remap_level=0.000000")
8 N..... CANON_ERROR(%s is a literal percent s)
A failed Python prolog returning INTERP_ERROR
O <notcalled> call
9 N..... MESSAGE(" after failed M400: call_level= 0.000000 remap_level=0.000000")
10 N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
11 N..... SET_XY_ROTATION(0.0000)
12 N..... SET_FEED_MODE(0, 0)
13 N..... SET_FEED_RATE(0.0000)
14 N..... STOP_SPINDLE_TURNING(0)
15 N..... SET_SPINDLE_MODE(0 0.0000)
16 N..... PROGRAM_END()
17 N..... ON_RESET()

View File

@@ -0,0 +1,24 @@
# Copyright (C) 2013 Jeff Epler <jepler@unpythonic.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import emccanon
import interpreter
def failingprolog(self,*args, **words):
emccanon.CANON_ERROR("%s is a literal percent s")
self.set_errormsg("A failed Python prolog returning INTERP_ERROR")
return interpreter.INTERP_ERROR

View File

@@ -0,0 +1,16 @@
# Copyright (C) 2013 Jeff Epler <jepler@unpythonic.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import remap

View File

@@ -0,0 +1,15 @@
[EMC]
DEBUG=0
LOG_LEVEL=0
[RS274NGC]
SUBROUTINE_PATH = .
REMAP=M400 modalgroup=5 prolog=failingprolog ngc=notcalled
[PYTHON]
PATH_PREPEND=.
TOPLEVEL=subs.py

View File

@@ -0,0 +1,4 @@
(debug, before M400: call_level= #<_call_level> remap_level=#<_remap_level>)
M400
(debug, after failed M400: call_level= #<_call_level> remap_level=#<_remap_level>)
M2

View File

@@ -0,0 +1,5 @@
#!/bin/bash
export PYTHONUNBUFFERED=1
rs274 -i test.ini -n 0 -g test.ngc 2>&1
# expected to fail
exit 0

View File

@@ -0,0 +1,3 @@
Exercise failed prolog for a remap NGC procedure
must properly return to top level, convey error text

View File

@@ -0,0 +1,13 @@
executing
1 N..... USE_LENGTH_UNITS(CANON_UNITS_MM)
2 N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
3 N..... SET_G92_OFFSET(0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
4 N..... SET_XY_ROTATION(0.0000)
5 N..... SET_FEED_REFERENCE(CANON_XYZ)
6 N..... ON_RESET()
7 N..... MESSAGE(" before M400: call_level= 0.000000 remap_level=0.000000")
8 N..... MESSAGE(" I should complain if I weren't called but I guess I can not do that")
9 N..... MESSAGE("failing_epilog returning INTERP_ERROR")
A failed Python epilog returning INTERP_ERROR
o<mustbecalled>endsub
10 N..... ON_RESET()

View File

@@ -0,0 +1,4 @@
o<mustbecalled>sub
(debug, I should complain if I weren't called but I guess I can not do that)
o<mustbecalled>endsub
m2

View File

@@ -0,0 +1,26 @@
# This is a component of LinuxCNC
# Copyright 2011 Michael Haberler <git@mah.priv.at>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
import emccanon
import interpreter
def failingepilog(self,*args, **words):
emccanon.MESSAGE("failing_epilog returning INTERP_ERROR")
self.set_errormsg("A failed Python epilog returning INTERP_ERROR")
return interpreter.INTERP_ERROR

View File

@@ -0,0 +1,19 @@
# This is a component of LinuxCNC
# Copyright 2011 Michael Haberler <git@mah.priv.at>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
import remap

View File

@@ -0,0 +1,15 @@
[EMC]
DEBUG=0
LOG_LEVEL=0
[PYTHON]
PATH_PREPEND=.
TOPLEVEL=subs.py
LOG_LEVEL=0
[RS274NGC]
LOG_LEVEL=0
SUBROUTINE_PATH = .
REMAP=M400 modalgroup=5 ngc=mustbecalled epilog=failingepilog

View File

@@ -0,0 +1,7 @@
(debug, before M400: call_level= #<_call_level> remap_level=#<_remap_level>)
M400
(this should NOT execute because the failed epilog is supposed to abort!)
(debug, after failed M400: call_level= #<_call_level> remap_level=#<_remap_level>)
M2

View File

@@ -0,0 +1,3 @@
#!/bin/bash
export PYTHONUNBUFFERED=1
! rs274 -i test.ini -n 2 -g test.ngc 2>&1

View File

@@ -0,0 +1,3 @@
Exercise failed prolog for a remap NGC procedure
must properly return to top level, convey error text

View File

@@ -0,0 +1,20 @@
executing
1 N..... USE_LENGTH_UNITS(CANON_UNITS_MM)
2 N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
3 N..... SET_G92_OFFSET(0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
4 N..... SET_XY_ROTATION(0.0000)
5 N..... SET_FEED_REFERENCE(CANON_XYZ)
6 N..... ON_RESET()
7 N..... MESSAGE(" before M400: call_level= 0.000000 remap_level=0.000000")
8 N..... MESSAGE("failingprolog returning INTERP_ERROR")
A failed Python prolog returning INTERP_ERROR
O <notcalled> call
9 N..... MESSAGE(" after failed M400: call_level= 0.000000 remap_level=0.000000")
10 N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
11 N..... SET_XY_ROTATION(0.0000)
12 N..... SET_FEED_MODE(0, 0)
13 N..... SET_FEED_RATE(0.0000)
14 N..... STOP_SPINDLE_TURNING(0)
15 N..... SET_SPINDLE_MODE(0 0.0000)
16 N..... PROGRAM_END()
17 N..... ON_RESET()

View File

View File

@@ -0,0 +1,26 @@
# This is a component of LinuxCNC
# Copyright 2011 Michael Haberler <git@mah.priv.at>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
import emccanon
import interpreter
def failingprolog(self,*args, **words):
emccanon.MESSAGE("failingprolog returning INTERP_ERROR")
self.set_errormsg("A failed Python prolog returning INTERP_ERROR")
return interpreter.INTERP_ERROR

View File

@@ -0,0 +1,18 @@
# This is a component of LinuxCNC
# Copyright 2011 Michael Haberler <git@mah.priv.at>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
import remap

View File

@@ -0,0 +1,15 @@
[EMC]
DEBUG=0
LOG_LEVEL=0
[RS274NGC]
SUBROUTINE_PATH = .
REMAP=M400 modalgroup=5 prolog=failingprolog ngc=notcalled
[PYTHON]
PATH_PREPEND=.
TOPLEVEL=subs.py

View File

@@ -0,0 +1,4 @@
(debug, before M400: call_level= #<_call_level> remap_level=#<_remap_level>)
M400
(debug, after failed M400: call_level= #<_call_level> remap_level=#<_remap_level>)
M2

View File

@@ -0,0 +1,5 @@
#!/bin/bash
export PYTHONUNBUFFERED=1
rs274 -i test.ini -n 0 -g test.ngc 2>&1
# expected to fail
exit 0

View File

@@ -0,0 +1,5 @@
Exercise a Python oword subroutine, including parameter passing and return values
not a remap, but it comes with the remapping code so test it here.
must properly return to top level

View File

@@ -0,0 +1,42 @@
executing
1 N..... USE_LENGTH_UNITS(CANON_UNITS_MM)
2 N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
3 N..... SET_G92_OFFSET(0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
4 N..... SET_XY_ROTATION(0.0000)
5 N..... SET_FEED_REFERENCE(CANON_XYZ)
6 N..... ON_RESET()
7 N..... MESSAGE(" before introspect: call_level= 0.000000")
8 N..... SELECT_TOOL(3)
9 N..... STOP_SPINDLE_TURNING(0)
10 N..... CHANGE_TOOL()
11 N..... SET_FEED_RATE(200.0000)
12 N..... SET_SPINDLE_SPEED(0, 3000.0000)
13 N..... START_SPINDLE_CLOCKWISE(0)
debug: 1073741824 logging: 0
call_level= 1
argc= 4
args=( 1.00000 2.00000 3.00000 3.14159 )
param # 0 = 1.0
param # 1 = 2.0
param # 2 = 3.0
param # 3 = 3.14159
current oword subname= introspect
m_modes[0]= -1
g_modes[0]= -1
current tool= 3.0 3.0
feed= 200.0
speed= 3000.0
global parameter set in test.ngc: 47.11
parameter set via test.ini: 3.14159
locals: ['a_new_local']
globals: ['_a', '_a_global_set_in_test_dot_ngc', '_a_new_global', '_abs_a', '_abs_b', '_abs_c', '_abs_u', '_abs_v', '_abs_w', '_abs_x', '_abs_y', '_abs_z', '_absolute', '_adaptive_feed', '_b', '_c', '_call_level', '_ccomp', '_coord_system', '_current_pocket', '_current_tool', '_feed', '_feed_hold', '_feed_override', '_flood', '_ijk_absolute_mode', '_imperial', '_incremental', '_ini[example]variable', '_inverse_time', '_lathe_diameter_mode', '_lathe_radius_mode', '_line', '_metric', '_metric_machine', '_mist', '_motion_mode', '_plane', '_remap_level', '_retract_old_z', '_retract_r_plane', '_rpm', '_selected_pocket', '_selected_tool', '_speed_override', '_spindle_css_mode', '_spindle_cw', '_spindle_on', '_spindle_rpm_mode', '_task', '_tool_offset', '_u', '_units_per_minute', '_units_per_rev', '_v', '_value', '_value_returned', '_vmajor', '_vminor', '_w', '_x', '_y', '_z', 'foo']
params(): ['a_new_local', '_a', '_a_global_set_in_test_dot_ngc', '_a_new_global', '_abs_a', '_abs_b', '_abs_c', '_abs_u', '_abs_v', '_abs_w', '_abs_x', '_abs_y', '_abs_z', '_absolute', '_adaptive_feed', '_b', '_c', '_call_level', '_ccomp', '_coord_system', '_current_pocket', '_current_tool', '_feed', '_feed_hold', '_feed_override', '_flood', '_ijk_absolute_mode', '_imperial', '_incremental', '_ini[example]variable', '_inverse_time', '_lathe_diameter_mode', '_lathe_radius_mode', '_line', '_metric', '_metric_machine', '_mist', '_motion_mode', '_plane', '_remap_level', '_retract_old_z', '_retract_r_plane', '_rpm', '_selected_pocket', '_selected_tool', '_speed_override', '_spindle_css_mode', '_spindle_cw', '_spindle_on', '_spindle_rpm_mode', '_task', '_tool_offset', '_u', '_units_per_minute', '_units_per_rev', '_v', '_value', '_value_returned', '_vmajor', '_vminor', '_w', '_x', '_y', '_z', 'foo']
14 N..... MESSAGE(" after introspect: return value=2.718280 call_level= 0.000000")
15 N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
16 N..... SET_XY_ROTATION(0.0000)
17 N..... SET_FEED_MODE(0, 0)
18 N..... SET_FEED_RATE(0.0000)
19 N..... STOP_SPINDLE_TURNING(0)
20 N..... SET_SPINDLE_MODE(0 0.0000)
21 N..... PROGRAM_END()
22 N..... ON_RESET()

View File

@@ -0,0 +1,3 @@
o<foo> sub
o<foo> ebdsub
m2

View File

@@ -0,0 +1,80 @@
# This is a component of LinuxCNC
# Copyright 2011, 2012, 2013 Michael Haberler <git@mah.priv.at>,
# Sebastian Kuzminsky <seb@highlab.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
import interpreter
EMC_DEBUG_CONFIG = 0x00000002
EMC_DEBUG_VERSIONS = 0x00000008
EMC_DEBUG_TASK_ISSUE = 0x00000010
EMC_DEBUG_NML = 0x00000040
EMC_DEBUG_MOTION_TIME = 0x00000080
EMC_DEBUG_INTERP = 0x00000100
EMC_DEBUG_RCS = 0x00000200
EMC_DEBUG_INTERP_LIST = 0x00000800
EMC_DEBUG_IOCONTROL = 0x00001000
EMC_DEBUG_OWORD = 0x00002000
EMC_DEBUG_REMAP = 0x00004000
EMC_DEBUG_PYTHON = 0x00008000
EMC_DEBUG_NAMEDPARAM = 0x00010000
EMC_DEBUG_GDBONSIGNAL = 0x00020000
def introspect(self,*args):
print("debug: ", self.debugmask,"logging:",self.loggingLevel)
print("call_level=",self.call_level)
print("argc=", len(args))
print("args=(", end=' ')
for arg in args:
if type(arg) == float:
print("%0.5f" % arg, end=' ')
else:
print(arg, end=' ')
print(")")
# the low-level access within the block
for n in range(len(args)):
print("param #",n ,"=", self.blocks[0].params[n])
# this is a low-level interface.
for x in self.sub_context[1].named_params:
print("name:",x.key(),"value=",x.data().value, "attr=",x.data().attr)
#for r in self.remaps:
# print r.key(), str(r.data())
print("current oword subname=", self.blocks[0].o_name)
print("m_modes[0]=", self.blocks[0].m_modes[0])
print("g_modes[0]=", self.blocks[0].g_modes[0])
# this is the high level named & numbered parameter interface
print("current tool=",self.params[5400],self.params["_current_tool"])
print("feed=",self.params['_feed'])
print("speed=",self.params['_rpm'])
print("global parameter set in test.ngc:",self.params['_a_global_set_in_test_dot_ngc'])
print("parameter set via test.ini:",self.params['_ini[example]variable'])
assert self.params['_ini[example]variable'] == args[3]
self.params["a_new_local"] = 321.0
self.params["_a_new_global"] = 456.0
print("locals: ",self.params.locals())
print("globals: ",self.params.globals())
print("params(): ",self.params())
return 2.71828

View File

@@ -0,0 +1,18 @@
# This is a component of LinuxCNC
# Copyright 2011 Michael Haberler <git@mah.priv.at>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
import oword

View File

@@ -0,0 +1,15 @@
[EMC]
DEBUG=0
[RS274NGC]
SUBROUTINE_PATH = .
LOG_LEVEL=0
INI_VARS = 1
REMAP= M123 ngc=foo modalgroup=5 argspec=Pq
[PYTHON]
PATH_PREPEND=.
TOPLEVEL=subs.py
[EXAMPLE]
VARIABLE = 3.14159

View File

@@ -0,0 +1,11 @@
#<_a_global_set_in_test_dot_ngc> = 47.11
(debug, before introspect: call_level= #<_call_level>)
#<foo> = 423432.2
T3M6
F200
S3000 M3
o<introspect> call [1.0] [2.0] [3.0] [#<_ini[example]variable>]
(debug, after introspect: return value=#<_value> call_level= #<_call_level>)
M2

3
tests/remap/introspect/test.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
export PYTHONUNBUFFERED=1
exec rs274 -i test.ini -n 0 -g test.ngc 2>&1

View File

@@ -0,0 +1,2 @@
M30 and M02 reset the interpreter's `remap_level`. This test checks
for interaction of remapped commands with those M codes.

View File

@@ -0,0 +1,17 @@
executing
N..... USE_LENGTH_UNITS(CANON_UNITS_MM)
N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
N..... SET_G92_OFFSET(0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
N..... SET_XY_ROTATION(0.0000)
N..... SET_FEED_REFERENCE(CANON_XYZ)
N..... ON_RESET()
N..... MESSAGE("m400 call_level=1.000000 remap_level=1.000000 line=2.000000")
N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
N..... SET_XY_ROTATION(0.0000)
N..... SET_FEED_MODE(0, 0)
N..... SET_FEED_RATE(0.0000)
N..... STOP_SPINDLE_TURNING(0)
N..... SET_SPINDLE_MODE(0 0.0000)
N..... PALLET_SHUTTLE()
N..... PROGRAM_END()
N..... ON_RESET()

View File

@@ -0,0 +1,5 @@
o<rm400> sub
(debug,m400 call_level=#<_call_level> remap_level=#<_remap_level> line=#<_line>)
o<rm400> endsub
m2
%

View File

@@ -0,0 +1,8 @@
[EMC]
DEBUG=0
LOG_LEVEL=0
[RS274NGC]
SUBROUTINE_PATH = .
REMAP=M400 modalgroup=10 ngc=rm400

View File

@@ -0,0 +1 @@
M400 M30

View File

@@ -0,0 +1,3 @@
#!/bin/bash
rs274 -i test.ini -g test.ngc 2>&1 | sed 's/^ *[0-9]* //'
exit "${PIPESTATUS[0]}"

View File

@@ -0,0 +1,8 @@
Exercise nested remaps - three levels deep
each invocation bumps both call and remap level
at end of invocation both most be 0
also verify correct propagation and restore of sequence numbers

View File

@@ -0,0 +1,18 @@
executing
N..... USE_LENGTH_UNITS(CANON_UNITS_MM)
N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
N..... SET_G92_OFFSET(0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
N..... SET_XY_ROTATION(0.0000)
N..... SET_FEED_REFERENCE(CANON_XYZ)
N..... ON_RESET()
N..... MESSAGE("main call_level=0.000000 remap_level=0.000000 line=2.000000")
N..... MESSAGE("m400 handler pre call_level=1.000000 remap_level=1.000000 line=2.000000")
N..... MESSAGE("m401 handler pre call_level=2.000000 remap_level=2.000000 line=2.000000")
N..... MESSAGE("m402 handler pre call_level=3.000000 remap_level=3.000000 line=2.000000")
N..... MESSAGE("m403 handler pre call_level=4.000000 remap_level=4.000000 line=2.000000")
N..... MESSAGE("m402 handler post call_level=3.000000 remap_level=3.000000 line=4.000000")
N..... MESSAGE("m401 handler post call_level=2.000000 remap_level=2.000000 line=4.000000")
N..... MESSAGE("m400 handler post call_level=1.000000 remap_level=1.000000 line=4.000000")
N..... MESSAGE("main call_level=0.000000 remap_level=0.000000 line=4.000000")
N..... FINISH()
N..... ON_RESET()

View File

@@ -0,0 +1,7 @@
o<rm400> sub
(debug,m400 handler pre call_level=#<_call_level> remap_level=#<_remap_level> line=#<_line>)
m401
(debug,m400 handler post call_level=#<_call_level> remap_level=#<_remap_level> line=#<_line>)
o<rm400> endsub
m2
%

View File

@@ -0,0 +1,7 @@
o<rm401> sub
(debug,m401 handler pre call_level=#<_call_level> remap_level=#<_remap_level> line=#<_line>)
m402
(debug,m401 handler post call_level=#<_call_level> remap_level=#<_remap_level> line=#<_line>)
o<rm401> endsub
m2
%

View File

@@ -0,0 +1,7 @@
o<rm402> sub
(debug,m402 handler pre call_level=#<_call_level> remap_level=#<_remap_level> line=#<_line>)
m403
(debug,m402 handler post call_level=#<_call_level> remap_level=#<_remap_level> line=#<_line>)
o<rm402> endsub
m2
%

View File

@@ -0,0 +1,6 @@
o<rm403> sub
(debug,m403 handler pre call_level=#<_call_level> remap_level=#<_remap_level> line=#<_line>)
o<rm403> endsub
(debug,m403 handler post call_level=#<_call_level> remap_level=#<_remap_level> line=#<_line>)
m2
%

View File

@@ -0,0 +1,11 @@
[EMC]
DEBUG=0
LOG_LEVEL=0
[RS274NGC]
SUBROUTINE_PATH = .
REMAP=M400 modalgroup=10 ngc=rm400
REMAP=M401 modalgroup=10 ngc=rm401
REMAP=M402 modalgroup=10 ngc=rm402
REMAP=M403 modalgroup=10 ngc=rm403

View File

@@ -0,0 +1,5 @@
%
(debug,main call_level=#<_call_level> remap_level=#<_remap_level> line=#<_line>)
m400
(debug,main call_level=#<_call_level> remap_level=#<_remap_level> line=#<_line>)
%

View File

@@ -0,0 +1,3 @@
#!/bin/bash
rs274 -i test.ini -g test.ngc 2>&1 | sed 's/^ *[0-9]* //'
exit "${PIPESTATUS[0]}"

View File

@@ -0,0 +1,6 @@
o<rm400> sub
(debug, call_level=#<_call_level> remap_level=#<_remap_level>)
m401
o<rm400> endsub
m2
%

View File

@@ -0,0 +1,5 @@
Exercise a Python oword subroutine, including parameter passing and return values
not a remap, but it comes with the remapping code so test it here.
must properly return to top level

View File

@@ -0,0 +1,26 @@
executing
1 N..... USE_LENGTH_UNITS(CANON_UNITS_MM)
2 N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
3 N..... SET_G92_OFFSET(0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
4 N..... SET_XY_ROTATION(0.0000)
5 N..... SET_FEED_REFERENCE(CANON_XYZ)
6 N..... ON_RESET()
multiply: number of arguments= 2
multiply: number of arguments= 3
7 N..... USE_LENGTH_UNITS(CANON_UNITS_INCHES)
8 N..... SELECT_TOOL(1)
9 N..... STOP_SPINDLE_TURNING(0)
10 N..... CHANGE_TOOL()
11 N..... USE_TOOL_LENGTH_OFFSET(10.0000 0.0000 20.0000, 0.0000 0.0000 0.0000, 0.0000 0.0000 0.0000)
12 N..... USE_TOOL_LENGTH_OFFSET(0.0000 0.0000 0.0000, 0.0000 0.0000 0.0000, 0.0000 0.0000 0.0000)
13 N..... SET_TOOL_TABLE_ENTRY(1, 1, 20.0000 30.0000 40.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000, 0.0000, 0.0000, 0)
14 N..... SET_TOOL_TABLE_ENTRY(0, 1, 20.0000 30.0000 40.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000, 0.0000, 0.0000, 0)
15 N..... USE_TOOL_LENGTH_OFFSET(20.0000 30.0000 40.0000, 0.0000 0.0000 0.0000, 0.0000 0.0000 0.0000)
16 N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
17 N..... SET_XY_ROTATION(0.0000)
18 N..... SET_FEED_MODE(0, 0)
19 N..... SET_FEED_RATE(0.0000)
20 N..... STOP_SPINDLE_TURNING(0)
21 N..... SET_SPINDLE_MODE(0 0.0000)
22 N..... PROGRAM_END()
23 N..... ON_RESET()

View File

@@ -0,0 +1,40 @@
# This is a component of LinuxCNC
# Copyright 2011 Michael Haberler <git@mah.priv.at>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Demo Python O-word subroutine - call as:
# o<square> [5]
# (debug, #<_value>)
#
# this function expects exactly one parameter from NGC and will throw an exception otherwise
# which aint particularly bright
def square(self,x):
return x*x
# a function taking a variable number of arguments
# o<multiply> [5] [7]
# (debug, #<_value>)
# o<multiply> [5] [7] [9] [16]
# (debug, #<_value>)
import operator
from functools import reduce
# you'd be better of doing it this way:
def multiply(self, *args):
print("multiply: number of arguments= {}".format(len(args)))
return reduce(operator.mul, args)

View File

@@ -0,0 +1,18 @@
# This is a component of LinuxCNC
# Copyright 2011 Michael Haberler <git@mah.priv.at>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
import oword

View File

@@ -0,0 +1,13 @@
[EMC]
DEBUG=0
LOG_LEVEL=0
[RS274NGC]
SUBROUTINE_PATH = .
[PYTHON]
PATH_PREPEND=.
TOPLEVEL=subs.py

View File

@@ -0,0 +1,51 @@
; introspection acrobatics
;py,from interpreter import *
;py,assert this.call_level == 0
o<square> call [25.0]
;py,assert this.call_level == 0
;py,assert this.params["_value"] == 625.0
;py,assert this.return_value == 625.0
o<multiply> call [5] [6]
;py,assert this.call_level == 0
;py,assert this.return_value == 30.0
;py,assert this.params["_value"] == 30.0
o<multiply> call [5] [6] [7]
;py,assert this.call_level == 0
;py,assert this.return_value == 210.0
;py,assert this.params["_value"] == 210.0
G20
; t1 p1 x10 y0 z20
T1M6
G43
;py,assert equal(this.params[5400],1.0),"loaded tool number not 1: %f" % (this.params[5400])
;py,assert equal(this.params[5410],10.0) # diameter from tt
;py,assert this.params[5400] == this.tool_table[0].toolno
;py,assert equal(this.tool_offset.x, 10.0)
;py,assert equal(this.tool_offset.y, 0.0)
;py,assert equal(this.tool_offset.z, 20.0)
;py,assert equal(this.tool_offset.x, this.tool_table[0].offset.x)
;py,assert equal(this.tool_offset.y, this.tool_table[0].offset.y)
;py,assert equal(this.tool_offset.z, this.tool_table[0].offset.z)
;py,assert equal(this.tool_offset.x, this.params[5401])
;py,assert equal(this.tool_offset.y, this.params[5402])
;py,assert equal(this.tool_offset.z, this.params[5403])
G49
G10 L1 P1 R10 X20 Y30 Z40
G43
;py,assert equal(this.tool_offset.x, 20.0)
;py,assert equal(this.tool_offset.y, 30.0)
;py,assert equal(this.tool_offset.z, 40.0)
M2

View File

@@ -0,0 +1,3 @@
#!/bin/bash
export PYTHONUNBUFFERED=1
exec rs274 -t test.tbl -i test.ini -n 0 -g test.ngc 2>&1

View File

@@ -0,0 +1 @@
T1 P1 D10 X10 Y0 Z20 ;

View File

@@ -0,0 +1,3 @@
Exercise passing positional parameters to an NGC remap procedure
Verify ordering and argument count

View File

@@ -0,0 +1,18 @@
N..... USE_LENGTH_UNITS(CANON_UNITS_MM)
N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
N..... SET_G92_OFFSET(0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
N..... SET_XY_ROTATION(0.0000)
N..... SET_FEED_REFERENCE(CANON_XYZ)
N..... ON_RESET()
N..... MESSAGE(" in rg881: n_args=3.000000 [1.000000] [2.000000] [3.000000] [0.000000] [0.000000]")
N..... MESSAGE(" in rg881: n_args=4.000000 [1.000000] [2.000000] [3.000000] [4.000000] [0.000000]")
N..... MESSAGE(" in rg881: n_args=4.000000 [1.000000] [2.000000] [3.000000] [5.000000] [0.000000]")
N..... MESSAGE(" in rg881: n_args=5.000000 [1.000000] [2.000000] [3.000000] [4.000000] [5.000000]")
N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
N..... SET_XY_ROTATION(0.0000)
N..... SET_FEED_MODE(0, 0)
N..... SET_FEED_RATE(0.0000)
N..... STOP_SPINDLE_TURNING(0)
N..... SET_SPINDLE_MODE(0 0.0000)
N..... PROGRAM_END()
N..... ON_RESET()

View File

@@ -0,0 +1,5 @@
o<rg881> sub
(debug, in rg881: n_args=#<n_args> [#1] [#2] [#3] [#4] [#5])
o<rg881> endsub
m2
%

View File

@@ -0,0 +1,9 @@
[EMC]
DEBUG=0
LOG_LEVEL=0
[RS274NGC]
SUBROUTINE_PATH = .
OWORD_NARGS = 1
REMAP=G88.1 modalgroup=1 argspec=@XYZpq ngc=rg881

View File

@@ -0,0 +1,7 @@
G88.1 X1 Y2 Z3
; NB: with positional argument calling it is impossible to tell which
; one of several optional parameters was passed!
G88.1 X1 Y2 Z3 P4
G88.1 X1 Y2 Z3 Q5
G88.1 X1 Y2 Z3 P4 Q5
M2

3
tests/remap/posargs.0/test.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
rs274 -i test.ini -n 0 -g test.ngc| awk '{$1=""; print}'
exit "${PIPESTATUS[0]}"

Some files were not shown because too many files have changed in this diff Show More