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

Home » Public Forums » archive » Re: manipulate ouput keywords
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
Re: manipulate ouput keywords [message #79560] Tue, 13 March 2012 11:47
natha is currently offline  natha
Messages: 482
Registered: October 2007
Senior Member
This is exactly what I was looking for ! ^^
Thank you Mike !

nata
Re: manipulate ouput keywords [message #79561 is a reply to message #79560] Tue, 13 March 2012 11:01 Go to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 3/13/12 9:18 AM, nata wrote:
> I already knew all of that.. Maybe I didn't explain my problem properly.
>
> My keywords are output keywords, so _EXTRA is not a structure with one field for each keyword, is undefined in the procedure TEST.
> I can't use SCOPE_VARFECTH with an undefined keyword name.

No, but _REF_EXTRA gives you the names.

> I don't know, maybe there is no way to solve this problem.. Any other ideas ?
> nata

Is this what you want to do?

IDL> test, out1=out1, out2=out2
Keyword name: OUT1
Input value:
<No name> UNDEFINED = <Undefined>
Keyword name: OUT2
Input value:
<No name> UNDEFINED = <Undefined>
IDL> help, out1, out2
OUT1 LONG = 0
OUT2 LONG = 1

Here's my routine:

pro test, _ref_extra=e
compile_opt strictarr

for i = 0L, n_elements(e) - 1L do begin
print, e[i], format='(%"Keyword name: %s")'
print, 'Input value:'
help, scope_varfetch(e[i], /ref_extra)
(scope_varfetch(e[i], /ref_extra)) = i
endfor
end

Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL, A Guide to Learning IDL: http://modernidl.idldev.com
Research Mathematician
Tech-X Corporation
Re: manipulate ouput keywords [message #79562 is a reply to message #79561] Tue, 13 March 2012 08:18 Go to previous message
natha is currently offline  natha
Messages: 482
Registered: October 2007
Senior Member
I already knew all of that.. Maybe I didn't explain my problem properly.

My keywords are output keywords, so _EXTRA is not a structure with one field for each keyword, is undefined in the procedure TEST.
I can't use SCOPE_VARFECTH with an undefined keyword name.

I don't know, maybe there is no way to solve this problem.. Any other ideas ?
nata
Re: manipulate ouput keywords [message #79563 is a reply to message #79562] Tue, 13 March 2012 07:47 Go to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
The extra variable is made differently when you use _ref_extra or just _extra. If you use _extra, it is a structure with one field for each keyword. But if _ref_extra is used, it is an array of keyword names. The values would have to be accessed with scope_varfetch using its /ref_extra keyword.

This is described in the "Keyword Inheritance" section of the help, though it does have something wrong:

"variable e, within TEST, contains an anonymous structure with the value:

[ ‘LINESTYLE‘, ‘THICK‘ ]"

Where the variable is a string array, not a structure.

On Tuesday, March 13, 2012 11:05:19 AM UTC-3, nata wrote:
> Hello guys,
>
> I am developing a library and I am completely lost in something that I don't know if it's possible to do.
> My problem is related to the output keywords that some routines can have. What I am trying to do is to collect those keywords using the extra or ref_extra keyword and return the correct output value to the caller.
>
> I don't know if this is clear but see the example below:
>
> IDL> TEST, OUT1=out1, OUT2=out2
>
> PRO TEST, _REF_EXTRA=extra
>
> ;; My routine should be able to return the values for out1 and out2
> ;; without knowing the keyword names, is that possible ?
>
> END
>
> I tried with something like extra={OUT1: 1, OUT2: 2} but the caller does not receive the information properly.
>
> Please, any help will be appreciated,
> nata
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: 4D data plot
Next Topic: Onscreen digitizing routine

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

Current Time: Wed Oct 08 19:01:51 PDT 2025

Total time taken to generate the page: 0.00565 seconds