Mercurial > hg > octave-lyh
annotate examples/funcdemo.cc @ 9932:6cb30a539481
untabify files in examples directory
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 07 Dec 2009 14:53:20 -0500 |
parents | 4295d634797d |
children | 460a3c6d8bf1 |
rev | line source |
---|---|
6572 | 1 #include <octave/oct.h> |
2 #include <octave/parse.h> | |
3 | |
4 DEFUN_DLD (funcdemo, args, nargout, "Function Demo") | |
5 { | |
6 int nargin = args.length(); | |
7 octave_value_list retval; | |
8 | |
9 if (nargin < 2) | |
10 print_usage (); | |
11 else | |
12 { | |
13 octave_value_list newargs; | |
14 for (octave_idx_type i = nargin - 1; i > 0; i--) | |
15 newargs (i - 1) = args(i); | |
16 if (args(0).is_function_handle () | |
17 || args(0).is_inline_function ()) | |
18 { | |
19 octave_function *fcn = args(0).function_value (); | |
20 if (! error_state) | |
21 retval = feval (fcn, newargs, nargout); | |
22 } | |
23 else if (args(0).is_string ()) | |
24 { | |
25 std::string fcn = args (0).string_value (); | |
26 if (! error_state) | |
27 retval = feval (fcn, newargs, nargout); | |
28 } | |
29 else | |
7081 | 30 error ("funcdemo: expected string,", |
9932
6cb30a539481
untabify files in examples directory
John W. Eaton <jwe@octave.org>
parents:
9053
diff
changeset
|
31 " inline or function handle"); |
6572 | 32 } |
33 return retval; | |
34 } |