/usr/share/gnudatalanguage/astrolib/fxbfindlun.pro is in gdl-astrolib 2018.02.16+dfsg-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 | FUNCTION FXBFINDLUN, UNIT
;+
; NAME:
; FXBFINDLUN()
; Purpose :
; Find logical unit number UNIT in FXBINTABLE common block.
; Explanation :
; Finds the proper index to use for getting information about the logical
; unit number UNIT in the arrays stored in the FXBINTABLE common block.
; Called from FXBCREATE and FXBOPEN.
; Use :
; Result = FXBFINDLUN( UNIT )
; Inputs :
; UNIT = Logical unit number.
; Opt. Inputs :
; None.
; Outputs :
; The result of the function is an index into the FXBINTABLE common
; block.
; Opt. Outputs:
; None.
; Keywords :
; None.
; Calls :
; None.
; Common :
; Uses common block FXBINTABLE--see "fxbintable.pro" for more
; information.
; Restrictions:
; None.
; Side effects:
; If UNIT is not found in the common block, then it is added to the
; common block.
; Category :
; Data Handling, I/O, FITS, Generic.
; Prev. Hist. :
; William Thompson, Feb. 1992.
; Written :
; William Thompson, GSFC, February 1992.
; Modified :
; Version 1, William Thompson, GSFC, 12 April 1993.
; Incorporated into CDS library.
; Version 2, William Thompson, GSFC, 21 July 1993.
; Added DHEAP variable to fix bug with variable length arrays.
; Version 3, Michael Schubnell, University of Michigan, 22 May 1996
; Change N_DIMS from short to long integer.
; Version :
; Version 3, 22 May 1996
; Make NAXIS1, NAXIS2, HEAP, DHEAP, BYTOFF 64-bit integers to deal with large files,
; E. Hivon Mar 2008
; Also make NHEADER a 64 bit integer W. Landsman May 2016
;
;-
;
@fxbintable
ON_ERROR, 2
;
; Check the number of parameters.
;
IF N_PARAMS() NE 1 THEN MESSAGE, $
'Syntax: ILUN = FXBFINDLUN( UNIT )'
;
; If the common block hasn't been initialized yet, then initialize it.
;
IF N_ELEMENTS(LUN) EQ 0 THEN BEGIN
LUN = UNIT
STATE = 0
HEAD = ''
MHEADER = 0L
NHEADER = 0LL
NAXIS1 = 0LL
NAXIS2 = 0LL
TFIELDS = 0L
HEAP = 0LL
DHEAP = 0LL
BYTOFF = 0LL
TTYPE = ''
FORMAT = ''
IDLTYPE = 0
N_ELEM = 0L
TSCAL = 1.
TZERO = 0.
MAXVAL = 0L
N_DIMS = LONARR(9,2)
ILUN = 0
;
; Otherwise, find the logical unit number in the common block. If not found,
; then add it.
;
END ELSE BEGIN
ILUN = WHERE(LUN EQ UNIT,NLUN)
ILUN = ILUN[0]
IF NLUN EQ 0 THEN BEGIN
LUN = [LUN,UNIT]
STATE = [STATE, 0]
BOOST_ARRAY,HEAD,''
MHEADER = [MHEADER,0]
NHEADER = [NHEADER,0]
NAXIS1 = [NAXIS1, 0]
NAXIS2 = [NAXIS2, 0]
TFIELDS = [TFIELDS,0]
HEAP = [HEAP, 0]
DHEAP = [DHEAP, 0]
BOOST_ARRAY,BYTOFF,0
BOOST_ARRAY,TTYPE,''
BOOST_ARRAY,FORMAT,''
BOOST_ARRAY,IDLTYPE,0
BOOST_ARRAY,N_ELEM,0
BOOST_ARRAY,TSCAL,1.
BOOST_ARRAY,TZERO,0.
BOOST_ARRAY,MAXVAL,0
BOOST_ARRAY,N_DIMS,LONARR(9,2)
ILUN = N_ELEMENTS(LUN)-1
ENDIF
ENDELSE
;
; Return the index into the common block arrays.
;
RETURN,ILUN
END
|