(phixonline)-->
constant template = { { { 1, 2 }, { 3, 4, 1, }, 5 } },
template2 = { { { 1, 2 }, { 10, 4, 1 }, 5 } },
payload = {"Payload#0", "Payload#1", "Payload#2", "Payload#3", "Payload#4", "Payload#5", "Payload#6"}
sequence unused = repeat(true,length(payload)),
missing = {}
function fill(object t, sequence p)
if integer(t) then
if t>=length(p) then
if not find(t,missing) then missing &= t end if
return sprintf("*** index error (%d>%d) ***",{t,length(p)-1})
end if
unused[t+1] = false
return p[t+1]
end if
for i=1 to length(t) do
t[i] = fill(t[i],p)
end for
return t
end function
ppOpt({pp_Nest,2})
pp(fill(template,payload))
pp(fill(template2,payload))
sequence idx = {}
for i=1 to length(unused) do
if unused[i] then idx &= i-1 end if
end for
printf(1,"\nThe unused payloads have indices of :%s\n", {sprint(idx)})
if length(missing) then
printf(1,"Missing payloads: %s\n", {sprint(missing)})
end if