Mercurial > hg > octave-thorsten
changeset 3014:38de16594cb4
[project @ 1997-06-02 20:28:09 by jwe]
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/balance.cc +++ b/src/DLD-FUNCTIONS/balance.cc @@ -37,7 +37,6 @@ #include "defun-dld.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "oct-obj.h" #include "utils.h"
--- a/src/DLD-FUNCTIONS/chol.cc +++ b/src/DLD-FUNCTIONS/chol.cc @@ -30,7 +30,6 @@ #include "defun-dld.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "oct-obj.h" #include "utils.h"
--- a/src/DLD-FUNCTIONS/colloc.cc +++ b/src/DLD-FUNCTIONS/colloc.cc @@ -31,7 +31,6 @@ #include "defun-dld.h" #include "error.h" -#include "help.h" #include "oct-obj.h" #include "utils.h"
--- a/src/DLD-FUNCTIONS/dassl.cc +++ b/src/DLD-FUNCTIONS/dassl.cc @@ -33,7 +33,6 @@ #include "defun-dld.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "oct-obj.h" #include "ov-fcn.h" #include "pager.h"
--- a/src/DLD-FUNCTIONS/det.cc +++ b/src/DLD-FUNCTIONS/det.cc @@ -30,7 +30,6 @@ #include "defun-dld.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "oct-obj.h" #include "utils.h"
--- a/src/DLD-FUNCTIONS/eig.cc +++ b/src/DLD-FUNCTIONS/eig.cc @@ -29,7 +29,6 @@ #include "defun-dld.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "oct-obj.h" #include "utils.h"
--- a/src/DLD-FUNCTIONS/expm.cc +++ b/src/DLD-FUNCTIONS/expm.cc @@ -29,7 +29,6 @@ #include "defun-dld.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "oct-obj.h" #include "utils.h"
--- a/src/DLD-FUNCTIONS/fft.cc +++ b/src/DLD-FUNCTIONS/fft.cc @@ -29,7 +29,6 @@ #include "defun-dld.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "oct-obj.h" #include "utils.h"
--- a/src/DLD-FUNCTIONS/fft2.cc +++ b/src/DLD-FUNCTIONS/fft2.cc @@ -29,7 +29,6 @@ #include "defun-dld.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "oct-obj.h" #include "utils.h"
--- a/src/DLD-FUNCTIONS/filter.cc +++ b/src/DLD-FUNCTIONS/filter.cc @@ -35,7 +35,6 @@ #include "defun-dld.h" #include "error.h" #include "oct-obj.h" -#include "help.h" extern MArray<double> filter (MArray<double>&, MArray<double>&, MArray<double>&);
--- a/src/DLD-FUNCTIONS/find.cc +++ b/src/DLD-FUNCTIONS/find.cc @@ -27,7 +27,6 @@ #include "defun-dld.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "oct-obj.h" static octave_value_list
--- a/src/DLD-FUNCTIONS/fsolve.cc +++ b/src/DLD-FUNCTIONS/fsolve.cc @@ -33,7 +33,6 @@ #include "defun-dld.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "oct-obj.h" #include "ov-fcn.h" #include "pager.h"
--- a/src/DLD-FUNCTIONS/fsqp.cc +++ b/src/DLD-FUNCTIONS/fsqp.cc @@ -28,7 +28,6 @@ #include "defun-dld.h" #include "error.h" -#include "help.h" #include "oct-obj.h" #ifndef FSQP_MISSING
--- a/src/DLD-FUNCTIONS/getgrent.cc +++ b/src/DLD-FUNCTIONS/getgrent.cc @@ -35,7 +35,6 @@ #include "defun-dld.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "oct-map.h" #include "ov.h" #include "oct-obj.h"
--- a/src/DLD-FUNCTIONS/getpwent.cc +++ b/src/DLD-FUNCTIONS/getpwent.cc @@ -35,7 +35,6 @@ #include "defun-dld.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "oct-map.h" #include "ov.h" #include "oct-obj.h"
--- a/src/DLD-FUNCTIONS/getrusage.cc +++ b/src/DLD-FUNCTIONS/getrusage.cc @@ -50,7 +50,6 @@ #endif #include "defun-dld.h" -#include "help.h" #include "oct-map.h" #include "sysdep.h" #include "ov.h"
--- a/src/DLD-FUNCTIONS/givens.cc +++ b/src/DLD-FUNCTIONS/givens.cc @@ -28,7 +28,6 @@ #include "defun-dld.h" #include "error.h" -#include "help.h" #include "oct-obj.h" DEFUN_DLD (givens, args, nargout,
--- a/src/DLD-FUNCTIONS/hess.cc +++ b/src/DLD-FUNCTIONS/hess.cc @@ -30,7 +30,6 @@ #include "defun-dld.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "oct-obj.h" #include "utils.h"
--- a/src/DLD-FUNCTIONS/ifft.cc +++ b/src/DLD-FUNCTIONS/ifft.cc @@ -29,7 +29,6 @@ #include "defun-dld.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "oct-obj.h" #include "utils.h"
--- a/src/DLD-FUNCTIONS/ifft2.cc +++ b/src/DLD-FUNCTIONS/ifft2.cc @@ -29,7 +29,6 @@ #include "defun-dld.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "oct-obj.h" #include "utils.h"
--- a/src/DLD-FUNCTIONS/inv.cc +++ b/src/DLD-FUNCTIONS/inv.cc @@ -27,7 +27,6 @@ #include "defun-dld.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "oct-obj.h" #include "utils.h"
--- a/src/DLD-FUNCTIONS/log.cc +++ b/src/DLD-FUNCTIONS/log.cc @@ -29,7 +29,6 @@ #include "defun-dld.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "oct-obj.h" #include "utils.h"
--- a/src/DLD-FUNCTIONS/lpsolve.cc +++ b/src/DLD-FUNCTIONS/lpsolve.cc @@ -28,7 +28,6 @@ #include "defun-dld.h" #include "error.h" -#include "help.h" #include "oct-obj.h" DEFUN_DLD (lp_solve, , ,
--- a/src/DLD-FUNCTIONS/lsode.cc +++ b/src/DLD-FUNCTIONS/lsode.cc @@ -34,7 +34,6 @@ #include "defun-dld.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "oct-obj.h" #include "ov-fcn.h" #include "pager.h"
--- a/src/DLD-FUNCTIONS/lu.cc +++ b/src/DLD-FUNCTIONS/lu.cc @@ -30,7 +30,6 @@ #include "defun-dld.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "oct-obj.h" #include "utils.h"
--- a/src/DLD-FUNCTIONS/minmax.cc +++ b/src/DLD-FUNCTIONS/minmax.cc @@ -30,7 +30,6 @@ #include "defun-dld.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "oct-obj.h" #ifndef MAX
--- a/src/DLD-FUNCTIONS/npsol.cc +++ b/src/DLD-FUNCTIONS/npsol.cc @@ -34,7 +34,6 @@ #include "defun-dld.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "oct-obj.h" #include "ov-fcn.h" #include "pager.h"
--- a/src/DLD-FUNCTIONS/pinv.cc +++ b/src/DLD-FUNCTIONS/pinv.cc @@ -27,7 +27,6 @@ #include "defun-dld.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "oct-obj.h" #include "utils.h"
--- a/src/DLD-FUNCTIONS/qpsol.cc +++ b/src/DLD-FUNCTIONS/qpsol.cc @@ -34,7 +34,6 @@ #include "defun-dld.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "oct-obj.h" #include "pager.h" #include "utils.h"
--- a/src/DLD-FUNCTIONS/qr.cc +++ b/src/DLD-FUNCTIONS/qr.cc @@ -32,7 +32,6 @@ #include "defun-dld.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "oct-obj.h" #include "utils.h"
--- a/src/DLD-FUNCTIONS/quad.cc +++ b/src/DLD-FUNCTIONS/quad.cc @@ -34,7 +34,6 @@ #include "defun-dld.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "pager.h" #include "oct-obj.h" #include "ov-fcn.h"
--- a/src/DLD-FUNCTIONS/qzval.cc +++ b/src/DLD-FUNCTIONS/qzval.cc @@ -31,7 +31,6 @@ #include "defun-dld.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "oct-obj.h" DEFUN_DLD (qzval, args, ,
--- a/src/DLD-FUNCTIONS/rand.cc +++ b/src/DLD-FUNCTIONS/rand.cc @@ -34,7 +34,6 @@ #include "defun-dld.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "oct-obj.h" #include "unwind-prot.h" #include "utils.h"
--- a/src/DLD-FUNCTIONS/schur.cc +++ b/src/DLD-FUNCTIONS/schur.cc @@ -32,7 +32,6 @@ #include "defun-dld.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "oct-obj.h" #include "utils.h"
--- a/src/DLD-FUNCTIONS/sort.cc +++ b/src/DLD-FUNCTIONS/sort.cc @@ -27,7 +27,6 @@ #include "defun-dld.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "oct-obj.h" // This is algorithm 5.2.4L from Knuth, Volume 3.
--- a/src/DLD-FUNCTIONS/svd.cc +++ b/src/DLD-FUNCTIONS/svd.cc @@ -30,7 +30,6 @@ #include "defun-dld.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "oct-obj.h" #include "pr-output.h" #include "utils.h"
--- a/src/DLD-FUNCTIONS/syl.cc +++ b/src/DLD-FUNCTIONS/syl.cc @@ -29,7 +29,6 @@ #include "defun-dld.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "oct-obj.h" #include "utils.h"
--- a/src/DLD-FUNCTIONS/time.cc +++ b/src/DLD-FUNCTIONS/time.cc @@ -30,7 +30,6 @@ #include "defun-dld.h" #include "error.h" -#include "help.h" #include "oct-map.h" #include "systime.h" #include "ov.h"
--- a/src/data.cc +++ b/src/data.cc @@ -35,7 +35,6 @@ #include "defun.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "oct-map.h" #include "ov.h" #include "variables.h"
--- a/src/defun-int.h +++ b/src/defun-int.h @@ -27,6 +27,8 @@ class octave_value; +extern void print_usage (const string& nm, bool just_usage = false); + // XXX FIXME XXX -- change to use actual pointer types instead of void* // when things are not changing as rapidly.
--- a/src/defun.cc +++ b/src/defun.cc @@ -24,13 +24,40 @@ #include <config.h> #endif +#include <string> + #include "defun-int.h" +#include "error.h" +#include "help.h" #include "ov.h" #include "ov-builtin.h" #include "ov-mapper.h" +#include "pager.h" #include "symtab.h" #include "variables.h" +void +print_usage (const string& nm, bool just_usage) +{ + symbol_record *sym_rec = global_sym_tab->lookup (nm); + + if (sym_rec) + { + string h = sym_rec->help (); + + if (h.length () > 0) + { + octave_stdout << "\n*** " << nm << ":\n\n" + << h << "\n"; + + if (! just_usage) + additional_help_message (octave_stdout); + } + } + else + warning ("no usage message found for `%s'", nm.c_str ()); +} + // Install variables and functions in the symbol tables. void
--- a/src/dirfns.cc +++ b/src/dirfns.cc @@ -52,7 +52,6 @@ #include "dirfns.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "oct-obj.h" #include "pager.h" #include "procstream.h"
--- a/src/file-io.cc +++ b/src/file-io.cc @@ -53,7 +53,6 @@ #include "defun.h" #include "error.h" -#include "help.h" #include "lo-ieee.h" #include "oct-fstrm.h" #include "oct-iostrm.h"
--- a/src/help.cc +++ b/src/help.cc @@ -315,7 +315,7 @@ return retval; } -help_list * +static help_list * operator_help (void) { return operators; @@ -328,7 +328,8 @@ } #if defined (USE_GNU_INFO) -static void + +void additional_help_message (ostream& os) { if (! Vsuppress_verbose_help_message) @@ -338,34 +339,16 @@ \n\ Use the command `help -i <topic>' to search the manual index.\n"; } + #else -static void + +void additional_help_message (ostream&) { } + #endif -void -print_usage (const string& nm, int just_usage) -{ - symbol_record *sym_rec = global_sym_tab->lookup (nm); - if (sym_rec) - { - string h = sym_rec->help (); - - if (h.length () > 0) - { - octave_stdout << "\n*** " << nm << ":\n\n" - << h << "\n"; - - if (! just_usage) - additional_help_message (octave_stdout); - } - } - else - warning ("no usage message found for `%s'", nm.c_str ()); -} - // XXX FIXME XXX -- this needs a major overhaul to cope with new // symbol table stuff. @@ -467,15 +450,6 @@ } } -static void -simple_help (void) -{ - display_names_from_help_list (octave_stdout, operator_help (), - "operators"); - - display_names_from_help_list (octave_stdout, keyword_help (), - "reserved words"); - #ifdef LIST_SYMBOLS #undef LIST_SYMBOLS #endif @@ -488,6 +462,15 @@ } \ while (0) +static void +simple_help (void) +{ + display_names_from_help_list (octave_stdout, operator_help (), + "operators"); + + display_names_from_help_list (octave_stdout, keyword_help (), + "reserved words"); + // XXX FIXME XXX -- is this distinction needed? LIST_SYMBOLS (symbol_record::TEXT_FUNCTION, @@ -529,6 +512,7 @@ } #if defined (USE_GNU_INFO) + static int try_info (const string& nm) { @@ -589,8 +573,7 @@ { if (status < 0) { - message ("help", - "sorry, `%s' is not indexed in the manual", + message ("help", "sorry, `%s' is not indexed in the manual", argv[i].c_str ()); sleep (2); } @@ -603,19 +586,23 @@ } } } + #else + static void help_from_info (const string_vector&, int, int) { - message (0, "sorry, help -i is not available in this version of Octave"); + message ("help", "Info help is not available in this version of Octave"); } + #endif -int +static bool help_from_list (ostream& os, const help_list *list, const string& nm, int usage) { const char *name; + while ((name = list->name) != 0) { if (strcmp (name, nm.c_str ()) == 0) @@ -629,11 +616,12 @@ os << list->help << "\n"; - return 1; + return true; } list++; } - return 0; + + return false; } static void @@ -684,16 +672,15 @@ } #if defined (USE_GNU_INFO) -DEFUN_TEXT (help, args, , - "help [-i] [topic ...]\n\ -\n\ -print cryptic yet witty messages") +#define HELP_DOC_STRING \ + "help [-i] [topic ...]\n\nprint cryptic yet witty messages" #else +#define HELP_DOC_STRING \ + "help [topic ...]\n\nprint cryptic yet witty messages" +#endif + DEFUN_TEXT (help, args, , - "help [topic ...]\n\ -\n\ -print cryptic yet witty messages") -#endif + HELP_DOC_STRING) { octave_value_list retval; @@ -705,19 +692,13 @@ return retval; if (argc == 1) - { - simple_help (); - } + simple_help (); else { if (argv[1] == "-i") - { - help_from_info (argv, 2, argc); - } + help_from_info (argv, 2, argc); else - { - builtin_help (argc, argv); - } + builtin_help (argc, argv); } return retval; @@ -857,6 +838,7 @@ if (var_ok) { output_buf << argv[i]; + if (sym_rec->is_user_variable ()) output_buf << " is a user-defined variable\n"; else @@ -926,6 +908,7 @@ if (sym_rec) { int print = (nargout == 0); + string tmp = print_symbol_type (octave_stdout, sym_rec, argv[i], print); if (! print) @@ -947,15 +930,6 @@ } static int -suppress_verbose_help_message (void) -{ - Vsuppress_verbose_help_message - = check_preference ("suppress_verbose_help_message"); - - return 0; -} - -static int info_file (void) { int status = 0; @@ -991,6 +965,15 @@ return status; } +static int +suppress_verbose_help_message (void) +{ + Vsuppress_verbose_help_message + = check_preference ("suppress_verbose_help_message"); + + return 0; +} + void symbols_of_help (void) {
--- a/src/help.h +++ b/src/help.h @@ -38,14 +38,10 @@ }; extern string_vector names (help_list *l, int& count); -extern help_list *operator_help (void); + extern help_list *keyword_help (void); -extern void print_usage (const string& nm, int just_usage = 0); - -extern int help_from_list (ostrstream& output_buf, - const help_list *list, const string& nm, - int usage); +extern void additional_help_message (ostream&); // Name of the info file specified on command line. // (--info-file file)
--- a/src/input.cc +++ b/src/input.cc @@ -51,7 +51,6 @@ #include "dirfns.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "input.h" #include "oct-map.h" #include "oct-hist.h"
--- a/src/load-save.cc +++ b/src/load-save.cc @@ -46,7 +46,6 @@ #include "defun.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "load-save.h" #include "oct-obj.h" #include "pager.h"
--- a/src/octave.cc +++ b/src/octave.cc @@ -54,7 +54,6 @@ #include "dynamic-ld.h" #include "error.h" #include "file-io.h" -#include "help.h" #include "input.h" #include "lex.h" #include "oct-hist.h"
--- a/src/ov-list.cc +++ b/src/ov-list.cc @@ -35,7 +35,6 @@ #include "defun.h" #include "error.h" -#include "help.h" #include "ov-list.h" #include "unwind-prot.h"
--- a/src/ov-typeinfo.cc +++ b/src/ov-typeinfo.cc @@ -32,7 +32,6 @@ #include "defun.h" #include "error.h" -#include "help.h" #include "oct-obj.h" const int
--- a/src/ov-usr-fcn.cc +++ b/src/ov-usr-fcn.cc @@ -33,7 +33,6 @@ #include <defaults.h> #include "defun.h" #include "error.h" -#include "help.h" #include "input.h" #include "oct-obj.h" #include "ov-usr-fcn.h"
--- a/src/pager.cc +++ b/src/pager.cc @@ -38,7 +38,6 @@ #include "defun.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "input.h" #include "oct-obj.h" #include "pager.h"
--- a/src/pr-output.cc +++ b/src/pr-output.cc @@ -47,7 +47,6 @@ #include "defun.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "oct-obj.h" #include "pager.h" #include "pr-output.h"
--- a/src/pt-plot.cc +++ b/src/pt-plot.cc @@ -53,7 +53,6 @@ #include "defun.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "load-save.h" #include "oct-obj.h" #include "pt-cmd.h"
--- a/src/strfns.cc +++ b/src/strfns.cc @@ -31,7 +31,6 @@ #include "defun.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "ov.h" #include "oct-obj.h" #include "utils.h"
--- a/src/syscalls.cc +++ b/src/syscalls.cc @@ -51,7 +51,6 @@ #include "defun.h" #include "error.h" #include "gripes.h" -#include "help.h" #include "lo-utils.h" #include "oct-map.h" #include "oct-obj.h"
--- a/src/sysdep.cc +++ b/src/sysdep.cc @@ -72,7 +72,6 @@ #include "defun.h" #include "error.h" -#include "help.h" #include "input.h" #include "oct-obj.h" #include "ov.h"