Mercurial > octave-nkf
annotate examples/code/myprop.c @ 20654:b65888ec820e draft default tip gccjit
dmalcom gcc jit import
author | Stefan Mahr <dac922@gmx.de> |
---|---|
date | Fri, 27 Feb 2015 16:59:36 +0100 |
parents | 5c42ff6f0eb1 |
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"); | |
20297 | 12 if (! mxIsDouble (prhs[0])) |
13 mexErrMsgTxt ("handle must be a double scalar"); | |
14 if (! mxIsChar (prhs[1])) | |
15 mexErrMsgTxt ("property must 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 } |