This file is indexed.

/usr/share/doc/libplplot12/examples/tk/tk03 is in plplot-tcl-dev 5.10.0+dfsg2-0.1ubuntu2.

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

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
#!/bin/sh
#--------------------------------*- Tcl -*------------------------------------#
# $Id: tk03.in 13008 2014-02-12 22:19:33Z airwin $
#
# Maurice LeBrun
# 30 Jun 1994
#
# @> A script illustrating multiple toplevel plframes.
#-----------------------------------------------------------------------------#
#\
exec /usr/bin/plserver -f "$0" ${1+"$@"}

# Note: I defer running "open_main" until later to make sure everything
# has been sourced.

wm title . "tk03"
plstdwin .

set child_count 1

# If you just want a bare plframe, set this to 0.

set use_plxframe 1

###############################################################################
# Set up the menubar and message widgets for main window.

proc open_main {} {

    global use_plxframe

    if { $use_plxframe == 1 } then {
	set plwin .plw.plwin
    } else {
	set plwin .plwin
    }

    frame .menu -relief raised -borderwidth 3

    button .menu.one -text "One" -command "1 $plwin"
    pack append .menu .menu.one {left expand fill}

    button .menu.two -text "Two" -command "2 $plwin"
    pack append .menu .menu.two {left expand fill}

    button .menu.open -text "Open new" -command "open_child"
    pack append .menu .menu.open {left expand fill}

    button .menu.exit -text "Exit" -command "destroy ." 

#"quit 0"

    pack append .menu .menu.exit {right expand fill}

    message .msg \
	-font -Adobe-helvetica-medium-r-normal--*-240* -aspect 200 \
	-width 500 -borderwidth 1 \
	-text "TK03: Multiple toplevels with plframes"

    pack append . \
	.menu {top fillx} \
	.msg {top padx 5 pady 5 fill} 

    tk_menuBar .menu .menu.one .menu.two .menu.exit

    if { $use_plxframe == 1 } then {
	plxframe .plw
	pack append . .plw {left expand fill}
    } else {
	plframe .plwin
	pack append . .plwin {left expand fill}
    }
}

###############################################################################
# Set up the second toplevel

proc open_child {} {

    global child_count use_plxframe

    set w .$child_count

    toplevel $w
    plstdwin $w

    if { $use_plxframe == 1 } then {
	set plwin $w.plw.plwin
    } else {
	set plwin $w.plwin
    }

# Set up the second menubar and message widgets.

    frame $w.menu -relief raised -borderwidth 3

    button $w.menu.three -text "Three" -command "plot2 $plwin"
    pack append $w.menu $w.menu.three {left expand fill}

    button $w.menu.four -text "Four" -command "plot3 $plwin"
    pack append $w.menu $w.menu.four {left expand fill}

    button $w.menu.exit -text "Dismiss" -command "destroy $w"
    pack append $w.menu $w.menu.exit {right expand fill}

    message $w.msg \
	-font -Adobe-helvetica-medium-r-normal--*-240* -aspect 200 \
	-width 500 -borderwidth 1 \
	-text "TK03: toplevel $child_count"

    pack append $w \
	$w.menu {top fillx} \
	$w.msg {top padx 5 pady 5 fill} 

    tk_menuBar $w.menu $w.menu.three $w.menu.four

# This creates the plframe "megawidget".  If you just want a bare plframe,
# change use_plxframe to 0.

    if { $use_plxframe == 1 } then {
	plxframe $w.plw
	pack append $w $w.plw {left expand fill}
    } else {
	plframe $w.plwin
	pack append $w $w.plwin {left expand fill}
    }

    incr child_count
}

###############################################################################
# Utility routines

# Punch eject and hold onto your seat !!!

proc quit a {
    exit
}

# Utility routine.

proc dpos w {
    wm geometry $w +300+300
}

###############################################################################
# Plotting routines
###############################################################################

proc 1 {w} {
    global xscale yscale xoff yoff

    set xscale 6.0
    set yscale 1.0
    set xoff   0.0
    set yoff   0.0

    plot1 $w
}

proc 2 {w} {
    global xscale yscale xoff yoff

    set xscale 1.0
    set yscale 0.0014
    set xoff   0.0
    set yoff   0.0185

    $w cmd plsyax 5

    plot1 $w
}

# This is supposed to work just like the plot1() in x01c.c

proc plot1 {w} {
    global xscale yscale xoff yoff

    set npts 60
    matrix x f $npts
    matrix y f $npts

    for {set i 0} {$i < $npts} {incr i} {
	x $i = [expr $xoff + $xscale * ($i + 1) / $npts]
	y $i = [expr $yoff + $yscale * pow([x $i],2)]
    }

    set xmax [x [expr $npts-1]]
    set ymax [y [expr $npts-1]]

    matrix x1 f 6
    matrix y1 f 6

    for {set i 0} {$i < 6} {incr i} {
	set j [expr $i*10+3]
	x1 $i = [x $j]
	y1 $i = [y $j]
    }

    $w cmd plcol0 1
    $w cmd plenv $xoff $xmax $yoff $ymax 0 0
    $w cmd plcol0 6
    $w cmd pllab "(x)" "(y)" "#frPLplot Example 1 - y=x#u2"

    # plot the data points

    $w cmd plcol0 9
    $w cmd plpoin 6 x1 y1 9

    # draw the line through the data

    $w cmd plcol0 4
    $w cmd plline $npts x y
}

# This is supposed to work just like the plot2() in x01c.c

proc plot2 {w} {
    $w cmd plcol0 1
    $w cmd plenv -2 10 -.4 1.2 0 1
    $w cmd plcol0 2
    $w cmd pllab "(x)" "sin(x)/x" "#frPLplot Example 1 - Sinc Function"

    # Fill up the array

    matrix x1 f 101
    matrix y1 f 101

    for {set i 0} {$i < 101} {incr i} {
	set x [expr ($i - 19.)/6.]
	x1 $i = $x
	y1 $i = 1
	if {$x != 0} { y1 $i = [expr sin($x)/$x] }
    }

    $w cmd plcol0 3
    $w cmd plline 101 x1 y1
}

# This is supposed to work just like the plot3() in x01c.c

proc plot3 {w} {

    $w cmd pladv
    $w cmd plvsta
    $w cmd plwind 0.0 360.0 -1.2 1.2

# Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y.

    $w cmd plcol0 1
    $w cmd plbox "bcnst" 60.0 2 "bcnstv" 0.2 2

# Superimpose a dashed line grid, with 1.5 mm marks and spaces. 
# plstyl expects two integer matrices for mark and space!

    matrix mark i 1
    matrix space i 1

    mark 0 = 1500
    space 0 = 1500
    $w cmd plstyl 1 mark space

    $w cmd plcol0 2
    $w cmd plbox "g" 30.0 0 "g" 0.2 0

    mark 0 = 0
    space 0 = 0
    $w cmd plstyl 0 mark space

    $w cmd plcol0 3
    $w cmd pllab "Angle (degrees)" "sine" "#frPLplot Example 1 - Sine function"

    matrix x f 101
    matrix y f 101

    for {set i 0} {$i < 101} {incr i} {
	x $i = [expr 3.6 * $i]
	y $i = [expr sin([x $i] * 3.141592654 / 180.0)]
    }

    $w cmd plcol0 4
    $w cmd plline 101 x y
}

###############################################################################

open_main