按建议,继续完成后续工作
结论:将解释器外部长度单位读取接入共享 emcStatus 状态边界,并补充 inch/mm 初始化验证。
This commit is contained in:
@@ -52,11 +52,11 @@ The validation fails if:
|
||||
| --- | --- |
|
||||
| `linuxcnc_ini_probe` | Validates vendored LinuxCNC INI parsing can be used standalone. |
|
||||
| `linuxcnc_interp_state_probe` | Validates interpreter state constants and structs compile under the standalone boundary. |
|
||||
| `linuxcnc_emc_status_probe` | Validates the standalone `emcStatus` machine-units status boundary used by vendored interpreter conversion code. |
|
||||
| `linuxcnc_emc_status_probe` | Validates the standalone `emcStatus` machine-units status boundary used by vendored interpreter conversion and initialization code. |
|
||||
| `linuxcnc_namedparam_harness` | Validates LinuxCNC named parameter behavior, `_ini[...]`, and `_hal[...]` adapter resolution. |
|
||||
| `linuxcnc_interp_minimal_harness` | Runs G-code fixtures through vendored LinuxCNC parser/execution/conversion code and captures canonical events. |
|
||||
| `linuxcnc_parameter_file_harness` | Validates LinuxCNC parameter file restore/save behavior and required/read-only parameter handling. |
|
||||
| `linuxcnc_interp_init_harness` | Validates vendored LinuxCNC `Interp::init()` emits canonical initialization boundaries through the standalone event sink. |
|
||||
| `linuxcnc_interp_init_harness` | Validates vendored LinuxCNC `Interp::init()` emits canonical initialization boundaries and reads metric/inch machine units through the standalone event/status boundary. |
|
||||
| `linuxcnc_indexer_harness` | Validates vendored LinuxCNC single-axis rotary indexer dispatch emits lock/unlock and motion boundaries through the standalone event sink. |
|
||||
| `linuxcnc_tp_api_probe` | Validates vendored LinuxCNC trajectory planner calls for linear, arc, and queued motion paths. |
|
||||
| `linuxcnc_kinematics_probe` | Validates vendored LinuxCNC `trivkins.c` plus `kins_util.c` initialize and perform identity forward/inverse mapping through the standalone HAL/RTAPI boundary. |
|
||||
|
||||
@@ -33,7 +33,7 @@ semantic rewrites:
|
||||
| Interpreter reset | LinuxCNC `ON_RESET` is captured as a canonical test event on the vendored interpreter reset/file-open path. |
|
||||
| Interpreter init | LinuxCNC `INIT_CANON` and the canonical initialization sequence from vendored `Interp::init()` are captured as test events. |
|
||||
| Comment logging | LinuxCNC `LOGOPEN`, `LOG`, `LOGAPPEND`, and `LOGCLOSE` callbacks are captured as canonical test events instead of writing host log files. |
|
||||
| EMC status machine units | A narrow standalone `emcStatus` shim exposes the machine-units field used by vendored interpreter conversion code; `linuxcnc_emc_status_probe` guards the inch/mm boundary. |
|
||||
| EMC status machine units | A narrow standalone `emcStatus` shim exposes the machine-units field used by vendored interpreter conversion and initialization code; `linuxcnc_emc_status_probe` and `linuxcnc_interp_init_harness` guard the inch/mm boundary. |
|
||||
| Python/remap | Python/remap hooks are stubbed at the runtime edge. |
|
||||
| Dynamic interpreter path | `interp_base.cc` probe uses standalone `EMC2_HOME` compile-time path boundary. |
|
||||
| Realtime scheduler | TP probes seed deterministic status/config data instead of running LinuxCNC realtime process topology. |
|
||||
|
||||
@@ -33,7 +33,7 @@ Current validation is intentionally mechanical:
|
||||
| --- | --- | --- | --- | --- |
|
||||
| INI parsing | `src/emc/ini/inifile.cc`, `inifile.h`, `inifile.hh` | Copy unchanged | Native file IO remains LinuxCNC-style in the vendored parser; browser OPFS integration remains outside this layer | Vendor byte sync, `linuxcnc_ini_probe`, `linuxcnc_inifile_source_probe` |
|
||||
| RTAPI compatibility headers | `src/rtapi/rtapi_*.h` in the manifest | Copy unchanged plus standalone shim include path | `runtime/core/shims/rtapi.h` supplies the minimal standalone RTAPI surface needed by vendored code | Vendor byte sync, compile coverage through dependent source probes |
|
||||
| Canon/NML-facing interpreter types | `src/emc/nml_intf/canon*.hh`, `emctool.h`, `interp_return.hh`, `motion_types.h`, `emcpose.*`, `emcpos.h`, `debugflags.h`, `src/emc/linuxcnc.h` | Copy unchanged plus narrow standalone status shim | NML transport is not ported; `runtime/core/shims/nml_intf/emc.hh` exposes only the `emcStatus` machine-units status edge currently needed by vendored interpreter conversion code | Vendor byte sync, dependent source probes, `linuxcnc_emc_status_probe`, `linuxcnc_tp_api_probe`, interpreter harnesses |
|
||||
| Canon/NML-facing interpreter types | `src/emc/nml_intf/canon*.hh`, `emctool.h`, `interp_return.hh`, `motion_types.h`, `emcpose.*`, `emcpos.h`, `debugflags.h`, `src/emc/linuxcnc.h` | Copy unchanged plus narrow standalone status shim | NML transport is not ported; `runtime/core/shims/nml_intf/emc.hh` exposes only the `emcStatus` machine-units status edge currently needed by vendored interpreter conversion and initialization code | Vendor byte sync, dependent source probes, `linuxcnc_emc_status_probe`, `linuxcnc_tp_api_probe`, interpreter harnesses |
|
||||
| Motion state headers | `src/emc/motion/state_tag.h`, `emcmotcfg.h`, `simple_tp.h`, `motion.h`, `mot_priv.h`, `axis.h` | Copy unchanged | Realtime motion process is not ported; standalone probes seed the small motion status/config state required by TP calls | Vendor byte sync, `linuxcnc_tp_api_probe` |
|
||||
| Identity/trivial kinematics | `src/emc/kinematics/kinematics.h`, `cubic.h`, `kins_util.c`, `trivkins.c` | Copy unchanged | HAL component lifecycle and RTAPI module metadata are replaced by standalone shims; forward/inverse mapping behavior remains LinuxCNC source | Vendor byte sync, per-file source probes, `linuxcnc_kinematics_probe` |
|
||||
| Switchable 5-axis bridge kinematics | `src/emc/kinematics/5axiskins.c`, `switchkins.c`, `switchkins.h`, `userkfuncs.c`, plus `src/rtapi/rtapi_ctype.h` | Copy unchanged | HAL pin allocation, HAL component lifecycle, and RTAPI module metadata are standalone runtime edges; switchable 5-axis forward/inverse behavior remains LinuxCNC source | Vendor byte sync, per-file source probes, `linuxcnc_5axis_kinematics_probe` |
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
static EMC_STAT standalone_emc_status;
|
||||
EMC_STAT *emcStatus = &standalone_emc_status;
|
||||
|
||||
int main()
|
||||
{
|
||||
const bool default_units_visible = emcStatus->motion.traj.linearUnits == 1.0;
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
#include "nml_intf/emc.hh"
|
||||
|
||||
static EMC_STAT standalone_emc_status;
|
||||
EMC_STAT *emcStatus = &standalone_emc_status;
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "canon_event_sink.hh"
|
||||
#include "nml_intf/emc.hh"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -29,6 +30,7 @@ int main()
|
||||
const auto temp_dir = make_temp_dir();
|
||||
std::filesystem::current_path(temp_dir);
|
||||
|
||||
emcStatus->motion.traj.linearUnits = 1.0;
|
||||
Interp interp;
|
||||
standalone::reset_canon_events();
|
||||
|
||||
@@ -44,6 +46,21 @@ int main()
|
||||
std::cout << "canon_event=" << event << "\n";
|
||||
}
|
||||
|
||||
emcStatus->motion.traj.linearUnits = 1.0 / 25.4;
|
||||
Interp inch_interp;
|
||||
standalone::reset_canon_events();
|
||||
const int inch_rc = inch_interp.init();
|
||||
std::cout << "inch_init=" << inch_rc << "\n";
|
||||
std::cout << "inch_setup.length_units="
|
||||
<< static_cast<int>(inch_interp._setup.length_units) << "\n";
|
||||
std::cout << "inch_external_length_units="
|
||||
<< GET_EXTERNAL_LENGTH_UNITS() << "\n";
|
||||
std::cout << "inch_canon_event_count=" << standalone::canon_events().size() << "\n";
|
||||
for (const auto &event : standalone::canon_events()) {
|
||||
std::cout << "inch_canon_event=" << event << "\n";
|
||||
}
|
||||
|
||||
emcStatus->motion.traj.linearUnits = 1.0;
|
||||
std::filesystem::remove_all(temp_dir);
|
||||
return rc == INTERP_OK ? 0 : 1;
|
||||
return (rc == INTERP_OK && inch_rc == INTERP_OK) ? 0 : 1;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "emc/rs274ngc/rs274ngc_return.hh"
|
||||
#include "canon_event_sink.hh"
|
||||
#include "linuxcnc_tool_adapter.hh"
|
||||
#include "nml_intf/emc.hh"
|
||||
|
||||
namespace standalone {
|
||||
|
||||
@@ -448,8 +449,11 @@ void CANON_ERROR(const char *fmt, ...)
|
||||
|
||||
double GET_EXTERNAL_FEED_RATE() { return 0.0; }
|
||||
int GET_EXTERNAL_FLOOD() { return 0; }
|
||||
CANON_UNITS GET_EXTERNAL_LENGTH_UNIT_TYPE() { return CANON_UNITS_MM; }
|
||||
double GET_EXTERNAL_LENGTH_UNITS() { return 1.0; }
|
||||
CANON_UNITS GET_EXTERNAL_LENGTH_UNIT_TYPE()
|
||||
{
|
||||
return (emcStatus->motion.traj.linearUnits > 0.5) ? CANON_UNITS_MM : CANON_UNITS_INCHES;
|
||||
}
|
||||
double GET_EXTERNAL_LENGTH_UNITS() { return emcStatus->motion.traj.linearUnits; }
|
||||
double GET_EXTERNAL_ANGLE_UNITS() { return 1.0; }
|
||||
int GET_EXTERNAL_MIST() { return 0; }
|
||||
CANON_MOTION_MODE GET_EXTERNAL_MOTION_CONTROL_MODE() { return CANON_EXACT_STOP; }
|
||||
|
||||
@@ -265,6 +265,10 @@ grep -Fq "canon_event=SET_G5X_OFFSET index=1" "$INIT_HARNESS_STDOUT"
|
||||
grep -Fq "canon_event=SET_G92_OFFSET x=0 y=0 z=0" "$INIT_HARNESS_STDOUT"
|
||||
grep -Fq "canon_event=SET_XY_ROTATION rotation=0" "$INIT_HARNESS_STDOUT"
|
||||
grep -Fq "canon_event=SET_FEED_REFERENCE reference=2" "$INIT_HARNESS_STDOUT"
|
||||
grep -Fq "inch_init=0" "$INIT_HARNESS_STDOUT"
|
||||
grep -Fq "inch_setup.length_units=1" "$INIT_HARNESS_STDOUT"
|
||||
grep -Fq "inch_external_length_units=0.0393701" "$INIT_HARNESS_STDOUT"
|
||||
grep -Fq "inch_canon_event=USE_LENGTH_UNITS units=1" "$INIT_HARNESS_STDOUT"
|
||||
|
||||
INDEXER_HARNESS_STDOUT="$BUILD_DIR/linuxcnc_indexer_harness.run.stdout.log"
|
||||
grep -Fq "execute=0" "$INDEXER_HARNESS_STDOUT"
|
||||
|
||||
@@ -343,6 +343,7 @@ STATE_PROBE_SOURCES=(
|
||||
)
|
||||
|
||||
EMC_STATUS_PROBE_SOURCES=(
|
||||
"$WRAP_DIR/linuxcnc_emc_status_runtime.cpp"
|
||||
"$WRAP_DIR/linuxcnc_emc_status_probe.cpp"
|
||||
)
|
||||
|
||||
@@ -611,6 +612,7 @@ INTERP_CORE_SOURCES=(
|
||||
"$VENDOR_DIR/src/emc/rs274ngc/interp_o_word.cc"
|
||||
"$VENDOR_DIR/src/emc/rs274ngc/rs274ngc_pre.cc"
|
||||
"$WRAP_DIR/linuxcnc_hal_adapter.cpp"
|
||||
"$WRAP_DIR/linuxcnc_emc_status_runtime.cpp"
|
||||
"$WRAP_DIR/linuxcnc_interp_edge_stubs.cpp"
|
||||
"$WRAP_DIR/linuxcnc_runtime_state_stubs.cpp"
|
||||
"$WRAP_DIR/linuxcnc_tool_adapter.cpp"
|
||||
|
||||
Reference in New Issue
Block a user