Annotation of 43BSD/contrib/icon/src/cmd/tablc.icn, revision 1.1

1.1     ! root        1: #      TABLC(1)
        !             2: #
        !             3: #      Tabulate characters
        !             4: #
        !             5: #      Ralph E. Griswold
        !             6: #
        !             7: #      Last modified 8/11/84
        !             8: #
        !             9: 
        !            10: procedure main(x)
        !            11:    local ccount, unique, order, i, s, a, pair, rwidth
        !            12:    unique := 0                         # switch to list unique usage only
        !            13:    order := 1                          # alphabetical ordering switch
        !            14:    i := 0
        !            15:    while i < *x do {
        !            16:       s := x[i +:= 1] | break
        !            17:       case s of {
        !            18:          "-a":  order := 1
        !            19:          "-n":  order := 2
        !            20:          "-u":  unique := 1
        !            21:          default:  Usage()
        !            22:          }
        !            23:       }
        !            24:    ccount := table(0)                  # table of characters
        !            25:    while ccount[reads()] +:= 1
        !            26:    a := sort(ccount,order)
        !            27:    if unique = 1 then {
        !            28:       every pair := !a do
        !            29:          if pair[2] = 1 then write(pair[1])
        !            30:       }
        !            31:    else {
        !            32:       rwidth := 0
        !            33:       every rwidth<:= *((!a)[2])
        !            34:       every pair := !a do
        !            35:          write(left(image(pair[1]),10),right(pair[2],rwidth))
        !            36:       }
        !            37: end
        !            38: 
        !            39: procedure Usage()
        !            40:    stop("usage:  tablc [-a -n -u]")
        !            41: end

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.