Compare commits

...

2 Commits

Author SHA1 Message Date
cnc
decc008609 参考所有分组,完成尽量多的内容
结论:聚合守护锁住LinuxCNC loadusr源依据,要求switchkins/remap生成器按do_loadusr_cmd getopt(+wWin:)和补全表跳过等待名后再记录实际程序。
2026-06-04 05:48:54 +08:00
cnc
3c2df90872 按提示词完善loadusr解析
结论:对齐LinuxCNC halcmd loadusr getopt(+wWin:)和补全表,生成器能正确跳过-Wn/-n等待名并提取实际用户态程序。
2026-06-04 05:37:51 +08:00
3 changed files with 74 additions and 13 deletions

View File

@@ -124,6 +124,13 @@ Efficiency rules:
entries as source coverage only. Resolvable tool tables referenced by
M428/M429/M430 INI files must be present as `tooldata` manifest entries and
must not become new generated API aliases or browser cases.
- LinuxCNC `halcmd loadusr` parsing must stay source-tied to
`src/hal/utils/halcmd_commands.cc` `do_loadusr_cmd()` and its
`getopt("+wWin:")` option model. Generator/checker code that extracts
user-space component programs from INI/HAL `loadusr` lines must also preserve
the common `-W/-Wn/-w/-iw` forms listed by
`src/hal/utils/halcmd_completion.c`, and must skip wait component names such
as `-Wn NAME` or `-n NAME` before recording the actual program source.
- The kinematics manifest lister must preserve every allowed manifest group
used by switchkins and RTCP coverage, including `asset`, `tooldata`, and
`generated`, and must reject unknown filters or output modes for those groups.

View File

