From: Paul K. <pki...@us...> - 2004-06-03 12:44:41
|
On Jun 3, 2004, at 6:42 AM, David Bateman wrote: > According to Stefan van der Walt <st...@su...> (on 06/03/04): >> Getting a function's description would be a lot easier if 'help' could >> return the string produced by help(func)... Would this be easy to add? > ... > An alternative is that you can have access to the symbol table and > files > helps from within an oct-file (but not the keywords or operators, as > these are static in help.cc). A test implementation that allows the > help > text to be accessed in this manner is in the attached oct-file. You can > do something like 'fft_help = helpstring("fft")' to get the help text > of > the fft in this manner. To handle help for dispatched functions without preloading the base function I'm already playing some of these games in main/miscellaneous/dispatch.cc. You could easily extend it to return the help string as per David's suggestion. Indeed you would have to, since the doc string for a dispatched function contains: <> Overloaded function: ... with the <> replaced by the docstring of the base function by a call to dispatch_help. A couple of related things on the help wishlist: (1) the examples that I provide for some of the functions ought to be incorporated into the docstring. Right now I have them embedded as a special kind of test block, but there is no reason we couldn't encode them directly in the help text. With suitable markup, they could be automatically extracted and run from the returned help string. (2) since we can now overload help, interested parties could provide internationalization support based on if file_in_loadpath([fn,".",locale_lang]) then display that file with the help system rather than the usual doc string. I don't know that any parties are interested though. (3) wikipedia is starting to become useful for engineering math concepts. Putting live links in the help text to wikipedia articles (and if it seems appropriate, mathworld, though I prefer to support materials using the FDL). Along with cross-indexing the see-also text (and indeed, any text in the help string that happens to be a documented octave symbol), the html version of the docs becomes very useful. Paul Kienzle pki...@us... |