This file is indexed.

/usr/share/tkgate/scripts/find.tcl is in tkgate-data 2.0~b10-4.

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
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
#   Copyright (C) 1987-2004 by Jeffery P. Hansen
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# Last edit by hansen on Fri Jan  9 09:16:28 2009
#

namespace eval Find {
  variable lb_w		""
  variable what
  variable target	""
  variable reqListEv
  variable qualifier	""
  variable data
  variable goto

  #
  # If this is the first time we have done a find, set inital settings.
  #
  proc init {} {
    variable what
    variable qualifier

    if { $qualifier == "" } {
      set qualifier [m find.qual.contains]
      set what(ignorecase) 0
      set what(gates) 1
      set what(nets) 1
      set what(text) 1
    }
  }

  #
  # Get the type code for a search
  #
  proc getType {} {
    set type 0

    if { $Find::what(nets) } { incr type 1 }
    if { $Find::what(gates) } { incr type 2 }
    if { $Find::what(text) } { incr type 4 }
    if { $Find::what(ignorecase) } { incr type 256 }

    return $type
  }

  #
  # Get the qualifier code for a search
  #
  proc getQual {} {
    variable qualifier

    if { $qualifier == [m find.qual.contains] } {
      return 0
    }

    if { $qualifier == [m find.qual.begins] } {
      return 1
    }

    if { $qualifier == [m find.qual.ends] } {
      return 2
    }

    if { $qualifier == [m find.qual.matches] } {
      return 2
    }

    return 0
  }


  #############################################################################
  #
  # Get the list of matching strings and display it in the spreadsheet.
  #
  proc getFindList args {
    variable target
    variable data
    variable lb_w

    set w .finder

    set data(count) 0

    action -Find {
      gat_find list -type [Find::getType] -qualifier [Find::getQual] -target $Find::target -variable Find::data
    }

    set n $data(count)

    SpreadSheet::flush $lb_w
    for { set i 0 } { $i < $n } {incr i } {
      set mod [lindex $data($i) 0]
      set type [m @find.type.[lindex $data($i) 1]]
      set name [lindex $data($i) 2]

      SpreadSheet::insert $lb_w end [list $mod $type $name]
    }
    SpreadSheet::see $lb_w 0
  }

  proc reqFindList {} {
    variable reqListEv

    catch { after cancel $reqListEv }
    set reqListEv [after 500 Find::getFindList]
  }

  proc findNext {} {
    variable lb_w

    set n [SpreadSheet::size $lb_w]
    set idx [SpreadSheet::getselection $lb_w]
    if { $idx == "" } {
      set idx 0
    } else {
      incr idx
    }
    if { $idx >= $n } {
      set idx 0
    }
    if {$n > 0 } {
      SpreadSheet::clearselection $lb_w
      SpreadSheet::setselection $lb_w $idx
      SpreadSheet::see $lb_w $idx

      set Find::goto [SpreadSheet::get $lb_w $idx]

      action Find { 
	gat_find goto $Find::goto
      }
    }
  }

  proc gotoSelected {} {
    variable lb_w

    set idx [SpreadSheet::getselection $lb_w]
#    puts "goto idx=$idx"
    
    if { $idx != "" } {
      set Find::goto [SpreadSheet::get $lb_w $idx]

      action Find { 
	gat_find goto $Find::goto
      }
    }
  }

  proc buildActions {w} {
    frame $w -relief raised -bd 2
    button $w.find -text [m b.find] -command { Find::findNext }
    button $w.clear -text [m b.clear] -command { set Find::target ""; Find::getFindList }
    button $w.close -text [m b.close] -command { destroy .finder  }

    pack $w.close -side right -pady 5 -padx 5 -fill x
    pack $w.clear -side right -pady 5 -padx 5 -fill x
    pack $w.find -side right -pady 5 -padx 5 -fill x
  }

