;+ ; NAME: ; PutFileSpec ; PURPOSE: ; Updates internal data originally set up by SetFileSpec ; CATEGORY: ; I/O, string manipulation ; CALLING SEQUENCE: PRO PutFileSpec, FileSpec, $ from = From , $ upto = Upto , $ part = Part , $ parse = Parse , $ strict = strict ; INPUTS: ; FileSpec string scalar of array with file names ; If it is an array it should have the same ; # elements as the internal data. ; OPTIONAL INPUT PARAMETERS: ; From, UpTo string scalars ; Any of the following six strings can be used: ; 'NODE','DEVICE','DIRECTORY','NAME','TYPE','VERSION' ; The input is case-insensitive ; Only a unique starting substring has to be specified ; If From is not specified, From='NODE' is assumed ; If UpTo is not specified, UpTo='VERSION' is assumed ; /parse if set, the filenames are parsed before adding them ; to the internal data (/parse is passed to SetFileSpec; ; see that procedure for more information about parsing). ; OUTPUTS: ; None (the modified internal data are accessed by GetFileSpec) ; INCLUDE: @compile_opt.pro ; On error, return to caller @filespec_common.pro ; Common block with array File and Parts ; CALLS: ; InitVar, SetFileSpec, strposn ; SIDE EFFECTS: ; If FileSpec is an array it must have the same size as the internal data. ; PROCEDURE: ; FileSpec is passed through SetFileSpec (with the /nosave keyword set so ; the internal data are not modified) to decompose into separate file ; parts. The relevant part (as identified from the From and UpTo strings) ; are then used to overwrite (part of) the internal data. ; MODIFICATION HISTORY: ; DEC-1997, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ;- nFile = n_elements(File)/6 IF nFile EQ 0 THEN message, 'SetFileSpec must be called before PutFileSpec' IF (size(FileSpec))[0] EQ 0 THEN $ FileName = replicate(FileSpec,nFile) ELSE FileName = FileSpec IF n_elements(FileName) NE nFile THEN BEGIN help, FileSpec, File message, 'FileSpec does not match dimension of File set by SetFileSpec' ENDIF ; /nosave prevents modification of array File SetFileSpec, FileName, FileParts, /nosave, parse=Parse, strict=strict IF n_elements(Part) NE 0 THEN BEGIN From = Part Upto = Part ENDIF InitVar, From, 'NODE' From = strupcase(From) iFrom = strposn(From,'FILE',tmp, From, /trailing) iFrom = (where( From EQ strmid(Parts,0,strlen(From)) ))[0] InitVar, Upto, 'VERSION' UpTo = strupcase(UpTo) iUpTo = strposn(Upto,'FILE',tmp, Upto, /trailing) iUpto = (where( Upto EQ strmid(Parts,0,strlen(UpTo)) ))[0] ; Copy relevant section from FileParts to File File[iFrom:iUpto,*] = FileParts[iFrom:iUpTo,*] RETURN & END