Re: DLM keyword processing [message #41235] |
Thu, 14 October 2004 06:23 |
Haje Korth
Messages: 651 Registered: May 1997
|
Senior Member |
|
|
Ok, never mind, I finally found the bug: I forgot to add the line
if (kw.tilt) IDL_StoreScalar(kw.tilt,IDL_TYP_DOUBLE,&itilt);
to my code. For some reason IDL is also really picky about where this has to
appear. Well, for some magical reason it works now. But this magic is
exactly why I will always prefer Fortran over C: C just controls me while I
can control Fortran. :-)
Haje
"Haje Korth" <noemail@address.com> wrote in message
news:cklpcc$elo$1@aplcore.jhuapl.edu...
> Good morning everyone,
>
> I am working on a DLM project and have some trouble with the keyword
> processing. Below is the relevant code that results in my problem, which
is:
> I want to call the routine from IDL as "geopack_recalc,tilt=xxx", so that
> xxx=999.0d on exit. This works fine if I define xxx before the call (e.g.,
> xxx=0). Is there a way to avoid having to define xxx before the call? This
> is an output keyword only, so there should not be a need to set the
variable
> before the call. Does anyone know how to do this?
>
> Thanks for your help,
>
> Haje
>
>
>
> void IDL_CDECL geopack_recalc(int argc, IDL_VPTR argv[], char *argk)
>
> {
>
> extern init;
>
> typedef struct {
>
> IDL_KW_RESULT_FIRST_FIELD;
>
> IDL_VPTR tilt;
>
> } KW_RESULT;
>
> static IDL_KW_PAR kw_pars[] = { IDL_KW_FAST_SCAN,
>
> {"TILT" ,IDL_TYP_UNDEF,1,IDL_KW_OUT|IDL_KW_ZERO,0,IDL_KW_OFFSETOF(ti lt)},
>
> {NULL}
>
> };
>
> KW_RESULT kw;
>
> double tilt;
>
> IDL_ALLTYPES itilt;
>
> IDL_KWProcessByOffset(argc,argv,argk,kw_pars,0,1,&kw);
>
> tilt=999.0;
>
> if (kw.tilt) {
>
> itilt.d=tilt;
>
> IDL_StoreScalar(kw.tilt, IDL_TYP_DOUBLE, &itilt);
>
> }
>
> init=1;
>
> IDL_KW_FREE;
>
> }
>
>
|
|
|