Mercurial > hg > octave-nkf
diff src/defun.cc @ 5800:e8be7fe586f9
[project @ 2006-05-10 06:50:45 by jwe]
author | jwe |
---|---|
date | Wed, 10 May 2006 06:50:45 +0000 |
parents | 1138ced03f14 |
children | 67bf9b4f2ae2 |
line wrap: on
line diff
--- a/src/defun.cc +++ b/src/defun.cc @@ -63,7 +63,7 @@ h = extract_help_from_dispatch (nm) + h; - display_help_text (buf, h); + display_usage_text (buf, h); buf << extra_msg << "\n"; @@ -77,6 +77,32 @@ warning ("no usage message found for `%s'", nm.c_str ()); } +DEFUN (print_usage, args, , + "-*- texinfo -*-\n\ +@deftypefn {Loadable Function} {} print_usage (@var{fname})\n\ +Print the usage message for the function named @var{fname}. The\n\ +@code{print_usage} function is only intended to work inside the\n\ +named function.\n\ +@seealso{help}\n\ +@end deftypefn") +{ + octave_value retval; + + if (args.length () == 1) + { + std::string fname = args(0).string_value (); + + if (! error_state) + print_usage (fname); + else + error ("print_usage: expecting character string"); + } + else + print_usage ("print_usage"); + + return retval; +} + void check_version (const std::string& version, const std::string& fcn) {