This file is indexed.

/usr/share/tkgate/scripts/popups.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
#   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 Sat Feb 21 16:28:03 2009
#
#
# Popup flag meanings:
#      r		Use label directly without a messages file lookup
#      R		Do not prepend "Action::" to command name
#      I		Prepend a "PopupMenu::inpop " to command.
#

namespace eval PopupMenu {
  #
  #
  #  Tag	Label Name		Action			Image		Sel. Image	Var./Cascade	Flags
  variable menuEntryData {
    {libraries	library.mgr		loadLibrary		file_lib	-		-		- }
    {libname	library.mgr		loadLibrary		file_lib	-		-		- }
    {libname	library.close		unloadSelectedLibrary	file_unlib	-		-		- }

    {wire	wire.prop		popupWireProps		i_wireprops	-		-		- }
    {wire	wire.addseg		popupWireAddStub	emptytool	-		-		- }

    {wirelabel	wire.showlabel		popupWireShowLabel	emptytool	-		-		- }
    {wirelabel	wire.hidealllabel	popupWireHideAllLabel	emptytool	-		-		- }
    {wirelabel	wire.clearalllabel	popupWireClearAllLabel	emptytool	-		-		- }

    {wireunlabel wire.hidelabel		popupWireHideLabel	emptytool	-		-		- }
    {wireunlabel wire.hidealllabel	popupWireHideAllLabel	emptytool	-		-		- }
    {wireunlabel wire.clearalllabel	popupWireClearAllLabel	emptytool	-		-		- }

    {wiresize	wire.showsize		popupWireShowSize	emptytool	-		-		- }

    {wireunsize	wire.hidesize		popupWireHideSize	emptytool	-		-		- }

    {gateport	gate.addport		addPort			addport		-		-		- }

    {gateprop	gate.prop		editProps		i_gateprops	-		-		- }
    {portprop	gate.prop		editProps		i_portprops	-		-		- }

    {gate	gate.anchor		popupAnchor		anchor		unanchor	pop_anchor	- }
    {gate	gate.settech		-cascade		emptytool	-		settech		- }
    {gate	gate.delete		delete			delgate		-		-		- }

    {gatebase	gate.anchor		popupAnchor		anchor		unanchor	pop_anchor	- }
    {gatebase	gate.delete		delete			delgate		-		-		- }

    {joint3	gate.anchor		popupAnchor		anchor		unanchor	pop_anchor	- }
    {joint3	wire.addseg		popupWireAddStub	emptytool	-		-		- }

    {joint4	gate.anchor		popupAnchor		anchor		unanchor	pop_anchor	- }

    {block	gate.open		openMod			blk_open	-		-		- }
    {block	interface		-cascade		editintr	-		int=block.int	- }
    {block	module.prop		blockPropCanvas		i_modprops	-		-		- }
    {block.int	interface.edit		openInterface		-		-		-		- }
    {block.int	interface.set		setBlockDesc		-		-		-		- }
    {block.int	interface.update	updateInterface		-		-		-		- }
    {block.int	interface.updateall	updateAllInterfaces	-		-		-		- }
    {block.int	interface.auto		autoGenerateCanvas	-		-		-		- }

    {blockedge	gate.addin		popupBlockAddIn		emptytool	-		-		- }
    {blockedge	gate.addout		popupBlockAddOut	emptytool	-		-		- }
    {blockedge	gate.addinout		popupBlockAddInOut	emptytool	-		-		- }
      
    {blockport	igen.type		-cascade		emptytool	-		ioset=blockport.type - }
    {blockport	igen.size		-cascade		emptytool	-		iosize=blockport.size - }
    {blockport	igen.delete		popupDeletePort		emptytool	-		-		- }

    {blockport.type	port.in		popupPortMakeIn		emptytool	-		-		- }
    {blockport.type	port.out	popupPortMakeOut	emptytool	-		-		- }
    {blockport.type	port.inout	popupPortMakeInOut	emptytool	-		-		- }

    {blockport.size 1			"popupPortSize 1" 	-		-		-		r }
    {blockport.size 2			"popupPortSize 2" 	-		-		-		r }
    {blockport.size 4			"popupPortSize 4" 	-		-		-		r }
    {blockport.size 8			"popupPortSize 8" 	-		-		-		r }
    {blockport.size 16			"popupPortSize 16"	-		-		-		r }
    {blockport.size 32			"popupPortSize 32"	-		-		-		r }


    {canv	make			-cascade		emptytool	-		make=@make	- }
    {canv	tool			-cascade		emptytool	-		tool=@tool	- }
    {canv	-			-separator		-		-		-		- }
    {canv	gate.close		closeMod		blk_close	-		-		- }

    {notmove	tool			-cascade		-		-		tool=@tool	- }

    {simu	gate.close		closeMod		blk_close	-		-		- }
    {simu	-			-separator		-		-		-		- }
    {simu	simulate.end		endSimulator		sim_stop	-		-		- }
    {simu	-			-separator		-		-		-		- }
    {simu	simulate.run		simRun			sim_go		-		-		- }
    {simu	simulate.pause		simPause		sim_pause	-		-		- }
    {simu	simulate.step		simStep			sim_step	-		-		- }
    {simu	simulate.cycle		simCycle		sim_clock	-		-		- }
    {simu	simulate.break		editBreakpoints		sim_break	-		-		- }
    {simu	simulate.script		doSimScript		sim_script	-		-		- }
    {simu	-			-separator		-		-		-		- }
    {simu	simulate.load		simLoadMem		sim_load	-		-		- }
    {simu	simulate.dump		simDumpMem		sim_dump	-		-		- }
    {simu	simulate.view		simViewMem		sim_view	-		-		- }

    {wiresimu	simulate.addprobe	toggleProbe		net_probe	-		-		I }

    {scopetrace	simulate.delprobe	delScopeProbe		net_probe	-		-		I }

    {close	gate.close		closeMod		blk_close	-		-		- }

    {open	gate.open		openMod			blk_open	-		-		- }

    {modlist	module.new		blockNew		blk_new		-		-		- }
    {modlist	module.del		blockDelete		blk_delete	-		-		- }
    {modlist	module.copy		blockCopy		blk_copy	-		-		- }
    {modlist	module.rename		blockRename		blk_rename	-		-		- }
    {modlist	module.claim		blockClaim		blk_claim	-		-		- }
    {modlist	module.setroot		blockSetRoot		blk_root	-		-		- }
    {modlist	module.prop		blockProp		i_modprops	-		-		- }
    {modlist	interface		-cascade		editintr	-		int=modlist.int	- }

    {modlist.int interface.edit		openInterface		-		-		-		- }
    {modlist.int interface.updateall	updateAllInterfaces	-		-		-		- }
    {modlist.int interface.auto		autoGenerateSelected	-		-		-		- }


    {ipanports	igen.type		-cascade		-		-		type=ipanports.type	- }
    {ipanports	igen.size		-cascade		-		-		size=ipanports.size	- }
    {ipanports	igen.side		-cascade		-		-		side=ipanports.side	- }
    {ipanports	igen.delete		"PortEntry::inpopup delete"	-	-		-		R }

    {ipanports.type igen.in		"PortEntry::inpopup setType in" -	-		-		R }
    {ipanports.type igen.out		"PortEntry::inpopup setType out" -	-		-		R }
    {ipanports.type igen.inout		"PortEntry::inpopup setType inout" -	-		-		R }

    {ipanports.size 1			"PortEntry::inpopup setSize 1" -	-		-		Rr }
    {ipanports.size 2			"PortEntry::inpopup setSize 2" -	-		-		Rr }
    {ipanports.size 4			"PortEntry::inpopup setSize 4" -	-		-		Rr }
    {ipanports.size 8			"PortEntry::inpopup setSize 8" -	-		-		Rr }
    {ipanports.size 16			"PortEntry::inpopup setSize 16" -	-		-		Rr }
    {ipanports.size 32			"PortEntry::inpopup setSize 32" -	-		-		Rr }

    {ipanports.side igen.left		"PortEntry::inpopup setSide left" -	-		-		R }
    {ipanports.side igen.right		"PortEntry::inpopup setSide right" -	-		-		R }
    {ipanports.side igen.top		"PortEntry::inpopup setSide top" -	-		-		R }
    {ipanports.side igen.bottom		"PortEntry::inpopup setSide bottom" -	-		-		R }

    {paste	edit.paste		yankFromBuf		edit_paste	-		-		- }

    {hdledit	gate.close		closeMod		blk_close	-		-		- }
    {hdledit	gate.open		HdlEditor::openModule	blk_open	-		-		R }

    {cut	edit.copy		copyToBuf		edit_copy	-		-		- }
    {cut	edit.cut		cutToBuf		edit_cut	-		-		- }

    {hdlsimu	simulate.addprobe	HdlEditor::toggleProbe	net_probe	-		-		R }
  }

