view examples/myprop.c @ 18599:04b4fb217b1a stable

doc: Improve documentation strings in parse-tree directory. * lex.ll (F__display_tokens__): Add seealso reference. * lex.ll (F__token_count__): Add seealso reference. * lex.ll (F__lexer_debug_flag__): Document function. * oct-parse.in.yy (Fautoload): Add additional calling form. Rephrase several sentences. * oct-parse.in.yy (Fmfilename): Make single sentence description stand apart from the rest of documentation. * oct-parse.in.yy (Fsource): Make single sentence description stand apart from the rest of documentation. Add seealso link to 'run'. * oct-parse.in.yy (Fbuiltin): Change type to "Built-in Function" from "Loadable Function". * oct-parse.in.yy (Feval): Rephrase several sentences. Add programming note suggesting the use of alternatives like try/catch or unwind_protect. * oct-parse.in.yy (F__parser_debug_flag__): Document function. * pt-mat.cc (Fstring_fill_char): Use semicolon in place of period for stronger idea linkage.
author Rik <rik@octave.org>
date Fri, 28 Feb 2014 14:04:41 -0800
parents 224e76250443
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 expected to be a double scalar");
  if (!mxIsChar (prhs[1]))
    mexErrMsgTxt ("expected property to 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");
}