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

Home » Public Forums » archive » Dumb Dumb Question
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
Dumb Dumb Question [message #13571] Tue, 17 November 1998 00:00 Go to next message
rosentha is currently offline  rosentha
Messages: 23
Registered: November 1994
Junior Member
This may be really stupid, but is there a way around the following
feature:

pro x_test,x=x,x2=x2
if n_elements(x) ne 0 then print, 'x=',x
if n_elements(x2) ne 0 then print, 'x2=',x2
end

when I run it with
> x_test,x=1
I get
% Ambiguous keyword abbreviation: X.
% Execution halted at: $MAIN$

Does this mean no IDL procedure will ever work if one keyword is a left
substring of another keyword? Can I force IDL to interpret the "x" as "x"
and not an ambiguous abbreviation for "x2"?

--
Colin Rosenthal
High Altitude Observatory
Boulder, Colorado
rosentha@hao.ucar.edu
Re: Dumb Dumb Question [message #13608 is a reply to message #13571] Tue, 24 November 1998 00:00 Go to previous message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
Colin Rosenthal wrote:

> This may be really stupid, but is there a way around the following
> feature:
>
> pro x_test,x=x,x2=x2
> if n_elements(x) ne 0 then print, 'x=',x
> if n_elements(x2) ne 0 then print, 'x2=',x2
> end
>
> when I run it with
>> x_test,x=1
> I get
> % Ambiguous keyword abbreviation: X.
> % Execution halted at: $MAIN$
>
> Does this mean no IDL procedure will ever work if one keyword is a left
> substring of another keyword? Can I force IDL to interpret the "x" as "x"
> and not an ambiguous abbreviation for "x2"?
>

Both yes:

But you can use a little trick like that:

FUNCTION is_tag,struct,tag_name
tagname=STRUPCASE(tag_name)
tags=TAG_NAMES(struct)
a=WHERE(tags EQ tagname,count)
RETURN, count
END


pro x_test,_extra=pkey
if is_tag(pkey,'x')then print, 'x=',pkey.x
if is_tag(pkey,'x2') ne 0 then print, 'x2=',pkey.x2
end


R Bauer
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Suppress return with readf ?
Next Topic: IDL Licenses for NT

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

Current Time: Wed Oct 08 13:59:35 PDT 2025

Total time taken to generate the page: 0.00392 seconds