  proc inpop {cmd} {
    gat_popupSetState 1
    eval $cmd
    gat_popupSetState 0
  }

  #############################################################################
  #
  # Make the menu for $tag in the menu $w
  #
  proc make {m args} {
    variable menuEntryData

    menu $m -tearoff 0

    set isfirst 1
    foreach context $args {

      if { $context == "-nosep" } {
	set isfirst 1
	continue
      }
      #
      # Add separators between blocks
      #
      if {!$isfirst} {
	$m add separator
      }
      set isfirst 0

      #
      # Create the menu entries
      #
      foreach entry $menuEntryData {
	set tag ""
	set name ""
	set action ""
	set image ""
	set simage ""
	set varval ""
	set gflags ""
	lscan $entry tag name action image simage varval gflags

	if { $tag != $context } continue

	if {$image != "" && $image != "-"} { set image [gifI $image.gif]} { set image "" }
	if {$simage != "" && $simage != "-"} { set simage [gifI $simage.gif]} { set simage "" }

	set index ""

	if { [string first r $gflags] < 0 } {
	  set name [m pop.$name]
	}

	if { $action == "-separator" } {
	  # This is a spearator entry
	  $m add separator
	  set index [$m index last]
	} elseif { $action == "-cascade" } {


	  if { [scan $varval "%\[^=\]=%s" var val] == 2 }  {
	    safeeval $::menu_forbidden $m add cascade -image $image -compound left -label $name -menu $m.$var
	    if { [string index $val 0] == "@" } {
	      Menu::makeMenu $m.$var [string range $val 1 end]
	      $m.$var configure -tearoff 0
	    } else { 
	      PopupMenu::make $m.$var $val
	    }
	  } else {
	    safeeval $::menu_forbidden $m add cascade -image $image -compound left -label $name -menu $m.$varval
	  }

	} else {

	  if { [string first R $gflags] < 0 } {
	    set action "Action::$action"
	  }

	  if { [string first I $gflags] >= 0 } {
	    set action "PopupMenu::inpop $action"
	  }

	  if { $varval != "-"} {
	    set var ""
	    set val ""
    
	    if { [scan $varval "%\[^=\]=%s" var val] == 2 }  {
	      safeeval $::menu_forbidden $m add command -command $action -radio 1 -variable $var -value $val -image $image -selectimage $simage -compound left -indicatoron 0 -label $name
	    } else {
	      safeeval $::menu_forbidden $m add checkbutton -command $action -variable $var -image $image -selectimage $simage -compound left -indicatoron 0 -label $name
	    }
	  } else {
	    # This is a normal command entry
	    safeeval $::menu_forbidden $m add command -command $action -image $image -compound left -label $name
	  }
	}
      }
    }
  }


