;+ ; NAME: ; IDL_startup ; PURPOSE: ; Initialize IDL session ; CATEGORY: ; Startup ; CALLING SEQUENCE: ; Invoked when IDL session is started ; INPUTS: ; (none) ; OUTPUTS: ; (none) ; CALLS: ; defsysv_smei, IDL_postop_win, IDL_postop_linux, IDL_postop_vms ; PROCEDURE: ; > Environment variables: ; SMEI: ; The environment variable 'SMEI' MUST be defined, and point to the top ; of the SMEI software tree. ; sys, exe, com: ; Will be defined by this procedure if they don't exist yet. Both are ; subdirectories in 'SMEI' with the same name as the environment variable. ; TUB, DAT: ; Temporary and data directory. Both are best defined externally. ; No attempt is made to define them here ; ; VMS: The startup file should be defined as a logical at LOGIN ; '$DEFINE IDL_STARTUP DSK_NAME::[DIR_NAME]IDL_STARTUP.PRO' ; ; LINUX: Set startup file in the IDL development environment to this file. ; Also set the working directory to the $SMEI directory ; at the top of the software tree (where this file is located). ; ; WIN Same as Linux ; MODIFICATION HISTORY: ; FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ;- ;=================================================== ; Set up the IDL path. Note that the environment variable 'SMEI' MUST be ; properly defined, or we are in deep trouble. smei = getenv('SMEI') IF smei EQ '' THEN message, 'environment variable "smei" not defined' IF smei EQ '' THEN exit ; The 'override' directory contains procedures, which override some other ; procedure with the same name (either in IDL itself or SSW). Ideally the ; directory is empty (fat chance). ; The SSW path is at this point already stored in !path. ; Explicitly using characters instead of byte codes causes problems when this ; file is used as personal startup file in SSW. Don't know why. sep = [59B,58B,32B,44B] ; Semi-colon, colon, space, comma sep = sep[ where(!version.os_family EQ ['Windows','unix','vms','MacOS']) ] sep = string(sep[0]) thepath = filepath(root=smei, 'idl_override') + sep + $ '+'+filepath(root=smei, 'ucsd' ) + sep + $ '+'+filepath(root=smei, 'pro' ) + sep + $ '+'+filepath(root=smei, subdir='user' ,'phick') + sep + $ '+'+filepath(root=smei, subdir='user' ,'xuepu') + sep + $ '+'+filepath(root=smei, subdir='user' ,'skerr') + sep + $ '+'+filepath(root=smei, subdir='user' ,'hanscom_afb') ssw = getenv('SSW') IF ssw NE '' THEN thepath += sep+'+'+filepath(root=ssw,subdir='gen','idl') IF ssw NE '' THEN thepath += sep+'+'+filepath(root=ssw,subdir='gen','idl_libs') user = getenv('USER') udir = filepath(root=getenv('HOME'), subdir='soft', 'pro') IF user NE 'soft' THEN IF (file_search(udir))[0] NE '' THEN thepath += sep+'+'+udir udir = filepath(root=smei, subdir='user', user) IF user NE 'soft' THEN IF (file_search(udir))[0] NE '' THEN thepath += sep+'+'+udir thepath += sep+!path !path = expand_path(thepath) message, /info,'!path contains'+strcompress(n_elements(strtok(!path, sep)))+' elements' ; Our IDL code uses SSW environment variables. To be able to run outside SSW ; define them here if they don't exist yet. ; If this startup file is run from inside the SSW startup (by setting it ; as the personal startup file (in environment variable ssw_personal_startup) ; then SSW_SMEI has already been defined at this point as $SSW/smei. If smei ; is not part of the local SSW tree then this assignment will be useless. ; So make sure that directory 'ssw_smei' exists; if not, then clear the value, ; and use the environment variable 'smei'. ssw_smei = getenv('SSW_SMEI') IF ssw_smei NE '' THEN IF NOT checkdir(ssw_smei) THEN ssw_smei = '' IF ssw_smei EQ '' THEN setenv, 'SSW_SMEI=' + filepath(root=smei,'') IF ssw_smei EQ '' THEN setenv, 'SSW_SMEI_DAT='+ filepath(root=getenv('DAT' ),'') IF ssw_smei EQ '' THEN setenv, 'SSWDB_SMEI=' + filepath(root=getenv('SMEIDB' ),'') IF ssw_smei EQ '' THEN setenv, 'SSW_SMEI_UCSD='+ filepath(root=smei,'ucsd') IF ssw_smei EQ '' THEN setenv, 'SSW_SMEI_BHAM='+ filepath(root=smei,'bham') IF ssw_smei EQ '' THEN setenv, 'SSW_SMEI_HAFB='+ filepath(root=smei,'hafb') ; This is where we put our stuff that goes into SSW. ; Mostly defined for the benefit of run_ssw_smei ;setenv, 'SSW_SMEI_CONTRIB=/home/soft/ssw_smei' destroyvar, sep, user, udir ;=================================================== ; Define a few system variables. The most important ones are !TheTerminal ; and !ThePrinter. Note that the final values depend on the postop routines. ; defsysv_smei calls Time* functions, so it needs to called after the path ; has been set up. defsysv_smei ;=================================================== ; Do any remaining platform-dependent setup chores (hope to remove this ; sometime). Currently this sets the printer device (!ThePrinter), calls ; 'reset_colors' and sets the starting directory. IF strlowcase(!version.os_family) EQ 'windows' THEN IDL_postop_win IF strlowcase(!version.os_family) EQ 'unix' THEN IDL_postop_linux IF strlowcase(!version.os_family) EQ 'vms' THEN IDL_postop_vms