Mercurial > octave-nkf
annotate examples/code/funcdemo.cc @ 19067:c8240a60dd01
Add penny.mat to build system.
* examples/data/penny.mat: New example data file.
* examples/data/Makefile.am: Automake file for new directory of example data files.
* examples/Makefile.am: Change to be just a pass-through to the subdirectories
code/ and data/.
* examples/@FIRfilter/FIRfilter.m, examples/@FIRfilter/FIRfilter_aggregation.m,
examples/@FIRfilter/display.m, examples/@FIRfilter/module.mk,
examples/@FIRfilter/subsasgn.m, examples/@FIRfilter/subsref.m,
examples/@polynomial/display.m, examples/@polynomial/double.m,
examples/@polynomial/end.m, examples/@polynomial/get.m,
examples/@polynomial/module.mk, examples/@polynomial/mtimes.m,
examples/@polynomial/numel.m, examples/@polynomial/plot.m,
examples/@polynomial/polynomial.m,
examples/@polynomial/polynomial_superiorto.m, examples/@polynomial/polyval.m,
examples/@polynomial/roots.m, examples/@polynomial/set.m,
examples/@polynomial/subsasgn.m, examples/@polynomial/subsref.m,
examples/COPYING, examples/addtwomatrices.cc, examples/celldemo.cc,
examples/embedded.cc, examples/fortrandemo.cc, examples/fortransub.f,
examples/funcdemo.cc, examples/globaldemo.cc, examples/helloworld.cc,
examples/make_int.cc, examples/mex_demo.c, examples/mycell.c,
examples/myfeval.c, examples/myfevalf.f, examples/myfunc.c, examples/myhello.c,
examples/mypow2.c, examples/myprop.c, examples/myset.c, examples/mysparse.c,
examples/mystring.c, examples/mystruct.c, examples/oct_demo.cc,
examples/oregonator.cc, examples/oregonator.m, examples/paramdemo.cc,
examples/standalone.cc, examples/standalonebuiltin.cc, examples/stringdemo.cc,
examples/structdemo.cc, examples/unwinddemo.cc:
Move current example files to examples/code/ directory.
* configure.ac: Add Makefiles in examples/code and examples/data directories.
* build-aux/common.mk: Define octdatadir variable.
* doc/interpreter/Makefile.am: Change location of External Code Interface
examples to examples/code directory.
* doc/interpreter/munge-texi.pl: Expand EXAMPLEFILE macro to examples/code
directory.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 19 Aug 2014 14:32:44 -0700 |
parents | examples/funcdemo.cc@be41c30bcb44 |
children | 2f8500ca91d3 |
rev | line source |
---|---|
6572 | 1 #include <octave/oct.h> |
2 #include <octave/parse.h> | |
3 | |
4 DEFUN_DLD (funcdemo, args, nargout, "Function Demo") | |
5 { | |
16867
be41c30bcb44
Re-write documentation and all examples of dynamically linked functions.
Rik <rik@octave.org>
parents:
14846
diff
changeset
|
6 octave_value_list retval; |
14846
460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents:
9932
diff
changeset
|
7 int nargin = args.length (); |
6572 | 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--) | |
16867
be41c30bcb44
Re-write documentation and all examples of dynamically linked functions.
Rik <rik@octave.org>
parents:
14846
diff
changeset
|
15 newargs(i-1) = args(i); |
be41c30bcb44
Re-write documentation and all examples of dynamically linked functions.
Rik <rik@octave.org>
parents:
14846
diff
changeset
|
16 if (args(0).is_function_handle () || args(0).is_inline_function ()) |
6572 | 17 { |
18 octave_function *fcn = args(0).function_value (); | |
19 if (! error_state) | |
20 retval = feval (fcn, newargs, nargout); | |
21 } | |
22 else if (args(0).is_string ()) | |
23 { | |
16867
be41c30bcb44
Re-write documentation and all examples of dynamically linked functions.
Rik <rik@octave.org>
parents:
14846
diff
changeset
|
24 std::string fcn = args(0).string_value (); |
6572 | 25 if (! error_state) |
26 retval = feval (fcn, newargs, nargout); | |
27 } | |
28 else | |
16867
be41c30bcb44
Re-write documentation and all examples of dynamically linked functions.
Rik <rik@octave.org>
parents:
14846
diff
changeset
|
29 error ("funcdemo: INPUT must be string, inline, or function handle"); |
6572 | 30 } |
31 return retval; | |
32 } |