Ignore:
Timestamp:
Jan 11, 2006, 3:55:15 PM (19 years ago)
Author:
dkearney
Message:

modified matlab bindings and tests.
includes all popular functions available in RpLibrary? and RpUnits
compile and run, but not all tests work as they should
some of these functions will be removed soon because the id field is
no longer a valid argument. path ids should be incorporated in paths from now on.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/matlab/rpUnitsDefineUnit.cc

    r141 r154  
    33 *  INTERFACE: Matlab Rappture Library Source
    44 *
    5  *    [unitsHandle] = rpUnitsDefineUnit(unitSymbol, basisHandle)
     5 *    [unitsHandle,err] = rpUnitsDefineUnit(unitSymbol, basisHandle)
    66 *
    77 * ======================================================================
     
    1616#include "RpMatlabInterface.h"
    1717
     18/**********************************************************************/
     19// METHOD: [unitsHandle,err] = rpUnitsDefineUnit(unitSymbol, basisHandle)
     20/// Define a new Rappture Units type.
     21/**
     22 * Define a new Rappture Units type which can be searched for using
     23 * @var{unitSymbol} and has a basis of @var{basisHandle}. Because of
     24 * the way the Rappture Units module parses unit names, complex units must
     25 * be defined as multiple basic units. See the RpUnits Howto for more
     26 * information on this topic. A @var{basisHandle} equal to 0 means that
     27 * the unit being defined should be considered as a basis. Unit names must
     28 * not be empty strings.
     29 *
     30 * The first return value, @var{unitsHandle} represents the handle of the
     31 * instance of the RpUnits object inside the internal dictionary. On
     32 * success this value will be greater than zero (0), any other value is
     33 * represents failure within the function. The second return value
     34 * @var{err} represents the error code returned from the function.
     35 *
     36 * Error code, err=0 on success, anything else is failure.
     37 */
     38
    1839void mexFunction(int nlhs, mxArray *plhs[],
    1940                 int nrhs, const mxArray *prhs[])
     
    2546    int basisHandle = 0;
    2647    int retIndex = 0;
     48    int err = 1;
    2749
    2850    /* Check for proper number of arguments. */
    2951    if (nrhs != 2)
    3052        mexErrMsgTxt("Two input required.");
    31     else if (nlhs > 1)
     53    else if (nlhs > 2)
    3254        mexErrMsgTxt("Too many output arguments.");
    3355
     
    4567        if (myUnit) {
    4668            retHandle = storeObject_UnitsStr(myUnit->getUnitsName());
     69            if (retHandle) {
     70                err = 0;
     71            }
    4772        }
    4873    }
     
    5075    /* Set C-style string output_buf to MATLAB mexFunction output*/
    5176    plhs[0] = mxCreateDoubleScalar(retHandle);
     77    plhs[1] = mxCreateDoubleScalar(err);
    5278
    5379    return;
Note: See TracChangeset for help on using the changeset viewer.