Re: Making help for your own functions & procedures [message #982 is a reply to message #860] |
Fri, 16 April 1993 15:17   |
knight
Messages: 37 Registered: January 1992
|
Member |
|
|
A recent thread (repeated below) concerns making help for your own functions.
Here's what I do. On all functions and procedures I include a keyword help,
which, when set, triggers doc_library to print the header. For example,
IDL> legend,/help
% Compiled module: LEGEND.
% Compiled module: DOC_LIBRARY.
% Compiled module: DL_UNIX.
----- Documentation for /usr/local/idl/lib/local/legend.pro -----
Name:
legend
Purpose:
This procedure makes a legend for a plot. The legend can contain
a mixture of symbols, linestyles, Hershey characters (vectorfont),
and filled polygons (usersym).
Examples:
The call:
legend,['Plus sign','Asterisk','Period'],psym=[1,2,3]
produces:
-----------------
| |
| + Plus sign |
| * Asterisk |
| . Period |
| |
-----------------
etc.
Placing an example just after the purpose gives a good oveview of the routine
on the first page of the doc_library output, so the user can exit from IDL's
MORE right away.
The code is simple. All that is needed in the procedure is a single line. For
example,
pro legend,help=help,items,linestyle=linestyle,psym=psym ...
;
; =====>> HELP
;
on_error,2
if keyword_set(help) then begin & doc_library,'legend' & return & endif
...
The method is simple, gives straightforward help, and promotes the inclusion of
headers in all routines.
Fred
In article <thompson.734709026@serts.gsfc.nasa.gov>, thompson@serts.gsfc.nasa.gov (William Thompson) writes:
|> deutsch@orac.stsci.edu writes:
|>
|> >In article <thompson.734294880@serts.gsfc.nasa.gov>, thompson@serts.gsfc.nasa.gov (William Thompson) writes:
|> >> kaij@dutnsi2.tudelft.nl (Roland Kaijen) writes:
|> >>
|> >>>n IDL 3.0.1 for WINDOWS there is very good online help-tool. Unfortunatly
|> >>>only the functions & procedures know by the makers of IDL are in this
|> >>>help-tool; there are however frequently used functions & procedures written
|> >>>by others that we would like to a
|> >>
|> >> Use the routine MK_LIBRARY_HELP in the IDL User's Library.
|> >>
|> >> Bill Thompson
|>
|> > This allows one to create the .HELP files, but what if you are not allowed
|> >to add to the IDL_DIR/help directory? e.g. on a cluster where you are not
|> >the main user of IDL, how can I add .HELP entries (for use with ?)
|> >for me to use, but not for everyone to have to see. Can I set something
|> >somewhere to not only look in the IDL distribution HELP directory, but also
|> >one of my own (or one which applies to a certain package, etc.)
|>
|>
|> The question mark command in IDL actually calls a routine called MAN_PROC. At
|> one point we had editted man_proc.pro to do exactly what you're talking about,
|> but then RSI came out with the widgetized version of "?" and we gave up.
|>
|> Nowadays we depend on another routine called DOC which allows us to browse
|> through the directories in !PATH, and to extract the documentation from it.
|> It's basically a user-friendly front-end to DOC_LIBRARY. The software works
|> best on a widgets platform such as X-windows or Microsoft Windows, but there's
|> also a capability of using it on less sophisticated platforms. If you want
|> this software, please E-mail me and I'll tell you how to get it.
|>
|> If you have widgets available to you (either X-windows or I believe now
|> Microsoft Windows) you can use a routine called XDL, which does more-or-less
|> the same thing as DOC, although somewhat differently. XDL should be supplied
|> with the IDL distribution.
|>
|> Bill Thompson
--
=Fred Knight (knight@ll.mit.edu) (617) 981-2027
C-483\\MIT Lincoln Laboratory\\244 Wood Street\\Lexington, MA 02173
|
|
|