Re: Errors when compiling routines with main-level programs [message #90333 is a reply to message #90332] |
Sat, 21 February 2015 11:52   |
PMan
Messages: 61 Registered: January 2011
|
Member |
|
|
Look into the STATIC keyword - you can create an object that has a bunch of static functions that should address your problem.
On Saturday, February 21, 2015 at 10:53:12 AM UTC-5, Matthew Argall wrote:
> I have adopted the practice of putting main-level programs below utility functions to demonstrate their use. The problem is, only one such routine can be compiled manually at a time, and it must come at the end of the compile list. It can get pretty annoying. Here is a simple example:
>
> IDL> .compile uniq, mruniq
> % Compiled module: UNIQ.
> % Compiled module: MRUNIQ.
> % Compiled module: $MAIN$.
>
>
> IDL> .compile mruniq, uniq
> % Compiled module: MRUNIQ.
> % Compiled module: $MAIN$.
> % End of file encountered before end of program. File: mruniq.pro
>
> function UNIQ, ARRAY, IDX
> ^
> % Procedure header must appear first and only once: UNIQ
> At: /Applications/exelis/idl82/lib/uniq.pro, Line 68
>
> if (s[0] eq 0) then return, 0 ;A scalar
> ^
> % Return statement in procedures can't have values.
> At: /Applications/exelis/idl82/lib/uniq.pro, Line 73
>
> else return, n_elements(q)-1
> ^
> % Return statement in procedures can't have values.
> At: /Applications/exelis/idl82/lib/uniq.pro, Line 78
>
> else return, n_elements(q)-1
> ^
> % Return statement in procedures can't have values.
> At: /Applications/exelis/idl82/lib/uniq.pro, Line 78
>
> else return, n_elements(ARRAY)-1
> ^
> % Return statement in procedures can't have values.
> At: /Applications/exelis/idl82/lib/uniq.pro, Line 82
>
> else return, n_elements(ARRAY)-1
> ^
> % Return statement in procedures can't have values.
> At: /Applications/exelis/idl82/lib/uniq.pro, Line 82
> % 6 Compilation error(s) in module $MAIN$.
>
>
>
>
> Is there a fix for this? Or should I not be putting main-level programs at the end of functions and procedures?
|
|
|