继续按 align-linuxcnc 约束:补表达式运算源码回归
This commit is contained in:
@@ -34,7 +34,7 @@ This parser only exists to test the ABI and UI before Emscripten and LinuxCNC ar
|
|||||||
- spindle modes `G96`, `G97`
|
- spindle modes `G96`, `G97`
|
||||||
- IJK and R arcs
|
- IJK and R arcs
|
||||||
- numbered and named parameter assignment/reference such as `#1 = ...`, `#<name> = ...`, `X#1`, and nested expressions like `X[[#<name> + 2] * 3]`
|
- numbered and named parameter assignment/reference such as `#1 = ...`, `#<name> = ...`, `X#1`, and nested expressions like `X[[#<name> + 2] * 3]`
|
||||||
- expression functions `ABS[]`, `SQRT[]`, `EXP[]`, `LN[]`, degree-based `SIN[]`/`COS[]`/`TAN[]`/`ASIN[]`/`ACOS[]`, LinuxCNC-style `ATAN[]/[]`, and `FIX[]`/`FUP[]`/`ROUND[]`
|
- expression functions `ABS[]`, `SQRT[]`, `EXP[]`, `LN[]`, degree-based `SIN[]`/`COS[]`/`TAN[]`/`ASIN[]`/`ACOS[]`, LinuxCNC-style `ATAN[]/[]`, `FIX[]`/`FUP[]`/`ROUND[]`, and source-linked `mod`/`**`/logical/relational operator precedence
|
||||||
- numeric and named O-word subprograms such as `O100 call` and `O<name> call`
|
- numeric and named O-word subprograms such as `O100 call` and `O<name> call`
|
||||||
- canned cycles `G73`, `G74`, `G81`, `G82`, `G83`, `G84`, `G85`, `G86`, `G87`, `G88`, `G89` with `G80`, `G98`, `G99`, `L`
|
- canned cycles `G73`, `G74`, `G81`, `G82`, `G83`, `G84`, `G85`, `G86`, `G87`, `G88`, `G89` with `G80`, `G98`, `G99`, `L`
|
||||||
- coordinate offset events for `G10 L2`, `G10 L20`, `G54`-`G59.3`, `G52`, `G92`, `G92.1`, `G92.2`, and `G92.3`
|
- coordinate offset events for `G10 L2`, `G10 L20`, `G54`-`G59.3`, `G52`, `G92`, `G92.1`, `G92.2`, and `G92.3`
|
||||||
@@ -212,5 +212,6 @@ This matrix tracks LinuxCNC feature coverage for the web/WASM simulator. A featu
|
|||||||
| Cutter compensation | covered for tool-table `G41/G42 D...` and explicit-radius `G41.1/G42.1/G40` through LinuxCNC native/source backends | `tests/gcode/linuxcnc_cutter_comp.ngc` |
|
| Cutter compensation | covered for tool-table `G41/G42 D...` and explicit-radius `G41.1/G42.1/G40` through LinuxCNC native/source backends | `tests/gcode/linuxcnc_cutter_comp.ngc` |
|
||||||
| Probe moves `G38.2/G38.3/G38.4/G38.5` | covered as distinct probe events with LinuxCNC `probe_type` preserved through smoke, native, and source-linked paths | `tests/gcode/linuxcnc_probe_no_error.ngc` |
|
| Probe moves `G38.2/G38.3/G38.4/G38.5` | covered as distinct probe events with LinuxCNC `probe_type` preserved through smoke, native, and source-linked paths | `tests/gcode/linuxcnc_probe_no_error.ngc` |
|
||||||
| O-word subroutines, calls, and control flow | covered for numeric and named `O... sub/call/return/endsub` plus `if`/`elseif`/`else`, `while`, `repeat`, `do`/`while`, `break`, and `continue` through LinuxCNC file mode; smoke parser also covers named `O<name>` sub/call/return/endsub and loop-control forms | `tests/gcode/smoke_oword_subprogram.ngc`, `tests/gcode/linuxcnc_named_oword_subprogram.ngc`, `tests/gcode/linuxcnc_oword_control_flow.ngc` |
|
| O-word subroutines, calls, and control flow | covered for numeric and named `O... sub/call/return/endsub` plus `if`/`elseif`/`else`, `while`, `repeat`, `do`/`while`, `break`, and `continue` through LinuxCNC file mode; smoke parser also covers named `O<name>` sub/call/return/endsub and loop-control forms | `tests/gcode/smoke_oword_subprogram.ngc`, `tests/gcode/linuxcnc_named_oword_subprogram.ngc`, `tests/gcode/linuxcnc_oword_control_flow.ngc` |
|
||||||
|
| Parameter expressions and operators | covered for parameter references and source-linked `mod`, `**`, logical, and relational operator precedence from LinuxCNC `interp_read.cc`/`interp_execute.cc` | `tests/gcode/linuxcnc_parameter_expression_assignment.ngc`, `tests/gcode/linuxcnc_expression_operators.ngc` |
|
||||||
| Broader canned cycles `G73`, `G74`, `G82`-`G89` | partially covered: `G73`, `G74`, `G82`, `G83`, `G84`, `G85`, `G86`, `G87`, `G88`, `G89`; smoke parser maps supported cycles across `G17/G18/G19`, including LinuxCNC's special non-XY `G74/G84` tapping argument order and `G87` plane-specific `I/J/K` mapping; native/source regressions now check non-XY `G74/G84/G86/G87/G88` sequences | `tests/gcode/linuxcnc_canned_cycles_extended.ngc`, `tests/gcode/linuxcnc_canned_cycle_planes.ngc`, smoke API regression |
|
| Broader canned cycles `G73`, `G74`, `G82`-`G89` | partially covered: `G73`, `G74`, `G82`, `G83`, `G84`, `G85`, `G86`, `G87`, `G88`, `G89`; smoke parser maps supported cycles across `G17/G18/G19`, including LinuxCNC's special non-XY `G74/G84` tapping argument order and `G87` plane-specific `I/J/K` mapping; native/source regressions now check non-XY `G74/G84/G86/G87/G88` sequences | `tests/gcode/linuxcnc_canned_cycles_extended.ngc`, `tests/gcode/linuxcnc_canned_cycle_planes.ngc`, smoke API regression |
|
||||||
| Full source-level wasm build | covered for the current wasm-safe RS274 source set, with remaining work focused on broadening browser-hostile dependency replacement and feature coverage | `./build-wasm.sh`, `test-linuxcnc-wasm-runtime-link.sh`, `test-web-wasm-node-smoke.sh`, `test-web-wasm-browser-smoke.sh` |
|
| Full source-level wasm build | covered for the current wasm-safe RS274 source set, with remaining work focused on broadening browser-hostile dependency replacement and feature coverage | `./build-wasm.sh`, `test-linuxcnc-wasm-runtime-link.sh`, `test-web-wasm-node-smoke.sh`, `test-web-wasm-browser-smoke.sh` |
|
||||||
|
|||||||
@@ -586,6 +586,12 @@ CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
|
|||||||
CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
|
CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
|
||||||
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_parameter_expression_assignment.ngc \
|
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_parameter_expression_assignment.ngc \
|
||||||
>"$output_dir/cnc_sim_linuxcnc_source_parameter_expression_assignment.json"
|
>"$output_dir/cnc_sim_linuxcnc_source_parameter_expression_assignment.json"
|
||||||
|
# Source basis: LinuxCNC src/emc/rs274ngc/interp_read.cc read_operation()
|
||||||
|
# parses mod, power, logical, and relational operators; interp_execute.cc
|
||||||
|
# execute_binary1()/execute_binary2() evaluate their precedence and values.
|
||||||
|
CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
|
||||||
|
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_expression_operators.ngc \
|
||||||
|
>"$output_dir/cnc_sim_linuxcnc_source_expression_operators.json"
|
||||||
CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
|
CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
|
||||||
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_word_bracket_whitespace.ngc \
|
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_word_bracket_whitespace.ngc \
|
||||||
>"$output_dir/cnc_sim_linuxcnc_source_word_bracket_whitespace.json"
|
>"$output_dir/cnc_sim_linuxcnc_source_word_bracket_whitespace.json"
|
||||||
@@ -2021,6 +2027,27 @@ if not any(
|
|||||||
):
|
):
|
||||||
raise SystemExit("missing source-linked whitespace-insensitive word value motion")
|
raise SystemExit("missing source-linked whitespace-insensitive word value motion")
|
||||||
|
|
||||||
|
expression_operators = json.loads((OUTPUT_DIR / "cnc_sim_linuxcnc_source_expression_operators.json").read_text())
|
||||||
|
if not any(
|
||||||
|
event["type"] == "rapid" and
|
||||||
|
event["line"] == 6 and
|
||||||
|
event["end"]["x"] == 3 and
|
||||||
|
event["end"]["y"] == 16 and
|
||||||
|
event["end"]["z"] == 1 and
|
||||||
|
event["end"]["a"] == 1
|
||||||
|
for event in expression_operators
|
||||||
|
):
|
||||||
|
raise SystemExit("missing source-linked expression mod/power/logical/relational motion")
|
||||||
|
if not any(
|
||||||
|
event["type"] == "rapid" and
|
||||||
|
event["line"] == 10 and
|
||||||
|
event["end"]["b"] == 19 and
|
||||||
|
event["end"]["c"] == 2 and
|
||||||
|
event["end"]["u"] == 1
|
||||||
|
for event in expression_operators
|
||||||
|
):
|
||||||
|
raise SystemExit("missing source-linked expression precedence and relational branch motion")
|
||||||
|
|
||||||
word_bracket_whitespace = json.loads((OUTPUT_DIR / "cnc_sim_linuxcnc_source_word_bracket_whitespace.json").read_text())
|
word_bracket_whitespace = json.loads((OUTPUT_DIR / "cnc_sim_linuxcnc_source_word_bracket_whitespace.json").read_text())
|
||||||
if not any(
|
if not any(
|
||||||
event["type"] == "linear-feed" and
|
event["type"] == "linear-feed" and
|
||||||
|
|||||||
11
tests/gcode/linuxcnc_expression_operators.ngc
Normal file
11
tests/gcode/linuxcnc_expression_operators.ngc
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
G21 G90
|
||||||
|
#1 = [-7 mod 5]
|
||||||
|
#2 = [2 ** 3 * 2]
|
||||||
|
#3 = [[1 and 0] or [0 xor 2]]
|
||||||
|
#4 = [[1 lt 2] and [2 ge 2] and [3 ne 4] and [4 eq 4]]
|
||||||
|
G0 X#1 Y#2 Z#3 A#4
|
||||||
|
#5 = [7 + 3 * 2 ** 2]
|
||||||
|
#6 = [[5 mod 2] + [-5 mod 2]]
|
||||||
|
#7 = [[2 gt 3] or [3 le 3]]
|
||||||
|
G0 B#5 C#6 U#7
|
||||||
|
M2
|
||||||
Reference in New Issue
Block a user