This file is indexed.

/usr/share/saods9/src/catcxc.tcl is in saods9-data 7.3.2+repack-1.

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
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
#  Copyright (C) 1999-2014
#  Smithsonian Astrophysical Observatory, Cambridge, MA, USA
#  For conditions of distribution and use, see copyright notice in "copyright"

package provide DS9 1.0

proc CATCXC {varname} {
    upvar #0 $varname var
    global $varname
    global pcat

    global debug
    if {$debug(tcl,cat)} {
	puts stderr "CATCXC $varname"
    }

    # go for votable or tsv
    if {$pcat(vot)} {
	CATCXCVOT $varname
    } else {
	CATCXCTSV $varname
    }
}

proc CATCXCVOT {varname} {
    upvar #0 $varname var
    global $varname

    global debug
    if {$debug(tcl,cat)} {
	puts stderr "CATCXCVOT $varname"
    }

    set var(proc,parser) CATVOTParse
    
    # coord (degrees)
    switch $var(skyformat) {
	degrees {
	    set xx $var(x)
	    set yy $var(y)
	}
	sexagesimal {
	    set xx [h2d [Sex2H $var(x)]]
	    set yy [Sex2D $var(y)]
	}
    }

    # size (arcmin)
    switch $var(rformat) {
	degrees {
	    set ww $var(width)
	    set hh $var(height)
	}
	arcmin {
	    set ww [expr $var(width)/60.]
	    set hh [expr $var(height)/60.]
	}
	arcsec {
	    set ww [expr $var(width)/60./60.]
	    set hh [expr $var(height)/60./60.]
	}
    }

    # now to radius
    set rr [expr sqrt($ww*$ww+$hh*$hh)/2.]

    # output
    if {$var(allcols)} {
	set type 3
    } else {
	set type 2
    }

    # query
    set var(query) [http::formatQuery RA $xx DEC $yy SR $rr VERB $type]
    set var(url) "http://cda.cfa.harvard.edu/cscvo/coneSearch"

    CATLoad $varname
}

proc CATCXCTSV {varname} {
    upvar #0 $varname var
    global $varname

    global debug
    if {$debug(tcl,cat)} {
	puts stderr "CATCXCTSV $varname"
    }

    set var(proc,reader) CATCXCReader
    
    # coord (degrees)
    switch $var(skyformat) {
	degrees {
	    set xx $var(x)
	    set yy $var(y)
	}
	sexagesimal {
	    switch -- $var(sky) {
		fk4 -
		fk5 -
		icrs {set xx [h2d [Sex2H $var(x)]]}
		galactic -
		ecliptic {set xx [Sex2D $var(x)]}
	    }
	    set yy [Sex2D $var(y)]
	}
    }

    # size (arcmin)
    switch $var(rformat) {
	degrees {
	    set ww [expr $var(width)*60.]
	    set hh [expr $var(height)*60.]
	}
	arcmin {
	    set ww $var(width)
	    set hh $var(height)
	}
	arcsec {
	    set ww [expr $var(width)/60.]
	    set hh [expr $var(height)/60.]
	}
    }

    # now to radius
    set rr [expr sqrt($ww*$ww+$hh*$hh)/2.]

    # output
    if {$var(allcols)} {
	set type observation
    } else {
	set type master
    }

    # query
    set var(query) "ra=$xx&dec=$yy&sr=$rr&type=$type"

    # rows
    if {!$var(allrows)} {
	append var(query) "&rows=$var(max)"
    }

    set var(url) "http://cda.cfa.harvard.edu/cscds9/coneSearch"

    CATLoadIncr $varname
}

