comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Converting to [] array subscripts
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Converting to [] array subscripts [message #9195] Sun, 08 June 1997 00:00
Wayne Landsman is currently offline  Wayne Landsman
Messages: 117
Registered: January 1997
Senior Member
I like the use of square brackets for array subscripts in IDL V5.0 -- it
forever banishes the variable/function ambiguity, and makes the code
read better. To quickly convert old code to use square bracket
subscripts, I've written a procedure IDLV4_TO_V5 available with
supporting procedures in ftp://idlastro.gsfc.nasa.gov/landsman/v5/
which will change all the subscripted parentheses in a procedure to
square brackets (and leave everything else unchanged.) The intrinsic
ROUTINE_INFO() function is used to determine the names of valid
variables, and thus determine which parenthesis should be altered.

IDLV4_TO_V5 has the following limitations (plus I am sure others which I
don't yet know about):
1. It doesn't work on main programs (i.e. without a 'pro' or
'function' definition)
2. It might get confused if parentheses are placed in a string,
e.g. "printf,3,')alpha('"
3. It only parses one line at a time, and so can get confused by
continuation lines.

Number 3 seems the most serious limitation, but in fact most users
would not break up an array subscript into separate lines, so in my case
IDLV4_TO_V5 seemed to work for ~99% of the ~400 procedures I tried it
on.

One quirk I found in V5.0 is that for a structure x, x.tag[3] is
legal, but x.[3] is not -- although x.(3) is!

Other caveats - I've only tested it on a Unix system (Solaris 2.5),
and the code is pretty clunky right now. I welcome suggestions for
improvement.

--Wayne Landsman landsman@mpb.gsfc.nasa.gov
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Surface Plot in Object Graphics
Next Topic: IDL on OpenVMS V7.1

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 09:13:43 PDT 2025

Total time taken to generate the page: 0.01367 seconds