# BINSTRM -- Bin statistics from a file or input stream procedure t_binstrm () pointer input # Input real xmin, xmax # Data range for x int xbins # Number of x bins real ymin, ymax # Data range for y int ybins # Number of y bins int hflag # Print header int tflag # Print total int aflag # Print average int cflag # Print count int sflag # Print standard deviation int rflag # Print range int m pointer sp bool clgetb() int clgeti(), btoi() real clgetr() begin call smark (sp) call salloc (input, SZ_FNAME, TY_CHAR) call clgstr ("input", Memc[input], SZ_FNAME) xmin = clgetr ("xmin") xmax = clgetr ("xmax") xbins = clgeti ("xbins") ymin = clgetr ("ymin") ymax = clgetr ("ymax") ybins = clgeti ("ybins") hflag = btoi (clgetb ("header")) tflag = btoi (clgetb ("total")) aflag = btoi (clgetb ("average")) cflag = btoi (clgetb ("count")) sflag = btoi (clgetb ("stddev")) rflag = btoi (clgetb ("range")) if (xbins == 0) { m = 0 xbins = 1 ybins = 1 } else if (ybins == 0) { m = 1 ybins = 1 } else m = 2 call strpak (Memc[input], Memc[input], SZ_FNAME) call binstrm (Memc[input], hflag, aflag, cflag, tflag, sflag, rflag, m, xmin, xmax, xbins, ymin, ymax, ybins) call sfree (sp) end