proc CATCXCReader {t sock token} {
    upvar #0 $t T
    global $t

    set result 0

    if { ![info exists ${t}(state)]  } {
	set T(state) 0
    }

    switch -- $T(state) {
	0 {
	    # init db
	    fconfigure $sock -blocking 1
	    set T(Nrows) 0
	    set T(Ncols) 0
	    set T(Header) {}
	    set T(HLines) 0

	    set T(state) 1
	}

	1 {
	    # process header
	    if {[gets $sock line] == -1} {
		set T(Nrows) 0
		set T(Ncols) 0
		set T(Header) {}
		set T(HLines) 0

		set T(state) -1
		return $result
	    }

	    set result [string length "$line"]

	    incr ${t}(HLines)
	    set n $T(HLines)
	    set T(H_$n) $line

	    if {[regexp -- {^ *(-)+ *(\t *(-)+ *)*} $line]} {
		# clean up header column name
		set hh $T(H_[expr $n-1])
		regsub -all {\[} $hh {} hh
		regsub -all {\]} $hh {} hh
		set T(H_[expr $n-1]) $hh

		# cols
		set T(Header) [split $T(H_[expr $n-1]) "\t"]
		set T(Dashes) [split $T(H_$n) "\t"]
		set T(Ndshs) [llength $T(Dashes)]
		starbase_colmap $t
		set T(state) 2

		# these are hard coded
		set T(Id) $T(Header)
		set T(DataType) {}
		set T(ArraySize) {}
		set T(Unit) {}
		set T(Ucd) {}
		# name
		lappend T(DataType) {char}
		lappend T(ArraySize) {*}
		lappend T(Unit) {}
		lappend T(Ucd) {}
		# ra
		lappend T(DataType) {float}
		lappend T(ArraySize) {}
		lappend T(Unit) {deg}
		lappend T(Ucd) {pos.eq.ra;meta.main}
		# dec
		lappend T(DataType) {float} 
		lappend T(ArraySize) {}
		lappend T(Unit) {deg}
		lappend T(Ucd) {pos.eq.dec;meta.main}
		# err_ellipse_r0
		lappend T(DataType) {float}
		lappend T(ArraySize) {}
		lappend T(Unit) {}
		lappend T(Ucd) {}
		# err_ellipse_r1		
		lappend T(DataType) {float}
		lappend T(ArraySize) {}
		lappend T(Unit) {}
		lappend T(Ucd) {}
		# err_ellipse_ang
		lappend T(DataType) {float}
		lappend T(ArraySize) {}
		lappend T(Unit) {deg}
		lappend T(Ucd) {}
		# conf_flag
		lappend T(DataType) {boolean}
		lappend T(ArraySize) {}
		lappend T(Unit) {}
		lappend T(Ucd) {}
		# extent_flag
		lappend T(DataType) {boolean}
		lappend T(ArraySize) {}
		lappend T(Unit) {}
		lappend T(Ucd) {}
		# sat_src_flag
		lappend T(DataType) {boolean}
		lappend T(ArraySize) {}
		lappend T(Unit) {}
		lappend T(Ucd) {}
		# flux_aper90_b
		lappend T(DataType) {float}
		lappend T(ArraySize) {}
		lappend T(Unit) {}
		lappend T(Ucd) {}
		# flux_aper90_hilim_b
		lappend T(DataType) {float}
		lappend T(ArraySize) {}
		lappend T(Unit) {}
		lappend T(Ucd) {}
		# flux_aper90_lolim_b
		lappend T(DataType) {float}
		lappend T(ArraySize) {}
		lappend T(Unit) {}
		lappend T(Ucd) {}
		# significance
		lappend T(DataType) {float}
		lappend T(ArraySize) {}
		lappend T(Unit) {}
		lappend T(Ucd) {}
		# hard_hm
		lappend T(DataType) {float}
		lappend T(ArraySize) {}
		lappend T(Unit) {}
		lappend T(Ucd) {}
		# hard_ms
		lappend T(DataType) {float}
		lappend T(ArraySize) {}
		lappend T(Unit) {}
		lappend T(Ucd) {}
		# var_intra_index_b
		lappend T(DataType) {int}
		lappend T(ArraySize) {}
		lappend T(Unit) {}
		# var_inter_index_b
		lappend T(DataType) {int}
		lappend T(ArraySize) {}
		lappend T(Unit) {}
		lappend T(Ucd) {}

		if {[llength $T(Header)] > 17} {
		    # obsid
		    lappend T(DataType) {int}
		    lappend T(ArraySize) {}
		    lappend T(Unit) {}
		    lappend T(Ucd) {}
		    # ra_aper
		    lappend T(DataType) {float}
		    lappend T(ArraySize) {}
		    lappend T(Unit) {deg}
		    lappend T(Ucd) {}
		    # dec_aper
		    lappend T(DataType) {float}
		    lappend T(ArraySize) {}
		    lappend T(Unit) {deg}
		    lappend T(Ucd) {}
		    # mjr_axis_aper
		    lappend T(DataType) {float}
		    lappend T(ArraySize) {}
		    lappend T(Unit) {}
		    lappend T(Ucd) {}
		    # mnr_axis_aper
		    lappend T(DataType) {float}
		    lappend T(ArraySize) {}
		    lappend T(Unit) {}
		    lappend T(Ucd) {}
		    # pos_angle_aper
		    lappend T(DataType) {float}
		    lappend T(ArraySize) {}
		    lappend T(Unit) {deg}
		    lappend T(Ucd) {}
		}
	    }
	}

	2 { 
	    # process table
	    if {[gets $sock line] == -1} {
		set T(state) 0
	    } else {
		set result [string length "$line"]
		set line [string trim $line]

		if {$line != {}} {
		    # ok, save it
		    incr ${t}(Nrows)
		    set r $T(Nrows)

		    set NCols [starbase_ncols $t]
		    set c 1
		    foreach val [split $line "\t"] {
			set T($r,$c) $val
			incr c
		    }
		    for {} {$c <= $NCols} {incr c} {
			set T($r,$c) {}
		    }
		}
	    }
	}
    }

    return $result
}

proc CATCXCAck {varname} {
    upvar #0 $varname var
    global $varname

    set msg {Acknowledgments for CXC

Request for Acknowledgment of Use of the Chandra Source Catalog

Users are kindly requested to acknowledge in the acknowledgment
section of any resulting publications their use of the Chandra Source
Catalog.

This will help us greatly to keep track of catalog usage, information
that is essential for providing full accountability of our work and
services, as well as for planning future services.

The following language is suggested:

This research has made use of data obtained from the Chandra Source
Catalog, provided by the Chandra X-ray Center (CXC) as part of the
Chandra Data Archive.

We would like to remind you that it is also very helpful for us if you
could include Dataset Identifiers in the manuscript. The Dataset
Identifier for the Chandra Source Catalog is:

ADS/Sa.CXO#CSC

}
    SimpleTextDialog ${varname}ack [msgcat::mc {Acknowledgment}] 80 10 insert top $msg
}