legacy/IDLv4tov5/
idl5to4.pro
top IDL5TO4
IDL5TO4, FILENAME, OUTDIR, ECHO=ECHO, ERRMSG=ERRMSG
Project : SOHO - CDS Name : IDL5TO4 Purpose : Convert IDL/v5 array[] syntax to IDL/v4 array() syntax. Category : Utility Explanation : In IDL version 5, square brackets were introduced as an alternate way of referencing an array, to avoid confusion between arrays and functions. In prior versions of IDL, the syntax FRED(3) could be interpreted as either the third element of the array FRED, or as a call to the function FRED. This syntax is still supported in IDL/v5, but the new syntax FRED[3] can be used to show that it is the third element of the array FRED which is desired, and not a function call. One of the problems that the new syntax resolves is that of routines where FRED(3) was intended to be used as an array subscripting, and was developed in an environment where there was no FRED function which could cause confusion. If this routine was then moved to an environment where there was a FRED function, then the routine would no longer work correctly. Using FRED[3] solves this problem. Unfortunately, the syntax FRED[3] is not supported in earlier versions of IDL. However, it may be that many routines would actually work in the earlier IDLs if the FRED[3] syntax was changed to FRED(3). The routine IDL5TO4 makes this conversion. The modified routine should then work in earlier versions of IDL, assuming that there are no other version-specific aspects to the code. Syntax : IDL5TO4, FILENAME [, OUTDIR ] Examples : IDL5TO4, '*.pro' ;Converts all procedure files ;in current directory IDL5TO4, '*.pro', 'idlv4' ;Converted files written to ;idlv4 subdirectory. Inputs : FILENAME = The name of the file(s) to process. May be an array of filenames, and may also contain wildcard characters. Opt. Inputs : OUTDIR = The name of a directory to write the converted files to. The directory must aleady exist--the routine will not try to create it. If not passed, then the files will be replaced with the converted version at their present location. Outputs : None. Opt. Outputs: None. Keywords : ECHO = If set, the a message line is printed for every file processed. ERRMSG = If defined and passed, then any error messages will be returned to the user in this parameter rather than depending on the MESSAGE routine in IDL. If no errors are encountered, then a null string is returned. In order to use this feature, ERRMSG must be defined first, e.g. ERRMSG = '' IDL5TO4, ERRMSG=ERRMSG, ... IF ERRMSG NE '' THEN ... Calls : DATATYPE, FIND_FILE, FILE_EXIST, BREAK_FILE, CONCAT_DIR Common : None. Restrictions: Although most situations should be accounted for, there may still be situations which are not adequately addressed by this routine. One possible failure scenario is when a structure contains a tag name which exactly matches an IDL operator, e.g. "AND", "OR", "MOD", "EQ", etc. This routine may not work correctly in Windows or MacOS, if it needs to overwrite a file which already exists. However, it should work okay if the output files are directed to an empty subdirectory. Side effects: None. Prev. Hist. : Partially based on IDLV5_TO_V4 by Wayne Landsman History : Version 1, 22-Jul-1998, William Thompson, GSFC Contact : WTHOMPSON
Parameters
- FILENAME
- OUTDIR
Keywords
- ECHO
- ERRMSG
File attributes
Modification date: | Tue Oct 1 14:16:37 2013 |
Lines: | 376 |