comparison 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
comparison
equal deleted inserted replaced
5799:9ad09b44beba 5800:e8be7fe586f9
61 61
62 buf << "\nInvalid call to " << nm << ". Correct usage is:\n\n"; 62 buf << "\nInvalid call to " << nm << ". Correct usage is:\n\n";
63 63
64 h = extract_help_from_dispatch (nm) + h; 64 h = extract_help_from_dispatch (nm) + h;
65 65
66 display_help_text (buf, h); 66 display_usage_text (buf, h);
67 67
68 buf << extra_msg << "\n"; 68 buf << extra_msg << "\n";
69 69
70 if (! just_usage) 70 if (! just_usage)
71 additional_help_message (buf); 71 additional_help_message (buf);
73 defun_usage_message (buf.str ()); 73 defun_usage_message (buf.str ());
74 } 74 }
75 } 75 }
76 else 76 else
77 warning ("no usage message found for `%s'", nm.c_str ()); 77 warning ("no usage message found for `%s'", nm.c_str ());
78 }
79
80 DEFUN (print_usage, args, ,
81 "-*- texinfo -*-\n\
82 @deftypefn {Loadable Function} {} print_usage (@var{fname})\n\
83 Print the usage message for the function named @var{fname}. The\n\
84 @code{print_usage} function is only intended to work inside the\n\
85 named function.\n\
86 @seealso{help}\n\
87 @end deftypefn")
88 {
89 octave_value retval;
90
91 if (args.length () == 1)
92 {
93 std::string fname = args(0).string_value ();
94
95 if (! error_state)
96 print_usage (fname);
97 else
98 error ("print_usage: expecting character string");
99 }
100 else
101 print_usage ("print_usage");
102
103 return retval;
78 } 104 }
79 105
80 void 106 void
81 check_version (const std::string& version, const std::string& fcn) 107 check_version (const std::string& version, const std::string& fcn)
82 { 108 {