[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Multiple values from a function?
Craig Markwardt wrote:
>
> "J.D. Smith" <jdsmith@astro.cornell.edu> writes:
> >
> > void=routine_names('a',STORE=-1,val)
> >
> > Lions and tigers and bears, oh my!
>
> Pay no attention to the man behind the curtain! I still say this
> doesn't work for most cases, at least under Unix. The following is a
> simple transcript to test thes, which shows how ROUTINE_NAMES crashes
> when A is undefined, but works when A is defined. In every case that
> I tried (as noted below), the variable A needs to be defined at the
> calling level *first* before ROUTINE_NAMES(STORE=) will work.
>
> It could be that this works under v5.3, or on Windows. I don't know
> since we don't have those versions around here.
>
> Craig
>
> IDL> .run
> pro testset, name
> void = routine_names(name,store=-1,findgen(10))
> end
> % Compiled module: TESTSET.
>
> IDL> testset, 'a' ;; A is undefined here, and it doesn't work
> % ROUTINE_NAMES: Variable is undefined: a.
> % Execution halted at: TESTSET 2 /dev/tty
> % $MAIN$
> IDL> retall
> IDL> a = 1
> IDL> testset, 'a' ;; Now A is defined and it works.
> IDL> help, a
> A FLOAT = Array[10]
>
> IDL> print, !version
> { x86 linux unix 5.2.1 Jun 4 1999}
> { alpha OSF unix 5.2 Oct 30 1998}
> { x86 linux unix 5.1 Apr 13 1998}
> { alpha OSF unix 5.0 Apr 28 1997}
> { alpha OSF unix 4.0.1}
IDL> testset,'a'
IDL> print,a
0.00000 1.00000 2.00000 3.00000 4.00000 5.00000
6.00000 7.00000 8.00000 9.00000
IDL> print,!VERSION
{ x86 linux unix 5.3 Nov 11 1999}
You just need the new magic wand, version 5.3.
JD
--
J.D. Smith /*\ WORK: (607) 255-6263
Cornell University Dept. of Astronomy \*/ (607) 255-5842
304 Space Sciences Bldg. /*\ FAX: (607) 255-5875
Ithaca, NY 14853 \*/