This file is indexed.

/usr/share/elmerpost/tcl/math.tcl is in elmer-common 6.1.0.svn.5396.dfsg2-4ubuntu1.

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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
proc math_CommandReturn {w l t} {
    global math_str math_file

    if { $math_str == "" } return

    if { $l != "" } {
        $l insert end $math_str
        history add "math \{ $math_str \}"

        set n [$l size]

        set k [@ $n-5]
        if { $k < 0 } { set k 0}
        $l yview $k

        $l select clear 0 end
        $l select set end end

        if { $t != "" } {
            $t insert end [math $math_str]
            $t insert end ">\n"

            set n [split [$t index end] .]
            set row [lindex $n 0]

            set h [$t cget -height]
            set row [@ $row-$h]

            $t yview $row
        }
    } else {
        uplevel 1 "math $math_str\n"
    }

    $w delete 0 end
}

proc math_CommandUpKey {w l} {
   if { $l != "" } {
       set n [$l curselection]
       if { $n == "" } {
           $l select clear 0 end
           $l select set end end
           set n [$l curselection]
       }

       set n [@ $n-1]
       if { $n < 0 } { set n 0 }

        $l select clear 0 end
        $l select set $n $n

        set k [@ $n-5]
        if { $k < 0 } { set k 0 }
        $l yview $k
   }

   $w delete 0 end
   if { $l != "" } { $w insert 0 [$l get $n] }
}

proc math_CommandDownKey {w l} {
   if { $l != "" } {
       set n [$l curselection]
       if { $n == "" } {
           $l select clear 0 end
           $l select set end end
           $l yview  end
           set n [$l curselection]
       }
       set n [@ $n+1]
       if { $n >= [$l size] } { set $n [@ [$l size]-1] }

       $l select clear 0 end
       $l select set $n $n

       set k [@ $n-5]
       if { $k < 0 } { set k 0 }
       $l yview $k
   }

   $w delete 0 end
   if { $l != "" } { $w insert 0 [$l get $n] }
}

proc math_CommandLeftKey {w} {
   set t [$w index insert]
   set t [@ $t-1]

   if { $t < 0 } { set t 0 }

   $w icursor $t
}

proc math_CommandRightKey {w} {
   set t [$w index insert]
   set t [@ $t+1]

   if {$t >= [$w index end]} {set t [$w index end]}

   $w icursor $t
}

proc math_CommandToEnd {w} { $w icursor end }

proc math_CommandToBegin {w} { $w icursor 0 }

proc math_CommandDelete {w} { $w delete [$w index insert] }

proc math_CommandDeleteEnd {w} { $w delete [$w index insert] end }

proc math_TextUpKey {w} {
   set t [split [$w index insert] .]

   set row [lindex $t 0]
   set col [lindex $t 1]

   set row [@ $row-1]

   $w yview -pickplace $row
   $w mark set insert $row.$col
}

proc math_TextDownKey {w} {
   set t [split [$w index insert] .]

   set row [lindex $t 0]
   set col [lindex $t 1]

   set row [@ $row+1]

   $w yview -pickplace $row
   $w mark set insert $row.$col
}

proc math_TextLeftKey {w} {
   set t [split [$w index insert] .]

   set row [lindex $t 0]
   set col [lindex $t 1]

   set col [@ $col-1]
   $w mark set insert $row.$col
}

proc math_TextRightKey {w} {
   set t [split [$w index insert] .]

   set row [lindex $t 0]
   set col [lindex $t 1]

   set col [@ $col+1]
   $w mark set insert $row.$col
}

proc math_TextHomeKey {w} {
    $w yview -pickplace 0
    $w mark set insert 0.0
}

proc math_TextEndKey {w} {
    $w yview -pickplace end
    $w mark set insert end
}

proc math_TextPageDownKey {w} {
    set h [$w cget -height]
    set h [@ $h-1]

    set t [split [$w index insert] .]

    set row [lindex $t 0]
    set col [lindex $t 1]

    set row [@ $row+$h]

    $w yview -pickplace $row
    $w mark set insert $row.$col
}

