Re: compiling before needing [message #26579] |
Thu, 13 September 2001 12:38  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Todd Clements (mole6e23@hotmail.com) writes:
>> (Although I have a feeling I'm going to hear about
>> these reasons very soon now. :-)
>
> Two words:
>
> Legacy code.
Ah, yes. "The sins of the fathers ...", etc.
Cheers,
David
P.S. Let's just say I've never heard of a reason
*besides* a "lousy office mate/programmer" for
compiling IDL code. :-)
--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
|
|
|
|
|
Re: compiling before needing [message #26592 is a reply to message #26587] |
Thu, 13 September 2001 00:43   |
R.Bauer
Messages: 1424 Registered: November 1998
|
Senior Member |
|
|
Todd Clements wrote:
>
>> My programm consists of several functions and procedures in
>> corresponding files. Is there a way of automatically compiling all files
>> (functions/procedures) before they are needed
>
> Reimar is right - just stick a resolve_all at the beginning of the
> function that is called, and IDL will resolve all routines.
>
> I've also written a routine that will do this much, much more manually
> (which isn't what you wanted, but I thought I'd share anyway). It will
> let you check if a routine is compiled and you can optionally force it
> to compile. The /compile keyword will compile it if it's not already
> compiled, and the /force_compile keyword will compile it even if it's
> already compiled. The function returns 1 if the routine is compiled and
> 0 if it is not.
>
> Todd
>
In addition to Todd here is a routine to compile all routines used
in a routine and the routine itself. The result is saved as idl Routine
sav file.
If it is a procedure it could be started with idl runtime.
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_source/idl_ html/dbase/download/compile.tar.gz
IDL> compile,'str_sep'
A routine which finds a lot of information of routines used by one
routine is helpon.
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_source/idl_ html/dbase/download/helpon.tar.gz
look for routine definition
IDL> helpon,str_sep
function str_sep, str, separator, remove_all = remove_all, trim = trim,
esc=esc
IDL> helpon,str_sep ,/info
STR_SEP /usr/local/idl/idl/lib/obsolete/str_sep.pro 2000-09-26
15:08:07
IDL> helpon,get_dir ,/info
FILE_EXIST
/usr/local/icg/icg/idl_source/idl_links/file_exist.pro
2001-06-22 09:44:02
GET_DIR
/usr/local/icg/icg/idl_source/idl_work/rb_lib/get_dir.pro
2001-06-14 16:02:32
REPLACE_STRING
/usr/local/icg/icg/idl_source/idl_links/replace_string.pro
2001-02-13 16:08:30
STR_SEP
/usr/local/idl/idl/lib/obsolete/str_sep.pro
2000-09-26 15:08:07
GET_TEMPLATE_ONE_VALUE
/usr/local/icg/icg/idl_source/idl_links/get_template_one_val ue.pro
2000-08-17 10:40:08
BUILD_VECTOR
/usr/local/icg/icg/idl_source/idl_links/build_vector.pro
2000-06-18 08:07:48
CALL_HELP
/usr/local/icg/icg/idl_source/idl_links/call_help.pro
1999-11-06 16:44:28
This routine helps us often to find out which routine was last changed
and where it comes from.
There are some more keywords.
regards
Reimar
--
Reimar Bauer
Institut fuer Stratosphaerische Chemie (ICG-1)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
http://www.fz-juelich.de/icg/icg1/
============================================================ ======
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml
http://www.fz-juelich.de/zb/text/publikation/juel3786.html
============================================================ ======
read something about linux / windows
http://www.suse.de/de/news/hotnews/MS.html
|
|
|
Re: compiling before needing [message #26597 is a reply to message #26592] |
Wed, 12 September 2001 14:54   |
Todd Clements
Messages: 23 Registered: January 2001
|
Junior Member |
|
|
> My programm consists of several functions and procedures in
> corresponding files. Is there a way of automatically compiling all files
> (functions/procedures) before they are needed
Reimar is right - just stick a resolve_all at the beginning of the
function that is called, and IDL will resolve all routines.
I've also written a routine that will do this much, much more manually
(which isn't what you wanted, but I thought I'd share anyway). It will
let you check if a routine is compiled and you can optionally force it
to compile. The /compile keyword will compile it if it's not already
compiled, and the /force_compile keyword will compile it even if it's
already compiled. The function returns 1 if the routine is compiled and
0 if it is not.
Todd
;-----------------------
function is_routine_compiled, routineName, compile=compile,$
force_compile=force_compile
compile_opt idl2
if( typeof( routineName ) ne 7 ) then begin
print, 'Must pass string to is_routine_compiled'
return, 0
endif
rn = strupcase( routineName )
a = routine_info()
a = [a, routine_info(/functions)]
junk = where( a eq rn )
if( junk[0] ne -1 ) then begin
;; We may have found it, but it may not be resolved
a = routine_info(/unresolved)
a = [a, routine_info( /unresolved, /functions )]
junk = where( a eq rn )
if( junk[0] ne -1 ) then junk = -1 else junk = 1
endif
if( junk[0] eq -1 or keyword_set(force_compile) ) then begin
if( keyword_set( compile ) or $
keyword_set( force_compile )) then begin
resolve_routine, rn, /compile_full_file, /either
return, is_routine_compiled(rn)
endif else return, 0
endif else return, 1
end ;;is_routine_compiled
|
|
|
|
Re: compiling before needing [message #26694 is a reply to message #26585] |
Tue, 18 September 2001 07:14  |
Paul van Delst
Messages: 364 Registered: March 1997
|
Senior Member |
|
|
> David Fanning wrote:
>>
>> Paul van Delst (paul.vandelst@noaa.gov) writes:
>>
>>> Umm.... huh?
>>>
>>> What about sticking procedures/functions in their own files.
>>
>> Too easy. Not a programmer's solution.
Hmm. Maybe. Then again, it never ceases to amaze me at the complexity people introduce into
their lives in the hope that it will simplify things. Oi Vey.
paulv
--
Paul van Delst Religious and cultural
CIMSS @ NOAA/NCEP purity is a fundamentalist
Ph: (301)763-8000 x7274 fantasy
Fax:(301)763-8545 V.S.Naipaul
|
|
|
Re: compiling before needing [message #26722 is a reply to message #26583] |
Thu, 13 September 2001 14:24  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
David Fanning <david@dfanning.com> writes:
> My point was only that when people ask about compiling
> IDL programs, *most* of the time (and there have been
> one or two exceptions in my 12 years of monitoring this
> newsgroup) they are completely misunderstanding how IDL
> works.
>
> I've never compiled an IDL program in my life, unless
> I was making a run-time IDL application. But I am
> *certain* there are good reasons for it. I've just
> never encountered them in my limited experience.
I have an analysis package for analyzing satellite X-ray astronomy
data, which is composed of more than 150 procedures and functions. At
some point it just became too cumbersome and inconvenient to have all
of them compiled on the fly, not to mention the eyesore of all those
"% Compiled: XXXXX." messages.
So I bundle them all up into a single save file. Then I have a
"preload" function which restores the functions from the save file [
the function is smart enough to check the date on the file and only
restores if a newer one is on disk. ]
This only works because I have a script to recompile everything
overnight. Otherwise, I agree it's a pain in the butt.
On the other hand, with newer versions of IDL I can see that you can
remove the "% Compiled" messages, and with faster computers the
compile is less of an issue. I guess I'm stuck in the past.
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|
Re: compiling before needing [message #26723 is a reply to message #26579] |
Thu, 13 September 2001 14:26  |
Todd Clements
Messages: 23 Registered: January 2001
|
Junior Member |
|
|
>> Legacy code.
>
> Ah, yes. "The sins of the fathers ...", etc.
> P.S. Let's just say I've never heard of a reason
> *besides* a "lousy office mate/programmer" for
> compiling IDL code. :-)
When I was first learning IDL, I was learning from the people around me,
and I didn't even REALIZE for a long time that IDL could compile code
all by itself such was the situation around here. I've spent days of my
life re-writing old code. There are only two programs that we still have
to compile manually. I'm working on it, but those compilation routines
come in handy until then.
Todd
|
|
|