# /* vim: set filetype=awk : */ -*- awk -*-# /* vim: set filetype=awk : */ -*- awk -*- # #---- [sims.awk] ------------------------------------------ function sims(spec,n,slots,startHere, \ last,hdrString,tmp,max,out,i,hdr,sep) { #saya("slots",slots); if(! framep(startHere,slots)) return bad(startHere " unknown"); out = sims1(startHere); for(i in Cache) { hdr[++max] = i; last = split(i,tmp,SUBSEP); hdrString = hdrString sep headerWord(spec,tmp[last]) ; sep = OFS; } if (Loud) print MetaC hdrString,headerWord(spec,"risk"), headerWord(spec,"effort"),headerWord(spec,"defects") do { for(i=1;i<=max;i++) printf Cache[hdr[i]] OFS; print out; if (n) out=sims1(startHere); if (! (n % Pause)) bad(n); } while (--n > 0) } function sims1(start) { array(Cache); return sprintf("%.2f%s%.2f%s%.2f", Total_risk(start) , OFS, Effort(start) , OFS, Total_defects(start) / Ksloc(start) ) } function headerWord(spec,word) { return word in spec ? spec[word] : word }