  #
  # Build the search target selector
  #
  proc buildTarget {w} {
    variable qualifier
    variable what

    labelframe $w [m find.target]
    frame $w.pad -height 8
    pack $w.pad

    #
    # Entry for the search string and qualifier selection
    #
    frame $w.str
    label $w.str.l -text [m find.search]
    Dropbox::new $w.str.db -variable Find::qualifier -width 14 -command Find::getFindList
    Dropbox::itemadd $w.str.db [m find.qual.contains] -islist 0
    Dropbox::itemadd $w.str.db [m find.qual.begins] -islist 0
    Dropbox::itemadd $w.str.db [m find.qual.ends] -islist 0
    Dropbox::itemadd $w.str.db [m find.qual.matches] -islist 0

    entry $w.str.e -textvariable Find::target

    pack $w.str.l -side left -padx 5 -pady 5
    if {[m @find.qual.pos] != "after" } {
      pack $w.str.db -side left -padx 5 -pady 5
      pack $w.str.e -side left -padx 5 -pady 5 -fill x -expand 1
    } else {
      pack $w.str.e -side left -padx 5 -pady 5 -fill x -expand 1
      pack $w.str.db -side left -padx 5 -pady 5
    }
    $w.str.e selection range 0 end
    focus $w.str.e
    pack $w.str -fill x -expand 1


    frame $w.ignorecase
    checkbutton $w.ignorecase.b -text [m find.ignorecase] -variable Find::what(ignorecase) -command Find::getFindList
    pack $w.ignorecase.b
    pack $w.ignorecase -pady 2 -padx 3 -anchor w

    #
    #
    #
    frame $w.dom
    label $w.dom.l -text [m find.dom.label]
    pack $w.dom.l -anchor w -padx 5 -pady 5
    frame $w.dom.pad -width 15
    checkbutton $w.dom.gates -text [m find.dom.gates] -variable Find::what(gates) -command Find::getFindList
    checkbutton $w.dom.nets -text [m find.dom.nets] -variable Find::what(nets) -command Find::getFindList
    checkbutton $w.dom.text -text [m find.dom.text] -variable Find::what(text) -command Find::getFindList
    pack $w.dom.pad $w.dom.gates $w.dom.nets $w.dom.text -pady 2 -padx 3 -anchor w -side left
    pack $w.dom -fill x
  }

  proc buildResultsBox {w} {
    variable lb_w

    set lb_w $w.lb

    labelframe $w [m find.results]

    SpreadSheet::create $w.lb -height 10 -bd 2 -relief sunken -yscrollcommand "$w.vb set" \
	-entrycommand Find::manager -selectmode single
    SpreadSheet::addcolumn $w.lb -width 12 -header [m find.result.module]
    SpreadSheet::addcolumn $w.lb -width 10 -header [m find.result.type]
    SpreadSheet::addcolumn $w.lb -width 30 -header [m find.result.name]

    scrollbar $w.vb -orient vertical -command "SpreadSheet::yview $w.lb"
    bind $w.lb <Double-ButtonPress-1> Find::gotoSelected

    grid $w.lb -row 1 -column 1 -sticky nsew -padx 1 -pady 1
    grid $w.vb -row 1 -column 2 -sticky nsew -padx 1 -pady 1

    grid columnconfigure $w 0 -minsize 5
    grid columnconfigure $w 3 -minsize 5
#    grid columnconfigure $w 1 -weight 1

    grid rowconfigure $w 0 -minsize 10
    grid rowconfigure $w 3 -minsize 5
  }

  proc manager {cmd args} {
    # Instead of doing entry when we get a double click, goto that selected item
    switch $cmd {
      doublePress {
	Find::gotoSelected	
	return 0
      }
      canenter {
	return 0
      }
    }
  }

  proc post {} {
    variable target
    global simOn

    if { $simOn } {
      errmsg "'Find' not supported in simulation mode."
      return
    }

    set w .finder

    if { [catch { toplevel $w }] } {
      raise $w
      Find::findNext
      return
    }

    init
 
    wm resizable $w 0 0
    wm title $w [m find.title]
    wm geometry $w [offsetgeometry . 50 50 ]
#    wm transient $w .


    #
    # Action buttons on the bottom
    #
    buildActions $w.ok
    pack $w.ok -fill both -ipadx 5 -ipady 5 -side bottom

    #
    # Build top frame area
    #
    frame $w.top -bd 2 -relief raised
    pack $w.top -fill both

    #
    # Build the dialog image
    #
    dialogImage $w.top.di -image [gifI search.gif] -caption [m find.label] -explaination [m find.exp]
    pack $w.top.di -side left -fill both

    frame $w.top.pad -height 8
    pack $w.top.pad

    buildTarget $w.top.target
    pack $w.top.target  -fill both -padx 5 -pady 5

    #
    # Build the search results box 
    #
    buildResultsBox $w.top.list
    pack $w.top.list -fill both -padx 5 -pady 5

    bind $w <KeyPress> Find::reqFindList
    #  pack $w.l  -fill both -ipadx 5 -ipady 5


    bind $w <KeyPress-Return> { .finder.ok.find invoke }


    getFindList
  }
}