From: David B. <Dav...@mo...> - 2004-06-03 10:42:46
|
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? The problem is that "help" is a function that itself calls different functions that return void, who themselves call other functions that are void. So the change is likely to be large if we try and get all of these functions to return a string. An alternative, is that all of these functions write to the stream "os" and so you could hijack this stream and replace it with a string stream that is used to create your return value. You'd also need to turn off the pager and ignore calls like "help -i <file>". You'll then need to put the pager and stream os back in place before returning Unfortunately you can't write your own version of help that does this as the functions simple_help and builtin_help in help.cc are both static. So you'll either need octave to be modified to include the above change or at least make simple_help and builtin_help callable externally.... 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. Regards David -- David Bateman Dav...@mo... Motorola CRM +33 1 69 35 48 04 (Ph) Parc Les Algorithmes, Commune de St Aubin +33 1 69 35 77 01 (Fax) 91193 Gif-Sur-Yvette FRANCE The information contained in this communication has been classified as: [x] General Business Information [ ] Motorola Internal Use Only [ ] Motorola Confidential Proprietary |