/* Example ufh script... Rework trace distances to be integer multiples of 10 */ func Begin() { /* We could set some initial values for counters & variable here */ } func OnLineHeader() { /* output line header unchanged in this case */ LH.GrpInt = " 10"; /* set group interval in line header to 10 */ LH.HLH[size(LH.HLH)] = SourceText; /* put this script into historical LH */ output(LH); } /* here is the guts of what we want to do to each trace header */ func OnTrace() { xd = Tr.DstSgn; /* get signed trace distance */ xda = abs(xd); /* find absolute value */ /* check to see we don't divide by 0 */ if(xd != 0.0){ sgn= 1.001*xd/xda; /* make sure sgn rounds back to +-1 */ idx = 10 * int(xda/10. + 0.50); /* integer multiple of 10 */ idx = int(sgn) * int(idx); /* put sign back in */ } else{ idx = 0.; } Tr.DstUsg = int(idx); /* store back in unsigned trc dist slot */ output(Tr); /* output trace */ } /* the binned trace distance could just as well have been stored in the signed trace distance slot, DstSgn, but this way the tru distances are preserved for future processing that will need them, e.g. tau-p presort can be told to sort on the unsigned distance word by putting a -hw4117 on the command line. The whole thing can even be piped: ufh script.ufh < rawdata | presort -Oraw.sort -hw4 where script.ufh is the name of the above ufh script */