Re: C/C++ conversion to IDL [message #44201] |
Tue, 31 May 2005 10:16  |
Matt Feinstein
Messages: 33 Registered: July 2002
|
Member |
|
|
On 29 May 2005 03:13:06 -0700, nasalmon@onetel.net.uk wrote:
> Would anybody know if there is there software available to convert
> programs in C into IDL (i know you can link in C programs to running
> under IDL)? However, i am more interested in getting shorter, more
> transparent code which is easier to work with. I obviously want the
> minimum of hassel in converting the C code into IDL, so i dont want to
> trawl through this myself converting it.
Syntax aside, the unsovable problem in translating X to Y, where X and
Y may be Pascal, C, IDL, Matlab, Python, Fortran or what-have-you, is
the library of functions available in each language. They all do (more
or less) the same things, but they all do the same things a little
differently.
Matt Feinstein
--
There is no virtue in believing something that can be proved to be true.
|
|
|
Re: C/C++ conversion to IDL [message #44203 is a reply to message #44201] |
Tue, 31 May 2005 08:57   |
Michael Wallace
Messages: 409 Registered: December 2003
|
Senior Member |
|
|
Craig Markwardt wrote:
> nasalmon@onetel.net.uk writes:
>
>> Would anybody know if there is there software available to convert
>> programs in C into IDL (i know you can link in C programs to running
>> under IDL)? However, i am more interested in getting shorter, more
>> transparent code which is easier to work with. I obviously want the
>> minimum of hassel in converting the C code into IDL, so i dont want to
>> trawl through this myself converting it.
>
>
> I've always done it painstakingly, by hand. Usually I do a as direct
> a translation as possible, word for word, line for line. FORTRAN is
> the best for this since FORTRAN and IDL are more similar (than say, C
> and IDL). After that, I look for optimization opportunities.
I don't think there are any translation tools available. Even some of
the simplest C code can do crazy things with memory access, pointers,
shared libraries, etc. It'd be really hard to write a program that
could handle things beyond the basics and make a decent translation from
C to IDL. It'd be hard enough to write a decent C compiler. In this
case the compiler output would be IDL code rather than a binary, but I
digress. The best approach is to painstakingly and thoroughly translate
the code line by line as has already been said. With this you should
have an IDL program that works. Then go back and take care of
optimizations.
-Mike
|
|
|
Re: C/C++ conversion to IDL [message #44212 is a reply to message #44203] |
Mon, 30 May 2005 01:18   |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
nasalmon@onetel.net.uk writes:
> Would anybody know if there is there software available to convert
> programs in C into IDL (i know you can link in C programs to running
> under IDL)? However, i am more interested in getting shorter, more
> transparent code which is easier to work with. I obviously want the
> minimum of hassel in converting the C code into IDL, so i dont want to
> trawl through this myself converting it.
I've always done it painstakingly, by hand. Usually I do a as direct
a translation as possible, word for word, line for line. FORTRAN is
the best for this since FORTRAN and IDL are more similar (than say, C
and IDL). After that, I look for optimization opportunities.
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|
Re: C/C++ conversion to IDL [message #44338 is a reply to message #44201] |
Sun, 05 June 2005 05:07  |
nasalmon
Messages: 33 Registered: August 2003
|
Member |
|
|
Many thanks for your useful comments.
Basically i wanted to increase the speed of my IDL programs by calling
certain time consuming modules compled in C or C++. I do a lot of
calling of routines recursively and working with binary trees.
Would there be any prefererence for C or C++, as i am not really that
familar with either and dont really have the time to learn one and
realise later that the other one is more appropriate?
Neil
|
|
|