Mercurial > hg > octave-lyh
comparison examples/myfeval.c @ 16867:be41c30bcb44
Re-write documentation and all examples of dynamically linked functions.
* doc/interpreter/dynamic.txi: deleted.
* doc/interpreter/external.txi: Renamed from dynamic.txi. Rewrote or added
much information about dynamically linked functions.
* doc/interpreter/Makefile.am: Changed dynamic.txi to external.txi
in build system.
* doc/interpreter/data.txi, doc/interpreter/intro.txi,
doc/interpreter/octave.texi, doc/interpreter/sparse.txi: Changed dynamic.txi to
external.txi in cross-references.
* doc/interpreter/doccheck/aspell-octave.en.pws: Added new words from
external.txi to Octave dictionary.
* examples/firstmexdemo.c: deleted.
* examples/mex_demo.c: Renamed from firstmexdemo.c. Added many more comments
to code.
* examples/hello.cc: deleted.
* examples/oct_demo.cc: Renamed from hello.cc. Added many more comments
to code.
* examples/Makefile.am: Changed build system to use mex_demo.c and oct_demo.cc.
* examples/addtwomatrices.cc, examples/celldemo.cc, examples/embedded.cc,
examples/fortdemo.cc, examples/funcdemo.cc, examples/globaldemo.cc,
examples/helloworld.cc, examples/mycell.c, examples/myfeval.c,
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/paramdemo.cc, examples/standalone.cc,
examples/stringdemo.cc, examples/structdemo.cc, examples/unwinddemo.cc:
Use Octave coding conventions for code. Fixed all compilation errors and
warnings.
author | Rik <rik@octave.org> |
---|---|
date | Sat, 29 Jun 2013 18:08:24 -0700 |
parents | 6cb30a539481 |
children |
comparison
equal
deleted
inserted
replaced
16866:a472bfc67b6c | 16867:be41c30bcb44 |
---|---|
1 #include "mex.h" | 1 #include "mex.h" |
2 | 2 |
3 void | 3 void |
4 mexFunction (int nlhs, mxArray* plhs[], int nrhs, | 4 mexFunction (int nlhs, mxArray* plhs[], |
5 const mxArray* prhs[]) | 5 int nrhs, const mxArray* prhs[]) |
6 { | 6 { |
7 char *str; | 7 char *str; |
8 | 8 |
9 mexPrintf ("Hello, World!\n"); | 9 mexPrintf ("Hello, World!\n"); |
10 | 10 |
11 mexPrintf ("I have %d inputs and %d outputs\n", nrhs, | 11 mexPrintf ("I have %d inputs and %d outputs\n", nrhs, nlhs); |
12 nlhs); | |
13 | 12 |
14 if (nrhs < 1 || ! mxIsString (prhs[0])) | 13 if (nrhs < 1 || ! mxIsString (prhs[0])) |
15 mexErrMsgTxt ("function name expected"); | 14 mexErrMsgTxt ("ARG1 must be a function name"); |
16 | 15 |
17 str = mxArrayToString (prhs[0]); | 16 str = mxArrayToString (prhs[0]); |
18 | 17 |
19 mexPrintf ("I'm going to call the function %s\n", str); | 18 mexPrintf ("I'm going to call the function %s\n", str); |
20 | 19 |
21 mexCallMATLAB (nlhs, plhs, nrhs-1, prhs+1, str); | 20 mexCallMATLAB (nlhs, plhs, nrhs-1, (mxArray*)prhs+1, str); |
22 | 21 |
23 mxFree (str); | 22 mxFree (str); |
24 } | 23 } |