Menu

#89 Sources not set correctly in famrep*.ll

Code_Cleanup
closed-fixed
nobody
None
5
2004-07-21
2002-09-14
Peter Fales
No

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 */
}
}

Discussion

  • Steve Dum

    Steve Dum - 2004-07-21
    • status: open --> open-fixed
     
  • Steve Dum

    Steve Dum - 2004-07-21
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.