X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 29 Apr 2013 04:16 PM by  anon
help with function call syntax
 2 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
29 Apr 2013 04:16 PM
    Hi, I'm a sysadmin, trying to restore some idl scripts after a system crash. It's been a LONG time since I've done any IDL development myself. I'm running an old shell script that calls some custom idl routines, and am getting fundamental-looking syntax errors that look to me like the idl pro's were maybe written for an older version of IDL. I've installed the IDL that I thought was working on the system before the crash, but I don't know for sure. I've tried with IDL 5.6, 6.0, 6.3, 6.4 and 8.2. Below are the first few errors and parts of the code - could anyone point me the right way? Thanks! % Compiled module: VB_ERROR. Result=PICKFILE(GET_PATH=GET_PATH, _EXTRA = e) ^ % Syntax error. At: /usr/local/VoxBo/pros/VoxBo_IO.pro, Line 64 % 1 Compilation error(s) in module VB_PICKFILE. % Compiled module: GETFILENAME. % Compiled module: RETURNXYZ. % Compiled module: CREATEHEADER. if i eq 0 then Tokens=strsplit(UserHeader(i),TABSPACE,/extract) else $ ^ % Syntax error. At: /usr/local/VoxBo/pros/VoxBo_IO.pro, Line 369 % 1 Compilation error(s) in module PARSEUSERHEADER. TempParse=strsplit(InLine,TABSPACE,/extract) ^ % Syntax error. At: /usr/local/VoxBo/pros/VoxBo_IO.pro, Line 672 TempParse=strsplit(InLine,TABSPACE,/extract) ^ % Syntax error. At: /usr/local/VoxBo/pros/VoxBo_IO.pro, Line 705 TempParse=strsplit(InLine,TABSPACE,/extract) === The shell script looks like this. The "-nw" option is invalid in IDL 8.2 idl -nw -IDL_STARTUP /jet/aguirre/PatientStudies/BlindnessNOS/PrepScripts/ASL_scripts/local_asl_vs === The source for the first error looks like this: FUNCTION VB_PICKFILE, GET_PATH=GET_PATH, _EXTRA = e Result=PICKFILE(GET_PATH=GET_PATH, _EXTRA = e) if GET_PATH eq strmid(result,0,rstrpos(result,'/')+1) then $ Result=strmid(result,rstrpos(result,'/')+1,strlen(result)) return,Result end

    Deleted User



    New Member


    Posts:
    New Member


    --
    30 Apr 2013 10:50 AM
    Hi, I've solved the problem. The IDL_PATH env var wasn't right, so IDL thought these routines were variables. Wow, this brings back memories from years ago with IDL and all the confusion that resulted from dyanmic typing and the use of parantheses for both arrays and functions! -M

    Deleted User



    New Member


    Posts:
    New Member


    --
    30 Apr 2013 02:37 PM
    Hi Michael, About the parenthesis vs square brakets, please, take a look at COMPILE_OPT statement: http://www.exelisvis.com/docs/COMPILE... Where if you use: COMPILE_OPT IDL2 Should take care of the ambiguity. See that IDL2 switch includes the following: STRICTARR — While compiling this routine, IDL will not allow the use of parentheses to index arrays, reserving their use only for functions. Square brackets are then the only way to index arrays. Use of this directive will prevent the addition of a new function in future versions of IDL, or new libraries of IDL code from any source, from changing the meaning of your code, and is an especially good idea for library functions. Cheers, fernando
    You are not authorized to post a reply.