Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
interpeter: allow comments that print params, to set the float format
printting out number to users often uses excessive decimals. now &d,%f or %.xf (x being a number) is interpeted to be a float format for params. -add test for printing formatted params -add docs on formatting of parameter numbers in comments
- Loading branch information
Showing
5 changed files
with
120 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
tests/interp/magic_comments/param_format_printing/expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
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(" native value = 1.123457") | ||
N..... MESSAGE(" Test round to integer: 1") | ||
N..... MESSAGE(" Test round to 4 decimals: 1.1235") | ||
N..... MESSAGE(" Test format separate from param: The value is: 1.1235") | ||
N..... MESSAGE(" Test round to 7 decimals: 1.1234568") | ||
N..... MESSAGE(" native value2 = 2.345679") | ||
N..... MESSAGE(" Test2 round all params in line to 4 decimals: The values are: 1.1235, 2.3457") | ||
N..... MESSAGE(" Test2 only round last value to integer: The values are: 1.123457, 2") | ||
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() | ||
N..... ON_RESET() |
13 changes: 13 additions & 0 deletions
13
tests/interp/magic_comments/param_format_printing/test.ngc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#<value> = 1.123456789 | ||
|
||
(DEBUG, native value = #<value>) | ||
(DEBUG, Test round to integer: %d#<value>) | ||
(DEBUG, Test round to 4 decimals: %f#<value>) | ||
(DEBUG, Test format separate from param: %f The value is: #<value>) | ||
(DEBUG, Test round to 7 decimals: %.7f#<value>) | ||
|
||
#<value2> = 2.3456789 | ||
(DEBUG, native value2 = #<value2>) | ||
(DEBUG, Test2 round all params in line to 4 decimals: %f The values are: #<value>, #<value2>) | ||
(DEBUG, Test2 only round last value to integer: The values are: #<value>, %d#<value2>) | ||
M2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
rs274 -g test.ngc | awk '{$1=""; print}' | ||
exit ${PIPESTATUS[0]} |