Call_function [message #7716] |
Fri, 27 December 1996 00:00 |
Phil Williams
Messages: 78 Registered: April 1996
|
Member |
|
|
I have a routine that uses call_function to execute a function of the
users choice. Is there a way using the _EXTRA keyword that I can passed
named variables? I'm pretty sure of the answer, but figured I'd give it
a shot anyway.
Here's an example:
---------------------
function test, func, data, _extra = extra
extraFlag = keyword_set(extra)
if extraflag then result = call_function(func, data, _extra = extra) $
else result = call_function(func, data)
return, result
end
--------------------
IDL> foo = min(slice(index), max = max)
IDL> print,foo,max
73 192
IDL> bar = test('min', slice(index), max = max)
% MIN: Expression must be named variable in this context: <BYTE (
192)>.
% Execution halted at: TEST 5 test.pro
% $MAIN$
IDL> retall
IDL> bar = test('min', slice(index))
IDL> print,bar
73
Everything works fine as long as keywords aren't used for parameter
passing.
If anyone has a work around or an idea I'd appreciate it.
Thanks in advance,
Phil
--
/*********************************************************** ********/
Phil Williams, Ph.D.
Research Instructor
Children's Hospital Medical Center "One man gathers what
Imaging Research Center another man spills..."
3333 Burnet Ave. -The Grateful Dead
Cincinnati, OH 45229
email: williams@irc.chmcc.org
URL: http://scuttle.chmcc.org/~williams/
/*********************************************************** ********/
|
|
|