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

Home » Public Forums » archive » Re: compiling before needing
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: compiling before needing [message #26579] Thu, 13 September 2001 12:38 Go to next message
David Fanning is currently offline  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 #26581 is a reply to message #26579] Thu, 13 September 2001 11:49 Go to previous messageGo to next message
Todd Clements is currently offline  Todd Clements
Messages: 23
Registered: January 2001
Junior Member
> (Although I have a feeling I'm going to hear about
> these reasons very soon now. :-)

Two words:

Legacy code.

Todd
Re: compiling before needing [message #26583 is a reply to message #26581] Thu, 13 September 2001 10:20 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Reimar Bauer (r.bauer@fz-juelich.de) writes:

> 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.
>
> I am not sure if I understand correctly.
>
> So I show an example

Reimar, sorry for the confusion. I didn't mean to disparage
your program at all. I'm sure it is useful. I was simply
following up Paul's tongue-in-cheek (I assume) comment with
one that was even more flippant.

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.

(Although I have a feeling I'm going to hear about
these reasons very soon now. :-)

Cheers,

David
--
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 #26585 is a reply to message #26583] Thu, 13 September 2001 08:57 Go to previous messageGo to next message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
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.
>
> Cheers,
>
> David
>
> --
> 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

I am not sure if I understand correctly.

So I show an example

x_def_colortable was compiled by this routine.
This widget has a lot of routines included in the file and a lot of
routines
called from different files.
It is used to set up colortables which are created as idl files. For
documentation
a png file of the colortable is saved too.

http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_source/idl_ html/dbase/download/x_def_colortable.sav

You can start this by idl -rt=x_def_colortable.sav

or you restore it by

IDL> restore,file='x_def_colortable.sav'
IDL> x_def_colortable

There is a function implemented x_def_colortable_info.

This shows you which routines are used and where they are from.

IDL> print,x_def_colortable_info()
x_def_colortable
Build Date: Mon Jul 9 16:46:09 2001
Compiled Procedures:
$MAIN$
AFORMAT /private/icglib/idl_source/idl_html/dbase/download/plotxy.sa v
Mon Jul 9 13:54:46 2001
ALT_INHALT_DEF
/private/icglib/idl_source/idl_html/dbase/download/plotxy.sa v Mon Jul 9
13:54:46 2001
BUILD_STRUCTURE
/private/icglib/idl_source/idl_html/dbase/download/pl_init.s av Mon Jul
9 13:52:14 2001
BUILD_VECTOR
/private/icglib/idl_source/idl_html/dbase/download/syst2inf. sav Mon Jul
9 16:20:53 2001
CACHE /private/icglib/idl_source/idl_html/dbase/download/plotxy.sa v Mon
Jul 9 13:54:46 2001
COLOR_SCHEME
/private/icglib/idl_source/idl_html/dbase/download/plotinit. sav Mon Jul
9 13:53:11 2001
CT_BLUE /private/icglib/idl_source/idl_html/dbase/download/plotinit. sav
Mon Jul 9 13:53:11 2001
CT_BLUE_GREEN_YELLOW_RED
/private/icglib/idl_source/idl_html/dbase/download/plotinit. sav Mon Jul
9 13:53:11 2001
CT_BLUE_RED
/private/icglib/idl_source/idl_html/dbase/download/plotinit. sav Mon Jul
9 13:53:11 2001
.
.
.

X_DEF_COLORTABLE
/private/icglib/idl_source/idl_work/rb_lib/x_def_colortable. pro Tue Jun
19 12:52:22 2001
X_DEF_COLORTABLE_EVENT
/private/icglib/idl_source/idl_work/rb_lib/x_def_colortable. pro Tue Jun
19 12:52:22 2001
X_DEF_COLORTABLE_EVENT_BLUE
/private/icglib/idl_source/idl_work/rb_lib/x_def_colortable. pro Tue Jun
19 12:52:22 2001
X_DEF_COLORTABLE_EVENT_GREEN
/private/icglib/idl_source/idl_work/rb_lib/x_def_colortable. pro Tue Jun
19 12:52:22 2001
X_DEF_COLORTABLE_EVENT_RED
/private/icglib/idl_source/idl_work/rb_lib/x_def_colortable. pro Tue Jun
19 12:52:22 2001
X_DEF_COLORTABLE_SHOW_COLORS
/private/icglib/idl_source/idl_work/rb_lib/x_def_colortable. pro Tue Jun
19 12:52:22 2001
X_DEF_COLORTABLE_SHOW_ONE_COLOR
/private/icglib/idl_source/idl_work/rb_lib/x_def_colortable. pro Tue Jun
19 12:52:22 2001


...

The compile routine compiles every routine it founds.

Normally this routine did not need all the routines which are included
in the binary. At the moment I don't
know how to distinguish between routines which are necessary and all
others.
But the routine makes it very easy to create binary files and as you see
it is possible to concatinate
several binary files in a new one.



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 #26586 is a reply to message #26585] Thu, 13 September 2001 08:31 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
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.

Cheers,

David

--
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 #26587 is a reply to message #26586] Thu, 13 September 2001 07:44 Go to previous messageGo to next message
Paul van Delst is currently offline  Paul van Delst
Messages: 364
Registered: March 1997
Senior Member
Reimar Bauer wrote:
>
> 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.

Umm.... huh?

What about sticking procedures/functions in their own files.

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 #26592 is a reply to message #26587] Thu, 13 September 2001 00:43 Go to previous messageGo to next message
R.Bauer is currently offline  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 Go to previous messageGo to next message
Todd Clements is currently offline  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 #26613 is a reply to message #26597] Tue, 11 September 2001 01:50 Go to previous messageGo to next message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
Lasse Clausen wrote:
>
> Greetings!
>
> 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
>
> Thanks
> Lasse Clausen

.compile routine.pro
resolve_all



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 #26694 is a reply to message #26585] Tue, 18 September 2001 07:14 Go to previous message
Paul van Delst is currently offline  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 Go to previous message
Craig Markwardt is currently offline  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 Go to previous message
Todd Clements is currently offline  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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Calling LAPACK from IDL
Next Topic: previous and last

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

Current Time: Fri Oct 10 10:53:59 PDT 2025

Total time taken to generate the page: 2.48334 seconds