[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Which like command for IDL?




I hate to be a one tune band, but the best way I have of doing this kind
of shadow mapping (finding files defining procedures which shadow each
other), is with IDLWAVE.  Why is this superior to anything offered
internally in IDL?  

For one, it doesn't need IDL!  It uses it's own notion of IDL builtins,
system library files (the ones in !DIR/lib), and the user catalog it
scanned.  If IDL is running in the shell, it also queries it for all
routine info.  Since I've scanned into my catalog almost everything on
!PATH (IDLWAVE makes it trivial), I can easily see which files define a
procedure.  I can even do a full shadow scan of the entire system, or
all routines in the current buffer, or all routines compiled in the
shell.  

The most trivial way to see multiple sources, however, is with routine
info (which you'll probably be using for other things all the time
anyway).  For instance, here's the routine info (invoked via [C-c ?]
when near a pro/func), for print, which I've unwisely redefined several
times:

Usage:    PRINT [, Expr1, ..., Exprn]
Keywords: AM_PM DAYS_OF_WEEK FORMAT MONTHS REWRITE STDIO_NON_FINITE
Sources:  - Builtin   
          - Other       [-SB] ~/foo.pro
          - Library     [C--] ~/idl/scrap/print.pro
          - Library     [C--] ~/idl/scrap/printf.pro


We see 4 sources, in order of likelihood of usage.  Here, the built-in
print is always used. You can't override it.  Then we have a file
foo.pro in a buffer I'm visiting (the B), which has a version of "print"
compiled in the shell (S) (will I never learn).  Then there's a pair of
"Library" files (which just means they're in !PATH), which have been
scanned and put into my catalog "C".

What about something you can override?  How about one of the !DIR/lib
procedures which comes with IDL?  Here's an example shadow listing for
one of those (notice it's the same as routine info, but without the
usage/keyword stuff).

ValidateManagedWidgets
   - SystemLib   [C--] /usr/local/rsi/idl/lib/xmanager.pro
   - Library     [C--] ~/idl/scrap/xmanager.pro

So, I've redefined ValidateManagedWidgets somewhere, but ~/idl comes
after !DIR/lib on the !PATH, so it won't ever be automatically
compiled.  How cheeky.  

You get the idea.  You can also find out interesting things about your
path ordering, like:

CW_COLOR_INDEXE()
   - Obsolete    [C--] /usr/local/rsi/idl/lib/obsolete/pwidget.pro
   - SystemLib   [C--] /usr/local/rsi/idl/lib/cw_clr_index.pro

I.e. this file defines cw_color_indexe in obsolete, and is on the path
before cw_clr_index.  Which one gets called depends on which one of
these .pro's gets compiled, but if the first is compiled before the
second, that's a silent routine shadow... watch out.

Oh by the way, middle clicking on any of the .pro's listed above would
take you immediately to the routine definition in the source code, so
you can see for yourself with no fuss why you thought you'd override
print, for instance.

Good luck,

JD