- status: open --> open-fixed
famrep1.11, famrep3.ll, and famrep6.ll all contain
logic like:
proc sourcenum()
{
set(found,0)
forlist(sourcelist, item, i) {
if (eq(strcmp(item, sourcestr), 0)) { /* if
source in list */
" \\s7(" d(i) ")\\s8" /*
print out source index */
set(found, 1)
}
}
if (not(eq(found, 1))) {
push(sourcelist, sourcestr) /*
otherwise add it to list */
" \\s7(" d(add(i,1)) ")\\s8" /* and
print source index */
}
}
This assumes that at the completion of
"forlist(sourcelist, item, i)" i will be set to
the number of sources so that d(add(i,1)) will
display the next source number in sequence. In fact,
i has the value zero, so that the new source always
prints as "1". (Perhaps earlier versions of the
report generator worked differently.) The fix is
simply to save the source number inside the loop, i.e.:
proc sourcenum()
{
set(found,0)
forlist(sourcelist, item, i) {
set(numsources,i)
if (eq(strcmp(item, sourcestr), 0)) { /* if
source in list */
" \\s7(" d(i) ")\\s8" /*
print out source index */
set(found, 1)
}
}
if (not(eq(found, 1))) {
push(sourcelist, sourcestr) /*
otherwise add it to list */
" \\s7(" d(add(numsources,1)) ")\\s8" /* and
print source index */
}
}