Re: rstrpos: version 5.2 and version 5.3 [message #19078] |
Fri, 25 February 2000 00:00 |
Martin Schultz
Messages: 515 Registered: August 1997
|
Senior Member |
|
|
Andy Loughe wrote:
>
> Hello,
>
> In their latest software upgrade, did RSI really
> throw away the RSTRPOS function and replace it with
> STRPOS(/REVERSE_SEARCH) ?
>
> Would they like to fix all the code I have that uses
> RSTRPOS? No... I'll go write my own RSTRPOS.pro, thank you,
> or replace *all* my RSTRPOS with STRPOS(/REVERSE_SEARCH).
>
> This kind of non-backwards compatability gives
> IDL a bad name... I hear the complaint very often
> from ex-IDL programmers.
>
>
Oh! I do agree!! They should really be more careful in labeling routines
as
"obsolete". I think it would be fair to keep a routine as rstrpos in the
main
lib path (or replace it by a wrapper which uses the new functionality)
and only
change the documentation to tell users there is a better way now so they
can
slowly migrate to the new form. In my opinion this worked out not too
bad with
these () -> [] array indices...
Believe it or not: some people ned to rerun code only after several
years of
IDL development went by!
Cheers,
Martin
> --------
> Andrew F. Loughe email:loughe@fsl.noaa.gov phone:(303)497-6211
--
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
[[ Dr. Martin Schultz Max-Planck-Institut fuer Meteorologie [[
[[ Bundesstr. 55, 20146 Hamburg [[
[[ phone: +49 40 41173-308 [[
[[ fax: +49 40 41173-298 [[
[[ martin.schultz@dkrz.de [[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
|
|
|
Re: rstrpos: version 5.2 and version 5.3 [message #19088 is a reply to message #19078] |
Thu, 24 February 2000 00:00  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
davidf@dfanning.com (David Fanning) writes:
> And, anyway, I consider the use of FORWARD_FUNCTION to
> be an admission of a program structure that is out of
> control. Nothing against it, you just wouldn't find it
> in any of my programs. :-)
FORWARD_FUNCTION is not the best, but I do find it useful in some
special cases, like when there is an IDL version dependency. It's a
little bit of insurance that I stick at the top of my program file to
give more precise behavior.
But I do see what you are saying here: pre-5.3 IDL STRPOS functions
don't take keywords. Then your only alternative is to use
call_function as suggested.
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|
Re: rstrpos: version 5.2 and version 5.3 [message #19089 is a reply to message #19088] |
Thu, 24 February 2000 00:00  |
mallors
Messages: 76 Registered: November 1997
|
Member |
|
|
In article <MPG.131f2aeb52253995989a57@news.frii.com>,
davidf@dfanning.com (David Fanning) writes:
> J.D. Smith (jdsmith@astro.cornell.edu) writes:
>
>> It's there.
>>
>> You just need to add lib/obsolete under rsi/idl to your IDL search path, or,
>> equivalently, search all sub-paths of lib. I do this as a matter
>> of course, to ensure such things don't happen.
>
> Yes, or alternatively (this is what I decided to do recently),
> include the code in the source that uses it. I did this because
> I *know* people don't have the OBSOLETE directory on their
> path and I get tired of finding 10 e-mails in the morning
> asking why my programs don't work. :-(
But at the top of rstrpos.pro, you will find this
wonderful statement:
; $Id: rstrpos.pro,v 1.7 1999/01/16 01:25:38 scottm Exp $
;
; Copyright (c) 1993-1999, Research Systems, Inc. All rights reserved.
; Unauthorized reproduction prohibited.
;
Of course since I reproduced this, I guess I could be in trouble :-)
Regards,
-bob
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~
Robert S. Mallozzi 256-544-0887
Mail Code SD 50
http://gammaray.msfc.nasa.gov/ Marshall Space Flight Center
http://cspar.uah.edu/~mallozzir/ Huntsville, AL 35812
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~
|
|
|
Re: rstrpos: version 5.2 and version 5.3 [message #19090 is a reply to message #19088] |
Thu, 24 February 2000 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Craig Markwardt (craigmnet@cow.physics.wisc.edu) writes:
> FORWARD_FUNCTION STRPOS, RSTRPOS
>
>> IF Float(!Version.Release) GT 5.2 THEN BEGIN
>> dot = StrPos(line, ".", /Reverse_Search)
>> ENDIF ELSE BEGIN
>> dot = RStrPos(line, ".")
>> ENDELSE
>>
>> Although that *seemed* like a good idea at the time,
>> I found that the line won't compile in versions of
>> IDL older than IDL 5.3. :-(
>
> The above FORWARD_FUNCTION declaration should solve your problems, no?
I don't think so, because the problem is the keyword. But
using JD's Call_Function gets around this with the compiler
because the program isn't compiled (which is when the number
of keywords is "attached" to the program module) until run-time.
And, anyway, I consider the use of FORWARD_FUNCTION to
be an admission of a program structure that is out of
control. Nothing against it, you just wouldn't find it
in any of my programs. :-)
Cheers,
David
P.S. I don't think I have the energy for another long
thread. Let's just write it off as one of my personal
quirks. :-)
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: rstrpos: version 5.2 and version 5.3 [message #19091 is a reply to message #19088] |
Thu, 24 February 2000 00:00  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
davidf@dfanning.com (David Fanning) writes:
> I resorted to this after first trying something like this:
>
FORWARD_FUNCTION STRPOS, RSTRPOS
> IF Float(!Version.Release) GT 5.2 THEN BEGIN
> dot = StrPos(line, ".", /Reverse_Search)
> ENDIF ELSE BEGIN
> dot = RStrPos(line, ".")
> ENDELSE
>
> Although that *seemed* like a good idea at the time,
> I found that the line won't compile in versions of
> IDL older than IDL 5.3. :-(
The above FORWARD_FUNCTION declaration should solve your problems, no?
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|
|
Re: rstrpos: version 5.2 and version 5.3 [message #19093 is a reply to message #19088] |
Thu, 24 February 2000 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
David Fanning (davidf@dfanning.com) writes:
> The problem is not that IDL doesn't like the function.
> The problem is that it doesn't like the new keyword:
>
> IDL> dot=call_function("StrPos",'coyote.dat',".",/Reverse_Search)
> % Keyword parameters not allowed in call.
> % Execution halted at: $MAIN$
Whoops! I think I missed the point. I didn't want it
to *execute*, I wanted it to compile. Back to the
testing phase...
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: rstrpos: version 5.2 and version 5.3 [message #19094 is a reply to message #19088] |
Thu, 24 February 2000 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
J.D. Smith (jdsmith@astro.cornell.edu) writes:
> IDL objects to the mentioning of a function it can't find. Simply use
> call_function and it can't complain (how can it object to a string?).
>
> IF Float(!Version.Release) GT 5.2 THEN $
> dot=call_function("StrPos",line,".",/Reverse_Search) $
> ELSE $
> dot=call_function("RStrPos",line, ".")
The problem is not that IDL doesn't like the function.
The problem is that it doesn't like the new keyword:
IDL> dot=call_function("StrPos",'coyote.dat',".",/Reverse_Search)
% Keyword parameters not allowed in call.
% Execution halted at: $MAIN$
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: rstrpos: version 5.2 and version 5.3 [message #19095 is a reply to message #19088] |
Thu, 24 February 2000 00:00  |
John-David T. Smith
Messages: 384 Registered: January 2000
|
Senior Member |
|
|
David Fanning wrote:
>
> J.D. Smith (jdsmith@astro.cornell.edu) writes:
>
>> It's there.
>>
>> You just need to add lib/obsolete under rsi/idl to your IDL search path, or,
>> equivalently, search all sub-paths of lib. I do this as a matter of course, to
>> ensure such things don't happen.
>
> Yes, or alternatively (this is what I decided to do recently),
> include the code in the source that uses it. I did this because
> I *know* people don't have the OBSOLETE directory on their
> path and I get tired of finding 10 e-mails in the morning
> asking why my programs don't work. :-(
>
> I resorted to this after first trying something like this:
>
> IF Float(!Version.Release) GT 5.2 THEN BEGIN
> dot = StrPos(line, ".", /Reverse_Search)
> ENDIF ELSE BEGIN
> dot = RStrPos(line, ".")
> ENDELSE
>
> Although that *seemed* like a good idea at the time,
> I found that the line won't compile in versions of
> IDL older than IDL 5.3. :-(
>
IDL objects to the mentioning of a function it can't find. Simply use
call_function and it can't complain (how can it object to a string?).
IF Float(!Version.Release) GT 5.2 THEN $
dot=call_function("StrPos",line,".",/Reverse_Search) $
ELSE $
dot=call_function("RStrPos",line, ".")
JD
--
J.D. Smith |*| WORK: (607) 255-5842
Cornell University Dept. of Astronomy |*| (607) 255-6263
304 Space Sciences Bldg. |*| FAX: (607) 255-5875
Ithaca, NY 14853 |*|
|
|
|
Re: rstrpos: version 5.2 and version 5.3 [message #19097 is a reply to message #19088] |
Thu, 24 February 2000 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
J.D. Smith (jdsmith@astro.cornell.edu) writes:
> It's there.
>
> You just need to add lib/obsolete under rsi/idl to your IDL search path, or,
> equivalently, search all sub-paths of lib. I do this as a matter of course, to
> ensure such things don't happen.
Yes, or alternatively (this is what I decided to do recently),
include the code in the source that uses it. I did this because
I *know* people don't have the OBSOLETE directory on their
path and I get tired of finding 10 e-mails in the morning
asking why my programs don't work. :-(
I resorted to this after first trying something like this:
IF Float(!Version.Release) GT 5.2 THEN BEGIN
dot = StrPos(line, ".", /Reverse_Search)
ENDIF ELSE BEGIN
dot = RStrPos(line, ".")
ENDELSE
Although that *seemed* like a good idea at the time,
I found that the line won't compile in versions of
IDL older than IDL 5.3. :-(
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: rstrpos: version 5.2 and version 5.3 [message #19098 is a reply to message #19097] |
Thu, 24 February 2000 00:00  |
John-David T. Smith
Messages: 384 Registered: January 2000
|
Senior Member |
|
|
Andy Loughe wrote:
>
> Hello,
>
> In their latest software upgrade, did RSI really
> throw away the RSTRPOS function and replace it with
> STRPOS(/REVERSE_SEARCH) ?
>
> Would they like to fix all the code I have that uses
> RSTRPOS? No... I'll go write my own RSTRPOS.pro, thank you,
> or replace *all* my RSTRPOS with STRPOS(/REVERSE_SEARCH).
>
> This kind of non-backwards compatability gives
> IDL a bad name... I hear the complaint very often
> from ex-IDL programmers.
>
It's there.
You just need to add lib/obsolete under rsi/idl to your IDL search path, or,
equivalently, search all sub-paths of lib. I do this as a matter of course, to
ensure such things don't happen.
JD
--
J.D. Smith |*| WORK: (607) 255-5842
Cornell University Dept. of Astronomy |*| (607) 255-6263
304 Space Sciences Bldg. |*| FAX: (607) 255-5875
Ithaca, NY 14853 |*|
|
|
|