Viewing contents of file '../idllib/iuedac/iuelib/pro/explib.pro'
;******************************************************************************
;+
;*NAME:
;
;    	EXPLIB   July 22, 1994
;  
;*CLASS:
;
;*CATEGORY:
;  
;*PURPOSE:
;
;       To add !iuer.expr (the IUEDAC experimental library) to the beginning
;       of the IDL search path, or remove it, or tell user if it's present.
;  
;*CALLING SEQUENCE:
;
;	EXPLIB,D
;  
;*PARAMETERS:
;
;	D     (REQ) (I) (0) (S)
;             If D is positive, !iuer.expr will be placed at the beginning of
;             !path. 
;             If D is negative, !iuer.expr will be removed (if present) from
;             !path, regardless of its position in !path.
;             If D is zero, the user will be told if !iuer.expr is present in
;             !path, and if so, where it is.
;             
;  
;*EXAMPLES:
;
;       explib,1     Adds !iuer.expr to !path
;       explib,-1    Deletes !iuer.expr from !path
;       explib,0     Tells user whether !iuer.expr is present in !path
;
;*SYSTEM VARIABLES USED:
;
;       !iuer.expr
;       !path is modified.
;
;*INTERACTIVE INPUT:
;
;       none
;
;*SUBROUTINES CALLED:
;
;       PLATFORM
;
;*FILES USED:
;
;       none
;
;*SIDE EFFECTS:
;
;       !path is modified.
;  
;*RESTRICTIONS:
;
;*NOTES:
;
;*PROCEDURE:
;
;       If D gt 0:
;       !path = !iuer.expr + syntax.pathlist + !path
;
;       If D lt 0:
;       The pieces of !path on either side of !iuer.expr are concatenated.
;
;       If D eq 0:
;       If strmid(!path,!iuer.expr) ge 0, !iuer.expr is in !path.  Its 
;       position in the list of libraries is determined by counting the
;       number of delimiters prior to its first character.
;
;*I_HELP nn:
;  
;*MODIFICATION HISTORY:
;
;       July 22, 1994 RWT version 1
;       25 Jul 94  PJL  add Unix support
;        2 Sep 94 LLT replace IUER_EXPR logical with !iuer.expr
;       23 Nov 94 LLT add D zero or negative options.
;-
;******************************************************************************
 pro explib,d
;
 npar = n_params(0)
 if (npar eq 0) then begin
    print,'EXPLIB,D'
    retall
 endif  ; npar eq 0
;
; see if expv2: is already in search path
;
;;; res = strpos(!path,'expv2:')
 res = strpos(!path,!iuer.expr)

if d gt 0 then begin
   if (res eq -1) then begin
      platform,dummy,syntax=syntax
      !path = !iuer.expr + syntax.pathlist + !path
      print,' adding !iuer.expr to beginning of IDL search path'
   endif else print,' !iuer.expr already added to IDL search path'
endif else if d lt 0 then begin
   if res ge 0 then begin
      platform,dummy,syntax=syntax
      elen=strlen(!iuer.expr)
      one=strmid(!path,0,res-1)
      olen=strlen(one)
      tlen=strlen(!path)-elen-olen
      two=strmid(!path,res+elen+1,tlen)
      if (two ne '') and (one ne '') then !path=one+syntax.pathlist+two else $
         !path=one+two
      print,'!iuer.expr removed from !path.'
   endif else print,'!iuer.expr not in !path.'
endif else if d eq 0 then begin
   if res ge 0 then begin 
      platform,dummy,syntax=syntax
      x=byte(strmid(!path,0,res+1))
      s=byte(syntax.pathlist)
      temp=where(x eq s(0),n)
      print,'!iuer.expr is library number '+strtrim(n+1,2)+' in !path.'
   endif else print,'!iuer.expr is not in !path.' 
endif ;d
;
 return
 end  ; explib