view examples/code/myprop.c @ 20741:dcfbf4c1c3c8

eliminate trailing whitespace and tabs from sources * Canvas.cc, Canvas.h, Figure.cc, gl-render.h, graphics.cc, ov-fcn-handle.cc, ov-java.cc, Range.cc, CmplxCHOL.cc, dbleCHOL.cc, floatCHOL.cc: Eliminate trailing whitespace and tabs used for indentation.
author John W. Eaton <jwe@octave.org>
date Thu, 01 Oct 2015 12:50:00 -0400
parents 5c42ff6f0eb1
children
line wrap: on
line source

#include "mex.h"

void
mexFunction (int nlhs, mxArray* plhs[],
             int nrhs, const mxArray* prhs[])
{
  double handle;
  char property[256];

  if (nrhs < 2 || nrhs > 3)
    mexErrMsgTxt ("incorrect number of arguments");
  if (! mxIsDouble (prhs[0]))
    mexErrMsgTxt ("handle must be a double scalar");
  if (! mxIsChar (prhs[1]))
    mexErrMsgTxt ("property must be a string");

  handle = mxGetScalar (prhs[0]);
  mxGetString (prhs[1], property, 256);
  plhs[0] = mxDuplicateArray (mexGet (handle, property));

  if (nrhs == 3)
    if (mexSet (handle, property, mxDuplicateArray (prhs[2])))
      mexErrMsgTxt ("failed to set property");
}