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

Home » Public Forums » archive » Re: Pre-processor-like Capability?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Pre-processor-like Capability? [message #6416 is a reply to message #6405] Thu, 13 June 1996 00:00 Go to previous messageGo to previous message
dave is currently offline  dave
Messages: 31
Registered: February 1994
Member
>>>> > "Bruce" == Bruce E Thomason <brucet@hsonline.net> writes:

Bruce> Does anyone know of a IDL/PV-Wave capability that is
Bruce> analogous to C's preprocessor?

Bruce> I am particularly interested in efficiently establishing
Bruce> symbolic references (in the coding process) to constant
Bruce> values for use across many routines (as #define does w/ the
Bruce> C pre-processor), but to have these values efficiently
Bruce> accessed at run-time.


I create small functions at the beginning of the source that return the
desired values:

FUNCTION magic_number
return 'boing'
END

PRO whatever, x, y, z
. . .
IF a NE magic_number THEN BEGIN
print, "Bad Magic"
return, 0
ENDIF
. . .
END


This is portable, can be included in one source file, and used in
another, and is almost as simple as a #define. It's a good idea to
use a FORWARD_FUNCTION declaration to declare all such functions at
the beginning of a procedure, in case the definition is in another
file.

Performace won't suffer unless your code is highly looped, in which
case you chould probably be linking in a C for FORTRAN module anyway.

Good luck,

David.
--
David Fenyes University of Texas Medical School
dave@msrad72.med.uth.tmc.edu Dept. of Radiology
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: New software that supports IDL!
Next Topic: Searching for Constraint Optimization IDL Routine

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

Current Time: Fri Oct 10 07:43:30 PDT 2025

Total time taken to generate the page: 1.51593 seconds