This file is indexed.

/usr/share/axiom-20170501/src/algebra/DISPLAY.spad is in axiom-source 20170501-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
)abbrev package DISPLAY DisplayPackage
++ Author: Robert S. Sutor
++ Date Created: September 1986
++ Description: 
++ DisplayPackage allows one to print strings in a nice manner,
++ including highlighting substrings.

DisplayPackage(): SIG == CODE where

  I       ==> Integer
  L       ==> List
  S       ==> String
  RECLR   ==> Record(lhs : S, rhs : S)

  SIG ==> with

    bright : S -> L S
      ++ bright(s) sets the font property of the string s to bold-face type.

    bright : L S -> L S
      ++ bright(l) sets the font property of a list of strings, l, to
      ++ bold-face type.

    newLine : () -> S
      ++ newLine() sends a new line command to output.

    copies : (I,S) -> S
      ++ copies(i,s) will take a string s and create a new string composed of
      ++ i copies of s.

    center : (S,I,S) -> S
      ++ center(s,i,s) takes the first string s, and centers it within a string
      ++ of length i, in which the other elements of the string are composed
      ++ of as many replications as possible of the second indicated string, s
      ++ which must have a length greater than that of an empty string.

    center : (L S,I,S) -> L S
      ++ center(l,i,s) takes a list of strings l, and centers them within a
      ++ list of strings which is i characters long, in which the remaining
      ++ spaces are filled with strings composed of as many repetitions as
      ++ possible of the last string parameter s.

    say : S -> Void
      ++ say(s) sends a string s to output.

    say : L S -> Void
      ++ say(l) sends a list of strings l to output.

    sayLength : S -> I
      ++ sayLength(s) returns the length of a string s as an integer.

    sayLength : L S -> I
      ++ sayLength(l) returns the length of a list of strings l as an integer.

  CODE ==> add

    center0:  (I,I,S) -> RECLR

    s : S
    l : L S

    HION    : S := " "
    HIOFF   : S := " "
    NEWLINE : S := "%l"

    bright s == [HION,s,HIOFF]$(L S)
    bright l == cons(HION,append(l,list HIOFF))
    newLine() == NEWLINE

    copies(n : I, s : S) ==
      n < 1 => ""
      n = 1 => s
      t : S := copies(n quo 2, s)
      odd? n => concat [s,t,t]
      concat [t,t]

    center0(len : I, wid : I, fill : S) : RECLR ==
      (wid < 1) or (len >= wid) => ["",""]$RECLR
      m : I := (wid - len) quo 2
      t : S := copies(1 + (m quo (sayLength fill)),fill)
      [t(1..m),t(1..wid-len-m)]$RECLR

    center(s, wid, fill) ==
      wid < 1 => ""
      len : I := sayLength s
      len = wid => s
      len > wid => s(1..wid)
      rec : RECLR := center0(len,wid,fill)
      concat [rec.lhs,s,rec.rhs]

    center(l, wid, fill) ==
      wid < 1 => [""]$(L S)
      len : I := sayLength l
      len = wid => l
      rec : RECLR := center0(len,wid,fill)
      cons(rec.lhs,append(l,list rec.rhs))

    say s ==
      sayBrightly$Lisp s
      void()$Void

    say l ==
      sayBrightly$Lisp l
      void()$Void

    sayLength s == #s

    sayLength l ==
      sum : I := 0
      for s in l repeat
        s = HION      => sum := sum + 1
        s = HIOFF     => sum := sum + 1
        s = NEWLINE   => sum
        sum := sum + sayLength s
      sum