HIST - the B histogram package.

Description:

The B histogram package gives the B programmer a convenient method of displaying data on the frequency of occurrence of certain events. Six functions may be called.

histinit
is used to initialize a histogram.
histogram
is used to add a value to be included in preparing the histogram.
histprint
is used to print the histogram which has thus far been accumulated.
histdestroy
is used to delete a histogram and recover associated space.
histitle
allows the user to supply his own titles to histogram entries.
histheader
allows the user to supply his own histogram header routine.

The histogram package is included as part of the standard B library. The package uses the external ".histc" to define the character for printing the bar graph. The default character is ']'. The user may change this character by changing the value of ".histc".

Examples:

The following is a program to gather a histogram of the line lengths in a file:

main() {
    auto hg,in[64];
    hg = histinit(1);
    while( getstr(in)>0 ) histogram( hg,length(in) );
    histprint( hg,1,"line lengths" );
    histdestroy(hg);
}

See Also:

expl b lib histinit

expl b lib histogram

expl b lib histprint

expl b lib histdestroy

expl b lib histitle

expl b lib histheader

Copyright © 1996, Thinkage Ltd.