  proc post {w x y s Px Py} {
    global pop_anchor pop_tech main_w

    tkg_buttonPress $main_w $x $y $s 3
    set ptype [gat_setpop $x $y]
    set pop_anchor [gat_anchor]
    set pop_tech [gat_getTech]
    tkg_buttonRelease $main_w $x $y $s

    catch { tk_popup .pop_$ptype $Px $Py }
  }

  proc scopePost {Px Py} {
    catch { tk_popup .pop_scopetrace $Px $Py }
  }
}

#############################################################################
#############################################################################
#
# Create the popup menus
#
proc makePopups {} {
  PopupMenu::make 	.pop_wire 		wire wirelabel
  PopupMenu::make 	.pop_wireL 		wire wireunlabel
  PopupMenu::make 	.pop_mbwire 		wire wiresize wirelabel
  PopupMenu::make 	.pop_mbwireL 		wire wiresize wireunlabel
  PopupMenu::make 	.pop_mbwireS 		wire wireunsize wirelabel
  PopupMenu::make 	.pop_mbwireLS 		wire wireunsize wireunlabel
  PopupMenu::make	.pop_MIgate		gateport gateprop gate cut
  PopupMenu::make	.pop_gate		gateprop gate cut
  PopupMenu::make	.pop_joint3		joint3
  PopupMenu::make	.pop_joint4		joint4
  PopupMenu::make	.pop_multi		gate cut
  PopupMenu::make	.pop_block		block gateprop gatebase
  PopupMenu::make	.pop_blockedge		blockedge block gateprop gatebase
  PopupMenu::make	.pop_blockport		blockport block portprop gatebase
  PopupMenu::make 	.pop_canv		canv paste
  PopupMenu::make 	.pop_simu		simu 
  PopupMenu::make 	.pop_blksimu		open -nosep simu 
  PopupMenu::make 	.pop_wiresimu		wiresimu simu
  PopupMenu::make	.pop_anal		close
  PopupMenu::make	.pop_blkanal		open -nosep close
  PopupMenu::make 	.pop_intf		close
  PopupMenu::make 	.pop_intfblock		open -nosep close 
  PopupMenu::make 	.pop_intfblockport	blockport open -nosep close 
  PopupMenu::make 	.pop_intfblockedge	blockedge open -nosep
  PopupMenu::make	.pop_notmove		notmove close
  PopupMenu::make	.pop_modlist		modlist
  PopupMenu::make	.pop_ipanports		ipanports
  PopupMenu::make	.pop_hdleditp		paste hdledit
  PopupMenu::make	.pop_hdledit		hdledit
  PopupMenu::make 	.pop_hdleditsel		cut hdledit
  PopupMenu::make 	.pop_hdlsimu		hdlsimu hdledit
  PopupMenu::make 	.pop_scopetrace		scopetrace
  PopupMenu::make	.pop_libraries		libraries
  PopupMenu::make	.pop_libname		libname
}