接续上一轮:推进浏览器验证与M428配置收拢

结论:已完成浏览器侧真实加载验证,M428/M429/M430 的配置入口进一步从 LinuxCNC INI/HALFILE/REMAP 来源生成,native 与 source-link 验证通过。
This commit is contained in:
cnc
2026-05-30 10:03:21 +08:00
parent b40914747d
commit de273bf830
141 changed files with 11255 additions and 1259 deletions

View File

@@ -1,5 +1,8 @@
#include "pythonplugin/python_plugin.hh"
#include <cstdio>
#include <cstdlib>
__attribute__((weak)) std::string handle_pyerror() {
return "python disabled in wasm-safe probe";
}
@@ -13,7 +16,30 @@ PythonPlugin *PythonPlugin::instantiate(struct _inittab *) {
return python_plugin;
}
int PythonPlugin::configure(const char *, const char *) {
int PythonPlugin::configure(const char *iniFilename, const char *section) {
if (!section) {
error_msg = "no section";
status = PLUGIN_NO_SECTION;
return status;
}
if (!iniFilename) {
iniFilename = std::getenv("INI_FILE_NAME");
if (!iniFilename) {
error_msg = "no inifile";
status = PLUGIN_NO_INIFILE;
return status;
}
}
FILE *file = std::fopen(iniFilename, "r");
if (!file) {
error_msg = "bad inifile";
status = PLUGIN_BAD_INIFILE;
return status;
}
std::fclose(file);
status = PLUGIN_OK;
return status;
}
@@ -23,12 +49,17 @@ bool PythonPlugin::is_callable(const char *, const char *) {
}
int PythonPlugin::call(const char *,
const char *,
const char *callable,
boost::python::object,
boost::python::object,
boost::python::object &retval) {
if (!callable) {
return PLUGIN_NO_CALLABLE;
}
retval = boost::python::object();
status = PLUGIN_NO_CALLABLE;
exception_msg = handle_pyerror();
status = PLUGIN_EXCEPTION;
return status;
}

View File

@@ -8,10 +8,34 @@ int main() {
if (!plugin->usable()) {
return 2;
}
if (plugin->configure(nullptr, nullptr) != PLUGIN_NO_SECTION) {
return 6;
}
if (plugin->configure("/tmp/cnc_sim_missing_python_plugin_probe.ini", "PYTHON") != PLUGIN_BAD_INIFILE) {
return 7;
}
boost::python::object retval;
if (plugin->run_string("noop", retval, false) != PLUGIN_OK) {
return 3;
}
if (plugin->call(nullptr, nullptr, boost::python::object(), boost::python::object(), retval) != PLUGIN_NO_CALLABLE) {
return 8;
}
if (plugin->plugin_status() != PLUGIN_OK) {
return 9;
}
if (plugin->call(nullptr, "noop", boost::python::object(), boost::python::object(), retval) != PLUGIN_EXCEPTION) {
return 10;
}
if (plugin->plugin_status() != PLUGIN_EXCEPTION) {
return 11;
}
if (plugin->last_exception().empty()) {
return 12;
}
if (plugin->run_string("noop", retval, false) != PLUGIN_OK) {
return 13;
}
if (plugin->is_callable(nullptr, "noop")) {
return 4;
}
@@ -20,4 +44,3 @@ int main() {
}
return 0;
}