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

Home » Public Forums » archive » Re: External c calls broken in IDL 5.5
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
New version of DLMFORM [Re: External c calls broken in IDL 5.5] [message #32116 is a reply to message #31985] Tue, 10 September 2002 12:11 Go to previous messageGo to previous message
Stein Vidar Hagfors H[1] is currently offline  Stein Vidar Hagfors H[1]
Messages: 56
Registered: February 2000
Member
Bob <b_o_b_1962@nospam.yahoo.com> writes:

[....]

> Well, the calls to IDL_AddSystemRoutine in IDL_Load is obsolete and
> should be replaced with IDL_SysRtnAdd which uses IDL_SYSFUN_DEF2
> structure instead of the IDL_SYSFUN_DEF structure (I think this
> changed in IDL 5.4 but am not sure). However, it does still work
> the way you have it.

The new version corrects this, using IDL_SysRtnAdd for version > 5.3
(which, according to my edg.pdf is the version that obsoleted the
other one).

> A bigger problem I have is that the array dimensions for output
> arrays are usually off by one in the c-code generated by dlmform
> when there is an array in the fortran code.

Fixed...

[...]
> subroutine test(x,y,n)
> integer n
> real x(n), y(n)
> do i=1,n
> y(i) = x(i)*x(i)
> enddo
> end

However, I'd like to comment on this example (although it is obviously
a trivialized one), that the same [better!] functionality can be
written as

real function test(x)
real x
test = x*x
end

Instead of saying e.g.

TEST,X,Y,N_ELEMENTS(X)

you can now (thanks to the automatic arrayification of scalar
routines) say

Y = TEST(X)

If you prefer procedures to functions, a scalar "subroutine test(x,y)"
would do the trick, so you could say "TEST,X,Y".

In more complex, general cases, when (some) input and output arrays
have the same dimensionality, it's almost trivial to use the input
dimensionality directly, editing out the extra variable being passed
(N).

> And last, I'll ask you this since you seem to know you way around. Is it
> possible to catch errors in the fortran code so that one ends up at the IDL
> prompt instead of core dumping IDL?

Not unless you can tell me how to catch those errors in fortran! (I
don't believe fortran has exceptions...).

I've also done some other changes to the program, among other things
it will no longer create [core-dumping] functions trying to return
complex values (instead, a warning & no function). Pick it up at

http://www.astro.uio.no/~steinhh/idl/dlmform.html

--
------------------------------------------------------------ --------------
Stein Vidar Hagfors Haugan
ESA SOHO SOC/European Space Agency Science Operations Coordinator for SOHO

NASA Goddard Space Flight Center, Email: shaugan@esa.nascom.nasa.gov
Mail Code 682.3, Bld. 26, Room G-1, Tel.: 1-301-286-9028/240-354-6066
Greenbelt, Maryland 20771, USA. Fax: 1-301-286-0264
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: IDL Primer
Next Topic: Re: CW_Animate procedure...

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

Current Time: Wed Oct 08 19:27:41 PDT 2025

Total time taken to generate the page: 0.00206 seconds