Mercurial > octave-nkf
annotate examples/myprop.c @ 18479:85d31344fb23 stable rc-3-8-1-2
3.8.1 release candidate 2
* configure.ac (OCTAVE_VERSION): Bump to 3.8.1-rc2.
(OCTAVE_MINOR_VERSION): Bump to 1-rc2.
(OCTAVE_RELEASE_DATE): Set to 2014-02-14.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 17 Feb 2014 02:20:39 -0500 |
parents | 224e76250443 |
children |
rev | line source |
---|---|
6595 | 1 #include "mex.h" |
2 | |
3 void | |
16867
be41c30bcb44
Re-write documentation and all examples of dynamically linked functions.
Rik <rik@octave.org>
parents:
14855
diff
changeset
|
4 mexFunction (int nlhs, mxArray* plhs[], |
be41c30bcb44
Re-write documentation and all examples of dynamically linked functions.
Rik <rik@octave.org>
parents:
14855
diff
changeset
|
5 int nrhs, const mxArray* prhs[]) |
6595 | 6 { |
7 double handle; | |
8 char property[256]; | |
9 | |
10 if (nrhs < 2 || nrhs > 3) | |
11 mexErrMsgTxt ("incorrect number of arguments"); | |
14855
1b48b209a8d6
maint: Use Octave coding conventions for coddling parentheses in examples directory
Rik <octave@nomad.inbox5.com>
parents:
9053
diff
changeset
|
12 if (!mxIsDouble (prhs[0])) |
6595 | 13 mexErrMsgTxt ("handle expected to be a double scalar"); |
14 if (!mxIsChar (prhs[1])) | |
15 mexErrMsgTxt ("expected property to be a string"); | |
17791
224e76250443
Use GNU style coding conventions for code in examples/
Rik <rik@octave.org>
parents:
16867
diff
changeset
|
16 |
6595 | 17 handle = mxGetScalar (prhs[0]); |
18 mxGetString (prhs[1], property, 256); | |
19 plhs[0] = mxDuplicateArray (mexGet (handle, property)); | |
17791
224e76250443
Use GNU style coding conventions for code in examples/
Rik <rik@octave.org>
parents:
16867
diff
changeset
|
20 |
6595 | 21 if (nrhs == 3) |
22 if (mexSet (handle, property, mxDuplicateArray (prhs[2]))) | |
23 mexErrMsgTxt ("failed to set property"); | |
24 } |