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

Home » Public Forums » archive » [Object IDL] self-documenting objects ...
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
[Object IDL] self-documenting objects ... [message #12389] Fri, 31 July 1998 00:00 Go to next message
dEdmundson is currently offline  dEdmundson
Messages: 23
Registered: February 1998
Junior Member
I have created a number of potentially useful objects that I wish
to share with others. Of course I have documented the code and
written a nice comment header but it would be nice to access help
online. Thus, I have adopted the convention of coding a "help"
method procedure for every object I write, viz.

myobj = obj_new('myobject')
myobj -> help

Rather than having to duplicate documentation in this method
*and* the code header, can I not simply display the source
header to the user? This approach has the benefit of encouraging
the IDL programmer to write well-documented code headers.
Comments on this convention?

Question: how can I locate the source file assuming that
I know the file name (myobject__define.pro) and that it
is located in the IDL_PATH? (IDL's filepath procedure
gives incorrect info for user written routines.)

Any help is much appreciated.

Cheers,
Darran.

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
Re: [Object IDL] self-documenting objects ... [message #12445 is a reply to message #12389] Wed, 05 August 1998 00:00 Go to previous messageGo to next message
darran is currently offline  darran
Messages: 3
Registered: August 1998
Junior Member
Here is the germ of a method to include with your object
definitions:

pro myclass::help, extra=_ex
r = routine_info('MYCLASS__DEFINE', /source)
openr, source, r.path, /get_lun
s = ''
repeat begin
print, strmid(s,1)
readf, source, s
endrep until strmid(s,0,1) ne ';' or eof(source)
free_lun, source
end


Ensure that your object source files begin with
a semicolon. Calling the help method should
dump the source header (minus the leading semicolon)
to your screen.

It will serve my purposes for now although I can
immediately think of some issues/improvements:

- all objects should be callable with only the
object name. With req'd parameters, you need
to know the usage before you can access the help
method - catch22.

- "help" should likely be its own object, taking
a MYOBJ__DEFINE string as a keyword parameter.

Comments?

Darran.

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
Re: [Object IDL] self-documenting objects ... [message #12671 is a reply to message #12389] Thu, 06 August 1998 00:00 Go to previous message
mallors is currently offline  mallors
Messages: 76
Registered: November 1997
Member
On a similar note, I have a little program that
generates HTML for objects, sort of like javadoc.
It extracts the header, and all method definitions
and writes an HTML page. See "odoc" on my web
page if interested.

-bob mallozzi



--
Robert S. Mallozzi
http://cspar.uah.edu/~mallozzir/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: matlab/pv-wave conversion?
Next Topic: How to specify Y-axis label in LIVE_PLOT?

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

Current Time: Wed Oct 08 13:53:12 PDT 2025

Total time taken to generate the page: 0.00766 seconds