参考所有分组,完成尽量多的内容:结论为 manifest 校验覆盖 LinuxCNC loadusr 等待选项

This commit is contained in:
cnc
2026-06-04 05:16:19 +08:00
parent 708b2bee17
commit 2223e6d601

View File

@@ -899,6 +899,57 @@ if [[ -n "$manifest" && "$require_complete" == "--require-kinematics-complete" ]
fi
}
extract_waited_loadusr_programs() {
# Source basis: LinuxCNC src/hal/utils/halcmd_commands.cc
# do_loadusr_cmd() parses loadusr options with getopt("+wWin:"),
# and its help text plus src/hal/utils/halcmd_completion.c list both
# "-W" and "-Wn" wait forms.
awk '
function emit_waited_program(fields, field_count, start_index, i, token, waiting) {
waiting = 0
for (i = start_index + 1; i <= field_count; i++) {
token = fields[i]
if (token == "-W") {
waiting = 1
continue
}
if (token == "-Wn") {
waiting = 1
i++
continue
}
if (token == "-n") {
i++
continue
}
if (token ~ /^-Wn.+/) {
waiting = 1
continue
}
if (token ~ /^-n.+/) continue
if (token ~ /^-[wWi]+$/) {
if (token ~ /W/) waiting = 1
continue
}
if (token ~ /^-/) continue
if (waiting && token != "") print token
return
}
}
{
line = $0
sub(/[[:space:]]*[#;].*$/, "", line)
field_count = split(line, fields, /[[:space:]]+/)
for (i = 1; i <= field_count; i++) {
if (fields[i] == "loadusr") {
emit_waited_program(fields, field_count, i)
next
}
}
}
' "$1"
}
m428_m430_vismach_loadusr_sources=()
for source in "${manifest_m428_m430_ini_sources[@]}"; do
while IFS= read -r command_name; do
@@ -906,20 +957,7 @@ if [[ -n "$manifest" && "$require_complete" == "--require-kinematics-complete" ]
while IFS= read -r vismach_source; do
[[ -n "$vismach_source" ]] && m428_m430_vismach_loadusr_sources+=("$vismach_source")
done < <(resolve_vismach_loadusr_source "$command_name")
done < <(
awk '
BEGIN { IGNORECASE = 1 }
/^[[:space:]]*HALCMD[[:space:]]*=/ && /loadusr[[:space:]]/ {
for (i = 1; i <= NF; i++) {
if ($i == "-W" && (i + 1) <= NF) {
value = $(i + 1)
sub(/[[:space:]#;].*/, "", value)
if (value != "") print value
}
}
}
' "$linuxcnc_root/$source"
)
done < <(extract_waited_loadusr_programs "$linuxcnc_root/$source")
done
for source in "${m428_m430_config_hal_sources[@]}"; do
while IFS= read -r command_name; do
@@ -927,19 +965,7 @@ if [[ -n "$manifest" && "$require_complete" == "--require-kinematics-complete" ]
while IFS= read -r vismach_source; do
[[ -n "$vismach_source" ]] && m428_m430_vismach_loadusr_sources+=("$vismach_source")
done < <(resolve_vismach_loadusr_source "$command_name")
done < <(
awk '
/^[[:space:]]*loadusr[[:space:]]/ {
for (i = 1; i <= NF; i++) {
if ($i == "-W" && (i + 1) <= NF) {
value = $(i + 1)
sub(/[[:space:]#;].*/, "", value)
if (value != "") print value
}
}
}
' "$linuxcnc_root/$source"
)
done < <(extract_waited_loadusr_programs "$linuxcnc_root/$source")
done
mapfile -t m428_m430_vismach_loadusr_sources < <(
printf '%s\n' "${m428_m430_vismach_loadusr_sources[@]}" | sed '/^$/d' | sort -u