proc math_TextPageUpKey {w} {
    set h [$w cget -height]
    set h [@ $h-1]

    set t [split [$w index insert] .]

    set row [lindex $t 0]
    set col [lindex $t 1]

    set row [@ $row-$h]

    $w yview -pickplace $row
    $w mark set insert $row.$col
}

proc math_TextToBegin {w} {
   set t [split [$w index insert] .]

   set row [lindex $t 0]
   set col 0

   $w mark set insert $row.$col
}

proc math_TextToEnd {w} {
   set t [split [$w index insert] .]

   set row [lindex $t 0]
   set col 0
   $w mark set here $row.$col

   set r [@ $row+1]
   $w mark set insert $r.$col

   set str [$w get here insert]

   set col [@ [string length $str]-1]

   $w mark set insert $row.$col
   $w mark unset here
}

proc math_TextDelete {w} { $w delete insert }

proc math_Nil {} {}

proc math { {str ""} args } {
   if { $str == "" } { return [math_win] }

   return [c_MathCommand "$str $args"]
}

proc math_win {} {
    global math_str math_cmd math_log math_out math_file

    if { [winfo exists .math] } {
        wm iconify .math
        wm deiconify .math
        return
    }

    toplevel .math
    place_window .math

    frame .math.lbox -bd 5 -bg lightblue
    frame .math.tbox -bd 5 -bg lightblue
    frame .math.cbox
    label .math.cbox.lab -text "math: "
    entry .math.cbox.cmd -relief sunken -textvariable math_str

    text .math.tbox.text -yscroll ".math.tbox.scroll set" -wrap none
    scrollbar .math.tbox.scroll -orient vertical -command ".math.tbox.text yview"
    pack .math.tbox.scroll -side left -fill y
    pack .math.tbox.text -side left -fill both -expand 1 

    listbox .math.lbox.list -yscroll ".math.lbox.scroll set"
    scrollbar .math.lbox.scroll -orient vertical -command ".math.lbox.list yview"
    pack .math.lbox.scroll -side left -fill y
    pack .math.lbox.list -side left -fill both -expand 1 

    set math_out .math.tbox.text
    set math_log .math.lbox.list
    set math_cmd .math.cbox.cmd

    bind $math_log <Button-1> {
        $math_cmd delete 0 end
        set cur [$math_log curselection]
        if { $cur != "" } {
            $math_cmd insert 0 [$math_log get $cur]
        }
    }

    bind $math_log <Double-Button-1> {
        $math_cmd delete 0 end

        set cur [$math_log curselection]
        if { $cur != "" } {
            $math_cmd insert 0 [$math_log get $cur]
            math_CommandReturn $math_cmd $math_log $math_out
        }
    }

    bind $math_cmd <Return>    {math_CommandReturn %W $math_log $math_out}

    bind $math_cmd <Up>        {math_CommandUpKey %W $math_log}
    bind $math_cmd <Down>      {math_CommandDownKey %W $math_log}

    bind $math_cmd <Control-p> {math_CommandUpKey %W $math_log}
    bind $math_cmd <Control-n> {math_CommandDownKey %W $math_log}

    bind Text <Escape> {Nil}
    bind Text <Escape>v     {math_TextPageUpKey %W}
    bind Text <Control-v>   {math_TextPageDownKey %W}

    pack .math.lbox -side top -fill both -expand 1
    pack .math.tbox -fill both -expand 1

    pack .math.cbox.lab -side left
    pack .math.cbox.cmd -side right -expand 1 -fill both
    pack .math.cbox -fill x -side bottom

    $math_out configure -setgrid 1 -width 40 -height 10
    $math_log configure -setgrid 1 -width 40 -height 10 
    $math_cmd configure -width 40

    $math_out insert end "\n\nMATC COMMAND WINDOW\n"
    $math_out insert end "\n"

    set math_str ""

    focus $math_cmd
}