@@ -71,6 +71,9 @@ fi
linuxcnc_root=$(cd "$linuxcnc_root" && pwd)
# LinuxCNC source basis: src/hal/utils/halcmd_commands.cc do_loadusr_cmd()
# parses loadusr options with getopt("+wWin:"), and
# src/hal/utils/halcmd_completion.c lists the common -W/-Wn/-w/-iw forms.
read_ini_switchkins_config() {
local file=$1
awk '
@@ -79,6 +82,31 @@ read_ini_switchkins_config() {
sub(/[[:space:]]*$/, "", value)
return value
}
function loadusr_program(value, fields, field_count, i, token) {
sub(/^.*(^|[[:space:]])loadusr[[:space:]]+/, "", value)
field_count = split(value, fields, /[[:space:]]+/)
for (i = 1; i <= field_count; i++) {
token = fields[i]
if (token == "-W" || token == "-w" || token == "-i") {
continue
}
if (token == "-Wn" || token == "-n") {
i++
continue
}
if (token ~ /^-Wn.+/ || token ~ /^-n.+/) {
continue
}
if (token ~ /^-[wWi]+$/) {
continue
}
if (token ~ /^-/) {
continue
}
return token
}
return ""
}
{
line = $0
sub(/[[:space:]]*[#;].*$/, "", line)
@@ -108,12 +136,7 @@ read_ini_switchkins_config() {
} else if (section == "hal" && key == "halcmd") {
lower = tolower(value)
if (lower ~ /(^|[[:space:]])loadusr([[:space:]]|$)/) {
command = value
sub(/^.*(^|[[:space:]])loadusr[[:space:]]+/, "", command)
while (command ~ /^-[^[:space:]]+[[:space:]]+/) {
sub(/^-[^[:space:]]+[[:space:]]+/, "", command)
}
sub(/[[:space:]].*$/, "", command)
command = loadusr_program(value)
if (command != "") {
print "halcmd_loadusr\t" command
}
@@ -167,6 +190,31 @@ read_loadusr_commands() {
sub(/[[:space:]]*$/, "", value)
return value
}
function loadusr_program(value, fields, field_count, i, token) {
sub(/^.*(^|[[:space:]])loadusr[[:space:]]+/, "", value)
field_count = split(value, fields, /[[:space:]]+/)
for (i = 1; i <= field_count; i++) {
token = fields[i]
if (token == "-W" || token == "-w" || token == "-i") {
continue
}
if (token == "-Wn" || token == "-n") {
i++
continue
}
if (token ~ /^-Wn.+/ || token ~ /^-n.+/) {
continue
}
if (token ~ /^-[wWi]+$/) {
continue
}
if (token ~ /^-/) {
continue
}
return token
}
return ""
}
{
line = $0
sub(/[[:space:]]*#.*/, "", line)
@@ -175,13 +223,9 @@ read_loadusr_commands() {
if (lower !~ /(^|[[:space:]])loadusr([[:space:]]|$)/) {
next
}
sub(/^.*(^|[[:space:]])loadusr[[:space:]]+/, "", line)
while (line ~ /^-[^[:space:]]+[[:space:]]+/) {
sub(/^-[^[:space:]]+[[:space:]]+/, "", line)
}
sub(/[[:space:]].*$/, "", line)
if (line != "") {
print line
command = loadusr_program(line)
if (command != "") {
print command
}
}
' "$file"

View File

@@ -149,6 +149,12 @@ grep -F 'missing LinuxCNC switchkins remap source in manifest:' check-linuxcnc-s
grep -F 'LinuxCNC source basis: cached switchkins/remap validation hashes the LinuxCNC' check-linuxcnc-switchkins-remap-table-cached.sh >/dev/null
grep -F 'LinuxCNC source basis: generated switchkins/remap tables are extracted from' generate-linuxcnc-switchkins-remap-table.sh >/dev/null
grep -F 'LINUXCNC_ROOT="$linuxcnc_root" ./check-linuxcnc-inputs-cached.sh "$manifest"' generate-linuxcnc-switchkins-remap-table.sh >/dev/null
grep -F 'src/hal/utils/halcmd_commands.cc do_loadusr_cmd()' generate-linuxcnc-switchkins-remap-table.sh >/dev/null
grep -F 'getopt("+wWin:")' generate-linuxcnc-switchkins-remap-table.sh >/dev/null
grep -F 'src/hal/utils/halcmd_completion.c lists the common -W/-Wn/-w/-iw forms' generate-linuxcnc-switchkins-remap-table.sh >/dev/null
grep -F 'function loadusr_program(value, fields, field_count, i, token)' generate-linuxcnc-switchkins-remap-table.sh >/dev/null
grep -F 'if (token == "-Wn" || token == "-n")' generate-linuxcnc-switchkins-remap-table.sh >/dev/null
grep -F 'i++' generate-linuxcnc-switchkins-remap-table.sh >/dev/null
grep -F 'LinuxCNC source basis: Puma560 DH parameter output is generated from' generate-linuxcnc-puma560-dh-parameters.sh >/dev/null
test -x generate-linuxcnc-puma560-dh-parameters.sh
grep -F 'usage: $0 [linuxcnc-root-relative-puma560-dh-hal]' generate-linuxcnc-puma560-dh-parameters.sh >/dev/null
@@ -190,6 +196,10 @@ grep -F 'the cached wrapper script, checker script, generator script' docs/linux
grep -F 'generated table/case outputs, and the thin API/web bridge files that pass' docs/linuxcnc-source-policy.md >/dev/null
grep -F 'switchkins config aliases.' docs/linuxcnc-source-policy.md >/dev/null
grep -F 'The switchkins/remap generator must treat LinuxCNC `[EMCIO] TOOL_TABLE`' docs/linuxcnc-source-policy.md >/dev/null
grep -F 'LinuxCNC `halcmd loadusr` parsing must stay source-tied to' docs/linuxcnc-source-policy.md >/dev/null
grep -F '`src/hal/utils/halcmd_commands.cc` `do_loadusr_cmd()`' docs/linuxcnc-source-policy.md >/dev/null
grep -F '`getopt("+wWin:")` option model' docs/linuxcnc-source-policy.md >/dev/null
grep -F '`src/hal/utils/halcmd_completion.c`' docs/linuxcnc-source-policy.md >/dev/null
grep -F 'must not become new generated API aliases or browser cases.' docs/linuxcnc-source-policy.md >/dev/null
grep -F 'The kinematics manifest lister must preserve every allowed manifest group' docs/linuxcnc-source-policy.md >/dev/null
grep -F 'including `asset`, `tooldata`, and' docs/linuxcnc-source-policy.md >/dev/null