/usr/share/gnudatalanguage/astrolib/detabify.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 | FUNCTION DETABIFY, CHAR_STR
;+
; NAME:
; DETABIFY
; PURPOSE:
; Replaces tabs in character strings with appropriate number of spaces
; EXPLANATION:
; The number of space characters inserted is calculated to space
; out to the next effective tab stop, each of which is eight characters
; apart.
;
; CALLING SEQUENCE:
; Result = DETABIFY( CHAR_STR )
;
; INPUT PARAMETERS:
; CHAR_STR = Character string variable (or array) to remove tabs from.
;
; OUTPUT:
; Result of function is CHAR_STR with tabs replaced by spaces.
;
; RESTRICTIONS:
; CHAR_STR must be a character string variable.
;
; MODIFICATION HISTORY:
; William Thompson, Feb. 1992.
; Converted to IDL V5.0 W. Landsman September 1997
;-
;
ON_ERROR, 2
;
; Check the number of parameters.
;
IF N_PARAMS() NE 1 THEN MESSAGE,'Syntax: Result = DETABIFY(CHAR_STR)'
;
; Make sure CHAR_STR is of type string.
;
SZ = SIZE(CHAR_STR)
IF SZ[SZ[0]+1] NE 7 THEN BEGIN
MESSAGE,/INFORMATIONAL,'CHAR_STR must be of type string'
RETURN, CHAR_STR
ENDIF
;
; Step through each element of CHAR_STR.
;
STR = CHAR_STR
FOR I = 0,N_ELEMENTS(STR)-1 DO BEGIN
;
; Keep looking for tabs until there aren't any more.
;
REPEAT BEGIN
TAB = STRPOS(STR[I],STRING(9B))
IF TAB GE 0 THEN BEGIN
NBLANK = 8 - (TAB MOD 8)
STR[I] = STRMID(STR[I],0,TAB) + $
STRING(REPLICATE(32B,NBLANK)) + $
STRMID(STR[I],TAB+1,STRLEN(STR[I])-TAB-1)
ENDIF
ENDREP UNTIL TAB LT 0
ENDFOR
;
RETURN, STR
END
|